use of com.google.firebase.crashlytics.internal.persistence.FileStore in project firebase-android-sdk by firebase.
the class CrashlyticsCoreInitializationTest method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
mockAppContext = newMockContext();
mockResources = mock(Resources.class);
testFirebaseOptions = new FirebaseOptions.Builder().setApplicationId(GOOGLE_APP_ID).build();
fileStore = new FileStore(getContext());
mockSettingsController = mock(SettingsController.class);
Settings settings = new TestSettings();
when(mockSettingsController.getSettingsSync()).thenReturn(settings);
when(mockSettingsController.getSettingsAsync()).thenReturn(Tasks.forResult(settings));
}
use of com.google.firebase.crashlytics.internal.persistence.FileStore in project GreenHouse by utsanjan.
the class CrashlyticsCore method onPreExecute.
public boolean onPreExecute(SettingsDataProvider settingsProvider) {
Exception e;
boolean initializeSynchronously;
String mappingFileId = CommonUtils.getMappingFileId(this.context);
Logger logger = Logger.getLogger();
logger.d("Mapping file ID is: " + mappingFileId);
boolean requiresBuildId = CommonUtils.getBooleanResourceValue(this.context, CRASHLYTICS_REQUIRE_BUILD_ID, CRASHLYTICS_REQUIRE_BUILD_ID_DEFAULT);
if (isBuildIdValid(mappingFileId, requiresBuildId)) {
String googleAppId = this.app.getOptions().getApplicationId();
try {
Logger logger2 = Logger.getLogger();
logger2.i("Initializing Crashlytics " + getVersion());
FileStore fileStore = new FileStoreImpl(this.context);
this.crashMarker = new CrashlyticsFileMarker(CRASH_MARKER_FILE_NAME, fileStore);
this.initializationMarker = new CrashlyticsFileMarker(INITIALIZATION_MARKER_FILE_NAME, fileStore);
HttpRequestFactory httpRequestFactory = new HttpRequestFactory();
AppData appData = AppData.create(this.context, this.idManager, googleAppId, mappingFileId);
UnityVersionProvider unityVersionProvider = new ResourceUnityVersionProvider(this.context);
AnalyticsReceiver analyticsReceiver = new AnalyticsConnectorReceiver(this.analyticsConnector, new // from class: com.google.firebase.crashlytics.internal.common.CrashlyticsCore.1
AnalyticsConnectorReceiver.BreadcrumbHandler() {
// com.google.firebase.crashlytics.internal.analytics.AnalyticsConnectorReceiver.BreadcrumbHandler
@Override
public void dropBreadcrumb(String breadcrumb) {
CrashlyticsCore.this.log(breadcrumb);
}
});
Logger logger3 = Logger.getLogger();
logger3.d("Installer package name is: " + appData.installerPackageName);
this.controller = new CrashlyticsController(this.context, this.backgroundWorker, httpRequestFactory, this.idManager, this.dataCollectionArbiter, fileStore, this.crashMarker, appData, null, null, this.nativeComponent, unityVersionProvider, analyticsReceiver, this.analyticsConnector, settingsProvider);
initializeSynchronously = didPreviousInitializationFail();
checkForPreviousCrash();
} catch (Exception e2) {
e = e2;
}
try {
this.controller.enableExceptionHandling(Thread.getDefaultUncaughtExceptionHandler(), settingsProvider);
if (!initializeSynchronously || !CommonUtils.canTryConnection(this.context)) {
Logger.getLogger().d("Exception handling initialization successful");
return CRASHLYTICS_REQUIRE_BUILD_ID_DEFAULT;
}
Logger.getLogger().d("Crashlytics did not finish previous background initialization. Initializing synchronously.");
finishInitSynchronously(settingsProvider);
return false;
} catch (Exception e3) {
e = e3;
Logger.getLogger().e("Crashlytics was not started due to an exception during initialization", e);
this.controller = null;
return false;
}
} else {
throw new IllegalStateException(MISSING_BUILD_ID_MSG);
}
}
Aggregations