Search in sources :

Example 6 with FileStore

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));
}
Also used : FileStore(com.google.firebase.crashlytics.internal.persistence.FileStore) TestSettings(com.google.firebase.crashlytics.internal.settings.TestSettings) Resources(android.content.res.Resources) FirebaseOptions(com.google.firebase.FirebaseOptions) TestSettings(com.google.firebase.crashlytics.internal.settings.TestSettings) Settings(com.google.firebase.crashlytics.internal.settings.Settings) SettingsController(com.google.firebase.crashlytics.internal.settings.SettingsController)

Example 7 with FileStore

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);
    }
}
Also used : HttpRequestFactory(com.google.firebase.crashlytics.internal.network.HttpRequestFactory) FileStoreImpl(com.google.firebase.crashlytics.internal.persistence.FileStoreImpl) Logger(com.google.firebase.crashlytics.internal.Logger) TimeoutException(java.util.concurrent.TimeoutException) ExecutionException(java.util.concurrent.ExecutionException) ResourceUnityVersionProvider(com.google.firebase.crashlytics.internal.unity.ResourceUnityVersionProvider) UnityVersionProvider(com.google.firebase.crashlytics.internal.unity.UnityVersionProvider) FileStore(com.google.firebase.crashlytics.internal.persistence.FileStore) ResourceUnityVersionProvider(com.google.firebase.crashlytics.internal.unity.ResourceUnityVersionProvider) AnalyticsConnectorReceiver(com.google.firebase.crashlytics.internal.analytics.AnalyticsConnectorReceiver) AnalyticsReceiver(com.google.firebase.crashlytics.internal.analytics.AnalyticsReceiver)

Aggregations

FileStore (com.google.firebase.crashlytics.internal.persistence.FileStore)7 HttpRequestFactory (com.google.firebase.crashlytics.internal.network.HttpRequestFactory)2 Settings (com.google.firebase.crashlytics.internal.settings.Settings)2 SettingsController (com.google.firebase.crashlytics.internal.settings.SettingsController)2 TestSettings (com.google.firebase.crashlytics.internal.settings.TestSettings)2 Context (android.content.Context)1 PackageManager (android.content.pm.PackageManager)1 Resources (android.content.res.Resources)1 Nullable (androidx.annotation.Nullable)1 FirebaseOptions (com.google.firebase.FirebaseOptions)1 CrashlyticsNativeComponentDeferredProxy (com.google.firebase.crashlytics.internal.CrashlyticsNativeComponentDeferredProxy)1 DevelopmentPlatformProvider (com.google.firebase.crashlytics.internal.DevelopmentPlatformProvider)1 Logger (com.google.firebase.crashlytics.internal.Logger)1 AnalyticsConnectorReceiver (com.google.firebase.crashlytics.internal.analytics.AnalyticsConnectorReceiver)1 AnalyticsReceiver (com.google.firebase.crashlytics.internal.analytics.AnalyticsReceiver)1 AppData (com.google.firebase.crashlytics.internal.common.AppData)1 CrashlyticsCore (com.google.firebase.crashlytics.internal.common.CrashlyticsCore)1 DataCollectionArbiter (com.google.firebase.crashlytics.internal.common.DataCollectionArbiter)1 IdManager (com.google.firebase.crashlytics.internal.common.IdManager)1 FileStoreImpl (com.google.firebase.crashlytics.internal.persistence.FileStoreImpl)1