- Added realracing3-community.apk (71.57 MB) - Removed 32-bit support (armeabi-v7a) - Only includes arm64-v8a libraries - Decompiled source code included - Added README-community.md with analysis
115 lines
5.5 KiB
Java
115 lines
5.5 KiB
Java
package com.google.firebase.perf;
|
|
|
|
import android.content.Context;
|
|
import android.content.pm.PackageManager;
|
|
import android.os.Bundle;
|
|
import com.google.firebase.FirebaseApp;
|
|
import com.google.firebase.inject.Provider;
|
|
import com.google.firebase.installations.FirebaseInstallationsApi;
|
|
import com.google.firebase.perf.config.ConfigResolver;
|
|
import com.google.firebase.perf.config.RemoteConfigManager;
|
|
import com.google.firebase.perf.logging.AndroidLogger;
|
|
import com.google.firebase.perf.logging.ConsoleUrlGenerator;
|
|
import com.google.firebase.perf.session.SessionManager;
|
|
import com.google.firebase.perf.transport.TransportManager;
|
|
import com.google.firebase.perf.util.ImmutableBundle;
|
|
import java.util.HashMap;
|
|
import java.util.Map;
|
|
import java.util.concurrent.ConcurrentHashMap;
|
|
|
|
/* loaded from: classes3.dex */
|
|
public class FirebasePerformance {
|
|
public static final AndroidLogger logger = AndroidLogger.getInstance();
|
|
public final ConfigResolver configResolver;
|
|
public final FirebaseApp firebaseApp;
|
|
public final FirebaseInstallationsApi firebaseInstallationsApi;
|
|
public final Provider firebaseRemoteConfigProvider;
|
|
public final Map mCustomAttributes = new ConcurrentHashMap();
|
|
public final ImmutableBundle mMetadataBundle;
|
|
public Boolean mPerformanceCollectionForceEnabledState;
|
|
public final Provider transportFactoryProvider;
|
|
|
|
public static FirebasePerformance getInstance() {
|
|
return (FirebasePerformance) FirebaseApp.getInstance().get(FirebasePerformance.class);
|
|
}
|
|
|
|
public FirebasePerformance(FirebaseApp firebaseApp, Provider provider, FirebaseInstallationsApi firebaseInstallationsApi, Provider provider2, RemoteConfigManager remoteConfigManager, ConfigResolver configResolver, SessionManager sessionManager) {
|
|
this.mPerformanceCollectionForceEnabledState = null;
|
|
this.firebaseApp = firebaseApp;
|
|
this.firebaseRemoteConfigProvider = provider;
|
|
this.firebaseInstallationsApi = firebaseInstallationsApi;
|
|
this.transportFactoryProvider = provider2;
|
|
if (firebaseApp == null) {
|
|
this.mPerformanceCollectionForceEnabledState = Boolean.FALSE;
|
|
this.configResolver = configResolver;
|
|
this.mMetadataBundle = new ImmutableBundle(new Bundle());
|
|
return;
|
|
}
|
|
TransportManager.getInstance().initialize(firebaseApp, firebaseInstallationsApi, provider2);
|
|
Context applicationContext = firebaseApp.getApplicationContext();
|
|
ImmutableBundle extractMetadata = extractMetadata(applicationContext);
|
|
this.mMetadataBundle = extractMetadata;
|
|
remoteConfigManager.setFirebaseRemoteConfigProvider(provider);
|
|
this.configResolver = configResolver;
|
|
configResolver.setMetadataBundle(extractMetadata);
|
|
configResolver.setApplicationContext(applicationContext);
|
|
sessionManager.setApplicationContext(applicationContext);
|
|
this.mPerformanceCollectionForceEnabledState = configResolver.getIsPerformanceCollectionEnabled();
|
|
AndroidLogger androidLogger = logger;
|
|
if (androidLogger.isLogcatEnabled() && isPerformanceCollectionEnabled()) {
|
|
androidLogger.info(String.format("Firebase Performance Monitoring is successfully initialized! In a minute, visit the Firebase console to view your data: %s", ConsoleUrlGenerator.generateDashboardUrl(firebaseApp.getOptions().getProjectId(), applicationContext.getPackageName())));
|
|
}
|
|
}
|
|
|
|
public void setPerformanceCollectionEnabled(boolean z) {
|
|
setPerformanceCollectionEnabled(Boolean.valueOf(z));
|
|
}
|
|
|
|
public synchronized void setPerformanceCollectionEnabled(Boolean bool) {
|
|
try {
|
|
FirebaseApp.getInstance();
|
|
if (this.configResolver.getIsPerformanceCollectionDeactivated().booleanValue()) {
|
|
logger.info("Firebase Performance is permanently disabled");
|
|
return;
|
|
}
|
|
this.configResolver.setIsPerformanceCollectionEnabled(bool);
|
|
if (bool != null) {
|
|
this.mPerformanceCollectionForceEnabledState = bool;
|
|
} else {
|
|
this.mPerformanceCollectionForceEnabledState = this.configResolver.getIsPerformanceCollectionEnabled();
|
|
}
|
|
if (Boolean.TRUE.equals(this.mPerformanceCollectionForceEnabledState)) {
|
|
logger.info("Firebase Performance is Enabled");
|
|
} else if (Boolean.FALSE.equals(this.mPerformanceCollectionForceEnabledState)) {
|
|
logger.info("Firebase Performance is Disabled");
|
|
}
|
|
} catch (IllegalStateException unused) {
|
|
}
|
|
}
|
|
|
|
public boolean isPerformanceCollectionEnabled() {
|
|
Boolean bool = this.mPerformanceCollectionForceEnabledState;
|
|
if (bool != null) {
|
|
return bool.booleanValue();
|
|
}
|
|
return FirebaseApp.getInstance().isDataCollectionDefaultEnabled();
|
|
}
|
|
|
|
public Map getAttributes() {
|
|
return new HashMap(this.mCustomAttributes);
|
|
}
|
|
|
|
public static ImmutableBundle extractMetadata(Context context) {
|
|
Bundle bundle;
|
|
try {
|
|
bundle = context.getPackageManager().getApplicationInfo(context.getPackageName(), 128).metaData;
|
|
} catch (PackageManager.NameNotFoundException | NullPointerException e) {
|
|
StringBuilder sb = new StringBuilder();
|
|
sb.append("No perf enable meta data found ");
|
|
sb.append(e.getMessage());
|
|
bundle = null;
|
|
}
|
|
return bundle != null ? new ImmutableBundle(bundle) : new ImmutableBundle();
|
|
}
|
|
}
|