use of com.google.firebase.crashlytics.internal.settings.model.Settings 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) {
}
}
use of com.google.firebase.crashlytics.internal.settings.model.Settings in project GreenHouse by utsanjan.
the class CrashlyticsCore method doBackgroundInitialization.
/* JADX INFO: Access modifiers changed from: private */
public Task<Void> doBackgroundInitialization(SettingsDataProvider settingsProvider) {
markInitializationStarted();
this.controller.cleanInvalidTempFiles();
try {
this.controller.registerAnalyticsListener();
Settings settingsData = settingsProvider.getSettings();
if (!settingsData.getFeaturesData().collectReports) {
Logger.getLogger().d("Collection of crash reports disabled in Crashlytics settings.");
return Tasks.forException(new RuntimeException("Collection of crash reports disabled in Crashlytics settings."));
}
if (!this.controller.finalizeSessions(settingsData.getSessionData().maxCustomExceptionEvents)) {
Logger.getLogger().d("Could not finalize previous sessions.");
}
return this.controller.submitAllReports(1.0f, settingsProvider.getAppSettings());
} catch (Exception e) {
Logger.getLogger().e("Crashlytics encountered a problem during asynchronous initialization.", e);
return Tasks.forException(e);
} finally {
markInitializationComplete();
}
}
use of com.google.firebase.crashlytics.internal.settings.model.Settings in project firebase-android-sdk by firebase.
the class CrashlyticsControllerRobolectricTest method mockSettingsData.
private void mockSettingsData(boolean collectAnrs) {
Settings mockSettings = mock(Settings.class);
when(mockSettingsDataProvider.getSettings()).thenReturn(mockSettings);
when(mockSettings.getFeaturesData()).thenReturn(new FeaturesSettingsData(true, collectAnrs));
}
use of com.google.firebase.crashlytics.internal.settings.model.Settings in project firebase-android-sdk by firebase.
the class CrashlyticsCore method doBackgroundInitialization.
/**
* Performs background initialization synchronously on the calling thread.
*/
private Task<Void> doBackgroundInitialization(SettingsDataProvider settingsProvider) {
// create the marker for this run
markInitializationStarted();
try {
breadcrumbSource.registerBreadcrumbHandler(this::log);
final Settings settingsData = settingsProvider.getSettings();
if (!settingsData.getFeaturesData().collectReports) {
Logger.getLogger().d("Collection of crash reports disabled in Crashlytics settings.");
// handle this case.
return Tasks.forException(new RuntimeException("Collection of crash reports disabled in Crashlytics settings."));
}
if (!controller.finalizeSessions(settingsProvider)) {
Logger.getLogger().w("Previous sessions could not be finalized.");
}
// handle that as a separate call.
return controller.submitAllReports(settingsProvider.getAppSettings());
} catch (Exception e) {
Logger.getLogger().e("Crashlytics encountered a problem during asynchronous initialization.", e);
return Tasks.forException(e);
} finally {
// The only thing that compels us to leave the marker and start synchronously next time
// is not executing all the way through this method. That would indicate that we perhaps
// didn't get our settings and have a chance to send reports. This situation is usually
// caused by the Main thread crashing shortly after the synchronous portion of our
// start-up completes.
//
// Internal exceptions on start-up or other problems aren't likely to be fixed by
// starting synchronously next time, so don't bother slowing down the host app for that.
markInitializationComplete();
}
}
use of com.google.firebase.crashlytics.internal.settings.model.Settings in project firebase-android-sdk by firebase.
the class CrashlyticsReportPersistenceTest method getSettingsMock.
private static SettingsDataProvider getSettingsMock(int maxCompleteSessionsCount, int maxCustomExceptionEvents) {
SettingsDataProvider settingsDataProvider = mock(SettingsDataProvider.class);
Settings settingsMock = mock(Settings.class);
SessionSettingsData sessionSettingsDataMock = new SessionSettingsData(maxCustomExceptionEvents, maxCompleteSessionsCount);
when(settingsMock.getSessionData()).thenReturn(sessionSettingsDataMock);
when(settingsDataProvider.getSettings()).thenReturn(settingsMock);
return settingsDataProvider;
}
Aggregations