Search in sources :

Example 21 with Logger

use of com.google.firebase.crashlytics.internal.Logger in project GreenHouse by utsanjan.

the class ExecutorUtils method addDelayedShutdownHook.

public static final void addDelayedShutdownHook(final String serviceName, final ExecutorService service, final long terminationTimeout, final TimeUnit timeUnit) {
    Runtime runtime = Runtime.getRuntime();
    BackgroundPriorityRunnable backgroundPriorityRunnable = new // from class: com.google.firebase.crashlytics.internal.common.ExecutorUtils.2
    BackgroundPriorityRunnable() {

        // com.google.firebase.crashlytics.internal.common.BackgroundPriorityRunnable
        @Override
        public void onRun() {
            try {
                Logger logger = Logger.getLogger();
                logger.d("Executing shutdown hook for " + serviceName);
                service.shutdown();
                if (!service.awaitTermination(terminationTimeout, timeUnit)) {
                    Logger logger2 = Logger.getLogger();
                    logger2.d(serviceName + " did not shut down in the allocated time. Requesting immediate shutdown.");
                    service.shutdownNow();
                }
            } catch (InterruptedException e) {
                Logger.getLogger().d(String.format(Locale.US, "Interrupted while waiting for %s to shut down. Requesting immediate shutdown.", serviceName));
                service.shutdownNow();
            }
        }
    };
    runtime.addShutdownHook(new Thread(backgroundPriorityRunnable, "Crashlytics Shutdown Hook for " + serviceName));
}
Also used : Logger(com.google.firebase.crashlytics.internal.Logger)

Example 22 with Logger

use of com.google.firebase.crashlytics.internal.Logger in project GreenHouse by utsanjan.

the class IdManager method getCrashlyticsInstallId.

// com.google.firebase.crashlytics.internal.common.InstallIdProvider
@Override
public synchronized String getCrashlyticsInstallId() {
    if (this.crashlyticsInstallId != null) {
        return this.crashlyticsInstallId;
    }
    SharedPreferences prefs = CommonUtils.getSharedPrefs(this.appContext);
    String currentFid = this.firebaseInstallId.getId();
    String cachedFid = prefs.getString(PREFKEY_FIREBASE_IID, null);
    if (cachedFid == null) {
        SharedPreferences legacyPrefs = CommonUtils.getLegacySharedPrefs(this.appContext);
        String legacyId = legacyPrefs.getString("crashlytics.installation.id", null);
        Logger logger = Logger.getLogger();
        logger.d("No cached FID; legacy id is " + legacyId);
        if (legacyId == null) {
            this.crashlyticsInstallId = createAndStoreIid(currentFid, prefs);
        } else {
            this.crashlyticsInstallId = legacyId;
            migrateLegacyId(legacyId, currentFid, prefs, legacyPrefs);
        }
        return this.crashlyticsInstallId;
    }
    if (cachedFid.equals(currentFid)) {
        this.crashlyticsInstallId = prefs.getString("crashlytics.installation.id", null);
        Logger logger2 = Logger.getLogger();
        logger2.d("Found matching FID, using Crashlytics IID: " + this.crashlyticsInstallId);
        if (this.crashlyticsInstallId == null) {
            this.crashlyticsInstallId = createAndStoreIid(currentFid, prefs);
        }
    } else {
        this.crashlyticsInstallId = createAndStoreIid(currentFid, prefs);
    }
    return this.crashlyticsInstallId;
}
Also used : SharedPreferences(android.content.SharedPreferences) Logger(com.google.firebase.crashlytics.internal.Logger)

Example 23 with Logger

use of com.google.firebase.crashlytics.internal.Logger in project GreenHouse by utsanjan.

the class IdManager method migrateLegacyId.

private synchronized void migrateLegacyId(String legacyId, String fidToCache, SharedPreferences prefs, SharedPreferences legacyPrefs) {
    Logger logger = Logger.getLogger();
    logger.d("Migrating legacy Crashlytics IID: " + legacyId);
    prefs.edit().putString("crashlytics.installation.id", legacyId).putString(PREFKEY_FIREBASE_IID, fidToCache).apply();
    legacyPrefs.edit().remove("crashlytics.installation.id").remove(PREFKEY_ADVERTISING_ID).apply();
}
Also used : Logger(com.google.firebase.crashlytics.internal.Logger)

Example 24 with Logger

use of com.google.firebase.crashlytics.internal.Logger in project GreenHouse by utsanjan.

the class CommonUtils method resolveUnityEditorVersion.

public static String resolveUnityEditorVersion(Context context) {
    int id = getResourcesIdentifier(context, UNITY_EDITOR_VERSION, "string");
    if (id == 0) {
        return null;
    }
    String version = context.getResources().getString(id);
    Logger logger = Logger.getLogger();
    logger.d("Unity Editor version is: " + version);
    return version;
}
Also used : Logger(com.google.firebase.crashlytics.internal.Logger)

Example 25 with Logger

use of com.google.firebase.crashlytics.internal.Logger in project GreenHouse by utsanjan.

the class CommonUtils method hash.

private static String hash(byte[] bytes, String algorithm) {
    try {
        MessageDigest digest = MessageDigest.getInstance(algorithm);
        digest.update(bytes);
        return hexify(digest.digest());
    } catch (NoSuchAlgorithmException e) {
        Logger logger = Logger.getLogger();
        logger.e("Could not create hashing algorithm: " + algorithm + ", returning empty string.", e);
        return "";
    }
}
Also used : NoSuchAlgorithmException(java.security.NoSuchAlgorithmException) MessageDigest(java.security.MessageDigest) Logger(com.google.firebase.crashlytics.internal.Logger)

Aggregations

Logger (com.google.firebase.crashlytics.internal.Logger)33 IOException (java.io.IOException)12 File (java.io.File)10 CrashlyticsReport (com.google.firebase.crashlytics.internal.model.CrashlyticsReport)4 HttpRequest (com.google.firebase.crashlytics.internal.network.HttpRequest)4 HttpResponse (com.google.firebase.crashlytics.internal.network.HttpResponse)4 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)2 JSONObject (org.json.JSONObject)2 SharedPreferences (android.content.SharedPreferences)1 Bundle (android.os.Bundle)1 SuccessContinuation (com.google.android.gms.tasks.SuccessContinuation)1 Task (com.google.android.gms.tasks.Task)1 NativeSessionFileProvider (com.google.firebase.crashlytics.internal.NativeSessionFileProvider)1 AnalyticsConnectorReceiver (com.google.firebase.crashlytics.internal.analytics.AnalyticsConnectorReceiver)1 AnalyticsReceiver (com.google.firebase.crashlytics.internal.analytics.AnalyticsReceiver)1 CrashlyticsReportWithSessionId (com.google.firebase.crashlytics.internal.common.CrashlyticsReportWithSessionId)1 LogFileManager (com.google.firebase.crashlytics.internal.log.LogFileManager)1 HttpRequestFactory (com.google.firebase.crashlytics.internal.network.HttpRequestFactory)1 FileStore (com.google.firebase.crashlytics.internal.persistence.FileStore)1 FileStoreImpl (com.google.firebase.crashlytics.internal.persistence.FileStoreImpl)1