use of com.google.firebase.crashlytics.internal.persistence.FileStore in project firebase-android-sdk by firebase.
the class MetaDataStoreTest method setUp.
@Override
public void setUp() throws Exception {
super.setUp();
fileStore = new FileStore(getContext());
storeUnderTest = new MetaDataStore(fileStore);
}
use of com.google.firebase.crashlytics.internal.persistence.FileStore in project firebase-android-sdk by firebase.
the class FirebaseCrashlyticsNdk method create.
static FirebaseCrashlyticsNdk create(@NonNull Context context, boolean installHandlerDuringPrepareSession) {
final CrashpadController controller = new CrashpadController(context, new JniNativeApi(context), new FileStore(context));
instance = new FirebaseCrashlyticsNdk(controller, installHandlerDuringPrepareSession);
return instance;
}
use of com.google.firebase.crashlytics.internal.persistence.FileStore in project firebase-android-sdk by firebase.
the class FirebaseCrashlytics method init.
@Nullable
static FirebaseCrashlytics init(@NonNull FirebaseApp app, @NonNull FirebaseInstallationsApi firebaseInstallationsApi, @NonNull Deferred<CrashlyticsNativeComponent> nativeComponent, @NonNull Deferred<AnalyticsConnector> analyticsConnector) {
Context context = app.getApplicationContext();
final String appIdentifier = context.getPackageName();
Logger.getLogger().i("Initializing Firebase Crashlytics " + CrashlyticsCore.getVersion() + " for " + appIdentifier);
FileStore fileStore = new FileStore(context);
final DataCollectionArbiter arbiter = new DataCollectionArbiter(app);
final IdManager idManager = new IdManager(context, appIdentifier, firebaseInstallationsApi, arbiter);
final CrashlyticsNativeComponentDeferredProxy deferredNativeComponent = new CrashlyticsNativeComponentDeferredProxy(nativeComponent);
// Integration with Firebase Analytics
final AnalyticsDeferredProxy analyticsDeferredProxy = new AnalyticsDeferredProxy(analyticsConnector);
final ExecutorService crashHandlerExecutor = ExecutorUtils.buildSingleThreadExecutorService("Crashlytics Exception Handler");
final CrashlyticsCore core = new CrashlyticsCore(app, idManager, deferredNativeComponent, arbiter, analyticsDeferredProxy.getDeferredBreadcrumbSource(), analyticsDeferredProxy.getAnalyticsEventLogger(), fileStore, crashHandlerExecutor);
final String googleAppId = app.getOptions().getApplicationId();
final String mappingFileId = CommonUtils.getMappingFileId(context);
Logger.getLogger().d("Mapping file ID is: " + mappingFileId);
final DevelopmentPlatformProvider developmentPlatformProvider = new DevelopmentPlatformProvider(context);
AppData appData;
try {
appData = AppData.create(context, idManager, googleAppId, mappingFileId, developmentPlatformProvider);
} catch (PackageManager.NameNotFoundException e) {
Logger.getLogger().e("Error retrieving app package info.", e);
return null;
}
Logger.getLogger().v("Installer package name is: " + appData.installerPackageName);
final ExecutorService threadPoolExecutor = ExecutorUtils.buildSingleThreadExecutorService("com.google.firebase.crashlytics.startup");
final SettingsController settingsController = SettingsController.create(context, googleAppId, idManager, new HttpRequestFactory(), appData.versionCode, appData.versionName, fileStore, arbiter);
// Kick off actually fetching the settings.
settingsController.loadSettingsData(threadPoolExecutor).continueWith(threadPoolExecutor, new Continuation<Void, Object>() {
@Override
public Object then(@NonNull Task<Void> task) throws Exception {
if (!task.isSuccessful()) {
Logger.getLogger().e("Error fetching settings.", task.getException());
}
return null;
}
});
final boolean finishCoreInBackground = core.onPreExecute(appData, settingsController);
Tasks.call(threadPoolExecutor, new Callable<Void>() {
@Override
public Void call() throws Exception {
if (finishCoreInBackground) {
core.doBackgroundInitializationAsync(settingsController);
}
return null;
}
});
return new FirebaseCrashlytics(core);
}
use of com.google.firebase.crashlytics.internal.persistence.FileStore in project firebase-android-sdk by firebase.
the class CrashlyticsControllerRobolectricTest method setUp.
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
testContext = getApplicationContext();
testFileStore = new FileStore(testContext);
}
use of com.google.firebase.crashlytics.internal.persistence.FileStore in project firebase-android-sdk by firebase.
the class CrashlyticsControllerTest method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
testContext = getContext();
FirebaseInstallationsApi installationsApiMock = mock(FirebaseInstallationsApi.class);
when(installationsApiMock.getId()).thenReturn(Tasks.forResult("instanceId"));
idManager = new IdManager(testContext, testContext.getPackageName(), installationsApiMock, DataCollectionArbiterTest.MOCK_ARBITER_ENABLED);
testFileStore = new FileStore(testContext);
Settings testSettings = new TestSettings(3);
mockSessionReportingCoordinator = mock(SessionReportingCoordinator.class);
mockDataCollectionArbiter = mock(DataCollectionArbiter.class);
when(mockDataCollectionArbiter.isAutomaticDataCollectionEnabled()).thenReturn(true);
testSettingsProvider = mock(SettingsProvider.class);
when(testSettingsProvider.getSettingsSync()).thenReturn(testSettings);
when(testSettingsProvider.getSettingsAsync()).thenReturn(Tasks.forResult(testSettings));
}
Aggregations