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));
}
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;
}
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();
}
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;
}
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 "";
}
}
Aggregations