Search in sources :

Example 1 with SuccessContinuation

use of com.google.android.gms.tasks.SuccessContinuation in project GreenHouse by utsanjan.

the class CrashlyticsController method handleUncaughtException.

synchronized void handleUncaughtException(final SettingsDataProvider settingsDataProvider, final Thread thread, final Throwable ex) {
    Logger logger = Logger.getLogger();
    logger.d("Crashlytics is handling uncaught exception \"" + ex + "\" from thread " + thread.getName());
    final Date time = new Date();
    final Task<Void> recordFatalFirebaseEventTask = recordFatalFirebaseEvent(time.getTime());
    Task<Void> handleUncaughtExceptionTask = this.backgroundWorker.submitTask(new // from class: com.google.firebase.crashlytics.internal.common.CrashlyticsController.6
    Callable<Task<Void>>() {

        /* JADX WARN: Can't rename method to resolve collision */
        // java.util.concurrent.Callable
        @Override
        public Task<Void> call() throws Exception {
            CrashlyticsController.this.crashMarker.create();
            long timestampSeconds = CrashlyticsController.getTimestampSeconds(time);
            CrashlyticsController.this.reportingCoordinator.persistFatalEvent(ex, thread, timestampSeconds);
            CrashlyticsController.this.writeFatal(thread, ex, timestampSeconds);
            Settings settings = settingsDataProvider.getSettings();
            int maxCustomExceptionEvents = settings.getSessionData().maxCustomExceptionEvents;
            int maxCompleteSessionsCount = settings.getSessionData().maxCompleteSessionsCount;
            CrashlyticsController.this.doCloseSessions(maxCustomExceptionEvents);
            CrashlyticsController.this.doOpenSession();
            CrashlyticsController.this.trimSessionFiles(maxCompleteSessionsCount);
            if (!CrashlyticsController.this.dataCollectionArbiter.isAutomaticDataCollectionEnabled()) {
                return Tasks.forResult(null);
            }
            final Executor executor = CrashlyticsController.this.backgroundWorker.getExecutor();
            return settingsDataProvider.getAppSettings().onSuccessTask(executor, new // from class: com.google.firebase.crashlytics.internal.common.CrashlyticsController.6.1
            SuccessContinuation<AppSettingsData, Void>() {

                public Task<Void> then(AppSettingsData appSettingsData) throws Exception {
                    if (appSettingsData == null) {
                        Logger.getLogger().w("Received null app settings, cannot send reports at crash time.");
                        return Tasks.forResult(null);
                    }
                    CrashlyticsController.this.sendSessionReports(appSettingsData, true);
                    return Tasks.whenAll(CrashlyticsController.this.reportingCoordinator.sendReports(executor, DataTransportState.getState(appSettingsData)), recordFatalFirebaseEventTask);
                }
            });
        }
    });
    try {
        Utils.awaitEvenIfOnMainThread(handleUncaughtExceptionTask);
    } catch (Exception e) {
    }
}
Also used : AppSettingsData(com.google.firebase.crashlytics.internal.settings.model.AppSettingsData) Task(com.google.android.gms.tasks.Task) ScheduledThreadPoolExecutor(java.util.concurrent.ScheduledThreadPoolExecutor) ThreadPoolExecutor(java.util.concurrent.ThreadPoolExecutor) Executor(java.util.concurrent.Executor) Logger(com.google.firebase.crashlytics.internal.Logger) SuccessContinuation(com.google.android.gms.tasks.SuccessContinuation) Date(java.util.Date) IOException(java.io.IOException) Settings(com.google.firebase.crashlytics.internal.settings.model.Settings)

Aggregations

SuccessContinuation (com.google.android.gms.tasks.SuccessContinuation)1 Task (com.google.android.gms.tasks.Task)1 Logger (com.google.firebase.crashlytics.internal.Logger)1 AppSettingsData (com.google.firebase.crashlytics.internal.settings.model.AppSettingsData)1 Settings (com.google.firebase.crashlytics.internal.settings.model.Settings)1 IOException (java.io.IOException)1 Date (java.util.Date)1 Executor (java.util.concurrent.Executor)1 ScheduledThreadPoolExecutor (java.util.concurrent.ScheduledThreadPoolExecutor)1 ThreadPoolExecutor (java.util.concurrent.ThreadPoolExecutor)1