- 28,932 files - Full Java source code - Smali files - Resources Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
55 lines
2.3 KiB
Java
55 lines
2.3 KiB
Java
package com.google.firebase.internal;
|
|
|
|
import android.content.Context;
|
|
import android.content.SharedPreferences;
|
|
import android.content.pm.ApplicationInfo;
|
|
import android.content.pm.PackageManager;
|
|
import android.os.Bundle;
|
|
import androidx.core.content.ContextCompat;
|
|
import com.google.firebase.events.Publisher;
|
|
|
|
/* loaded from: classes3.dex */
|
|
public class DataCollectionConfigStorage {
|
|
public boolean dataCollectionDefaultEnabled;
|
|
public final Context deviceProtectedContext;
|
|
public final Publisher publisher;
|
|
public final SharedPreferences sharedPreferences;
|
|
|
|
public DataCollectionConfigStorage(Context context, String str, Publisher publisher) {
|
|
Context directBootSafe = directBootSafe(context);
|
|
this.deviceProtectedContext = directBootSafe;
|
|
this.sharedPreferences = directBootSafe.getSharedPreferences("com.google.firebase.common.prefs:" + str, 0);
|
|
this.publisher = publisher;
|
|
this.dataCollectionDefaultEnabled = readAutoDataCollectionEnabled();
|
|
}
|
|
|
|
public static Context directBootSafe(Context context) {
|
|
return ContextCompat.createDeviceProtectedStorageContext(context);
|
|
}
|
|
|
|
public synchronized boolean isEnabled() {
|
|
return this.dataCollectionDefaultEnabled;
|
|
}
|
|
|
|
public final boolean readManifestDataCollectionEnabled() {
|
|
ApplicationInfo applicationInfo;
|
|
Bundle bundle;
|
|
try {
|
|
PackageManager packageManager = this.deviceProtectedContext.getPackageManager();
|
|
if (packageManager == null || (applicationInfo = packageManager.getApplicationInfo(this.deviceProtectedContext.getPackageName(), 128)) == null || (bundle = applicationInfo.metaData) == null || !bundle.containsKey("firebase_data_collection_default_enabled")) {
|
|
return true;
|
|
}
|
|
return applicationInfo.metaData.getBoolean("firebase_data_collection_default_enabled");
|
|
} catch (PackageManager.NameNotFoundException unused) {
|
|
return true;
|
|
}
|
|
}
|
|
|
|
public final boolean readAutoDataCollectionEnabled() {
|
|
if (this.sharedPreferences.contains("firebase_data_collection_default_enabled")) {
|
|
return this.sharedPreferences.getBoolean("firebase_data_collection_default_enabled", true);
|
|
}
|
|
return readManifestDataCollectionEnabled();
|
|
}
|
|
}
|