Blog Infos
Author
Published
Topics
,
Published
DataCollectionArbiter
// Returns a Task that results in TRUE if the reports can be uplaoded
private Task<Boolean> waitForReportAction() {
if (dataCollectionArbiter.isAutomaticDataCollectionEnabled()) {
Logger.getLogger().d("Automatic data collection is enabled. Allowing upload.");
...
return Tasks.forResult(true);
} else {
Logger.getLogger().d("Automatic data collection is disabled.");
...
dataCollectionArbiter.waitForAutomaticDataCollectionEnabled().onSuccessTask(new SuccessContinuation<Void, Boolean>() {
public Task<Boolean> then(@Nullable Void aVoid) throws Exception {
return Tasks.forResult(true);
}
});
...
}
}
CrashlyticsReport

 

SessionReportingCoordinator
public void onBeginSession(@NonNull String sessionId, long timestampSeconds) {
CrashlyticsReport capturedReport = dataCapture.captureReportData(sessionId, timestampSeconds);
reportPersistence.persistReport(capturedReport);
}

Besides creating the CrashlyticsReport, it’s also used to store logs and user related information.

 

public void onLog(long timestamp, String log)
public void onCustomKey(String key, String value)
public void onUserId(String userId)

 

 

Fatal events happen when the app crashes and non fatal events happen when you call FirebaseCrashlytics.recordException.

public void persistFatalEvent(@NonNull Throwable event, @NonNull Thread thread, @NonNull String sessionId, long timestamp)
public void persistNonFatalEvent(@NonNull Throwable event, @NonNull Thread thread, @NonNull String sessionId, long timestamp)
public void persistRelevantAppExitInfoEvent(String sessionId, List<ApplicationExitInfo> applicationExitInfoList, LogFileManager logFileManagerForSession, UserMetadata userMetadataForSession)
CrashlyticsReportDataCapture [Source]
CrashlyticsReportPersistence [Source]
DataTransportCrashlyticsReportSender [Source]
private static final String CRASHLYTICS_ENDPOINT = mergeStrings("hts/cahyiseot-agolai.o/1frlglgc/aclg", "tp:/rsltcrprsp.ogepscmv/ieo/eaybtho");
private static final String CRASHLYTICS_API_KEY = mergeStrings("AzSBpY4F0rHiHFdinTvM", "IayrSTFL9eJ69YeSUO2");
CrashlyticsController [Source]
crashMarker.create();
reportingCoordinator.persistFatalEvent(ex, thread, currentSessionId, timestampSeconds);
doCloseSessions(settingsDataProvider);
doOpenSession();
...
if (!dataCollectionArbiter.isAutomaticDataCollectionEnabled()) {
return Tasks.forResult((Object)null);
} else {
...
return Tasks.whenAll(new Task[]{CrashlyticsController.this.logAnalyticsAppExceptionEvents(), CrashlyticsController.this.reportingCoordinator.sendReports(executor)});
}

The above code returns a Task that only completes when all the steps are executed. That’s needed because the app can’t crash while data is being uploaded, to avoid that, Crashlytics blocks the main thread until the task completes.

Utils.awaitEvenIfOnMainThread(handleUncaughtExceptionTask);
view raw Utils.java hosted with ❤ by GitHub

Job Offers

Job Offers


    Android Developer

    Small and Modern GmbH
    Hamburg, Remote (Germany)
    • Full Time
    apply now

    Android Engineer

    Compare the Market
    London
    • Full Time
    apply now

    API Engineer

    American Express
    London
    • Full Time
    apply now
Load more listings

OUR VIDEO RECOMMENDATION

, ,

Automated migration of Android apps to Bazel build system

Migrating large projects that consist of hundreds or thousands of modules and being maintained by a large team, from Gradle to Bazel might be challenging. I would like to discuss the process of automation of…
Watch Video

Automated migration of Android apps to Bazel build system

Pavlo Stavytskyi
Software Engineer
Lyft

Automated migration of Android apps to Bazel build system

Pavlo Stavytskyi
Software Engineer
Lyft

Automated migration of Android apps to Bazel build system

Pavlo Stavytskyi
Software Engineer
Lyft

Jobs

CrashlyticsCore
CrashlyticsFileMarker
// Extracted from CrashlyticsCore.java
private CrashlyticsFileMarker initializationMarker;
private CrashlyticsFileMarker crashMarker;
crashMarker = new CrashlyticsFileMarker(CRASH_MARKER_FILE_NAME, fileStore);
initializationMarker = new CrashlyticsFileMarker(INITIALIZATION_MARKER_FILE_NAME, fileStore);
StackTraceTrimmingStrategy
new MiddleOutFallbackStrategy(
1024, new StackTraceTrimmingStrategy[]{new RemoveRepeatsStrategy(10)}
);
CommonUtils
public static boolean isEmulator(Context context) {
String androidId = Secure.getString(context.getContentResolver(), "android_id");
return Build.PRODUCT.contains("sdk") || Build.HARDWARE.contains("goldfish") || Build.HARDWARE.contains("ranchu") || androidId == null;
}

There’s also this code that’s used to verify whether the device is rooted.

public static boolean isRooted(Context context) {
boolean isEmulator = isEmulator(context);
String buildTags = Build.TAGS;
if (!isEmulator && buildTags != null && buildTags.contains("test-keys")) {
return true;
} else {
File file = new File("/system/app/Superuser.apk");
if (file.exists()) {
return true;
} else {
file = new File("/system/xbin/su");
return !isEmulator && file.exists();
}
}
}

YOU MAY BE INTERESTED IN

YOU MAY BE INTERESTED IN

blog
It’s one of the common UX across apps to provide swipe to dismiss so…
READ MORE
blog
Hi, today I come to you with a quick tip on how to update…
READ MORE
blog
Automation is a key point of Software Testing once it make possible to reproduce…
READ MORE
blog
Drag and Drop reordering in Recyclerview can be achieved with ItemTouchHelper (checkout implementation reference).…
READ MORE

Leave a Reply

Your email address will not be published.

Fill out this field
Fill out this field
Please enter a valid email address.

Menu