granularity level: instruction

		.class public Lcom/google/firebase/internal/DataCollectionConfigStorage;
.super Ljava/lang/Object;
.source "DataCollectionConfigStorage.java"


.field public static final DATA_COLLECTION_DEFAULT_ENABLED:Ljava/lang/String; = "firebase_data_collection_default_enabled"
.field private static final FIREBASE_APP_PREFS:Ljava/lang/String; = "com.google.firebase.common.prefs:"
.field private dataCollectionDefaultEnabled:Z
.field private final deviceProtectedContext:Landroid/content/Context;
.field private final publisher:Lcom/google/firebase/events/Publisher;
.field private final sharedPreferences:Landroid/content/SharedPreferences;


.method public constructor <init>(Landroid/content/Context;Ljava/lang/String;Lcom/google/firebase/events/Publisher;)V
	.locals 2

	invoke-direct {p0}, Ljava/lang/Object;-><init>()V
	invoke-static {p1}, Lcom/google/firebase/internal/DataCollectionConfigStorage;->directBootSafe(Landroid/content/Context;)Landroid/content/Context;
	move-result-object p1
	iput-object p1, p0, Lcom/google/firebase/internal/DataCollectionConfigStorage;->deviceProtectedContext:Landroid/content/Context;
	new-instance v0, Ljava/lang/StringBuilder;
	invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V
	const-string v1, "com.google.firebase.common.prefs:"
	invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
	invoke-virtual {v0, p2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
	invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
	move-result-object p2
	const/4 v0, 0x0
	invoke-virtual {p1, p2, v0}, Landroid/content/Context;->getSharedPreferences(Ljava/lang/String;I)Landroid/content/SharedPreferences;
	move-result-object p1
	iput-object p1, p0, Lcom/google/firebase/internal/DataCollectionConfigStorage;->sharedPreferences:Landroid/content/SharedPreferences;
	iput-object p3, p0, Lcom/google/firebase/internal/DataCollectionConfigStorage;->publisher:Lcom/google/firebase/events/Publisher;
	invoke-direct {p0}, Lcom/google/firebase/internal/DataCollectionConfigStorage;->readAutoDataCollectionEnabled()Z
	move-result p1
	iput-boolean p1, p0, Lcom/google/firebase/internal/DataCollectionConfigStorage;->dataCollectionDefaultEnabled:Z
	return-void
.end method

.method private static directBootSafe(Landroid/content/Context;)Landroid/content/Context;
	.locals 2

	sget v0, Landroid/os/Build$VERSION;->SDK_INT:I
	const/16 v1, 0x18
	if-ge v0, v1, :cond_0
	return-object p0
	:cond_0
	invoke-static {p0}, Landroidx/core/content/ContextCompat;->createDeviceProtectedStorageContext(Landroid/content/Context;)Landroid/content/Context;
	move-result-object p0
	return-object p0
.end method

.method private readAutoDataCollectionEnabled()Z
	.locals 3

	iget-object v0, p0, Lcom/google/firebase/internal/DataCollectionConfigStorage;->sharedPreferences:Landroid/content/SharedPreferences;
	const-string v1, "firebase_data_collection_default_enabled"
	invoke-interface {v0, v1}, Landroid/content/SharedPreferences;->contains(Ljava/lang/String;)Z
	move-result v0
	if-eqz v0, :cond_0
	iget-object v0, p0, Lcom/google/firebase/internal/DataCollectionConfigStorage;->sharedPreferences:Landroid/content/SharedPreferences;
	const/4 v2, 0x1
	invoke-interface {v0, v1, v2}, Landroid/content/SharedPreferences;->getBoolean(Ljava/lang/String;Z)Z
	move-result v0
	return v0
	:cond_0
	invoke-direct {p0}, Lcom/google/firebase/internal/DataCollectionConfigStorage;->readManifestDataCollectionEnabled()Z
	move-result v0
	return v0
.end method

.method private readManifestDataCollectionEnabled()Z
	.locals 4

	const-string v0, "firebase_data_collection_default_enabled"
	:try_start_0
	iget-object v1, p0, Lcom/google/firebase/internal/DataCollectionConfigStorage;->deviceProtectedContext:Landroid/content/Context;
	invoke-virtual {v1}, Landroid/content/Context;->getPackageManager()Landroid/content/pm/PackageManager;
	move-result-object v1
	if-eqz v1, :cond_0
	iget-object v2, p0, Lcom/google/firebase/internal/DataCollectionConfigStorage;->deviceProtectedContext:Landroid/content/Context;
	invoke-virtual {v2}, Landroid/content/Context;->getPackageName()Ljava/lang/String;
	move-result-object v2
	const/16 v3, 0x80
	invoke-virtual {v1, v2, v3}, Landroid/content/pm/PackageManager;->getApplicationInfo(Ljava/lang/String;I)Landroid/content/pm/ApplicationInfo;
	move-result-object v1
	if-eqz v1, :cond_0
	iget-object v2, v1, Landroid/content/pm/ApplicationInfo;->metaData:Landroid/os/Bundle;
	if-eqz v2, :cond_0
	iget-object v2, v1, Landroid/content/pm/ApplicationInfo;->metaData:Landroid/os/Bundle;
	invoke-virtual {v2, v0}, Landroid/os/Bundle;->containsKey(Ljava/lang/String;)Z
	move-result v2
	if-eqz v2, :cond_0
	iget-object v1, v1, Landroid/content/pm/ApplicationInfo;->metaData:Landroid/os/Bundle;
	invoke-virtual {v1, v0}, Landroid/os/Bundle;->getBoolean(Ljava/lang/String;)Z
	move-result v0
	:try_end_0
	.catch Landroid/content/pm/PackageManager$NameNotFoundException; {:try_start_0 .. :try_end_0} :catch_0
	return v0
	:cond_0
	:catch_0
	const/4 v0, 0x1
	return v0
.end method

.method private declared-synchronized updateDataCollectionDefaultEnabled(Z)V
	.locals 4

	monitor-enter p0
	:try_start_0
	iget-boolean v0, p0, Lcom/google/firebase/internal/DataCollectionConfigStorage;->dataCollectionDefaultEnabled:Z
	if-eq v0, p1, :cond_0
	iput-boolean p1, p0, Lcom/google/firebase/internal/DataCollectionConfigStorage;->dataCollectionDefaultEnabled:Z
	iget-object v0, p0, Lcom/google/firebase/internal/DataCollectionConfigStorage;->publisher:Lcom/google/firebase/events/Publisher;
	new-instance v1, Lcom/google/firebase/events/Event;
	const-class v2, Lcom/google/firebase/DataCollectionDefaultChange;
	new-instance v3, Lcom/google/firebase/DataCollectionDefaultChange;
	invoke-direct {v3, p1}, Lcom/google/firebase/DataCollectionDefaultChange;-><init>(Z)V
	invoke-direct {v1, v2, v3}, Lcom/google/firebase/events/Event;-><init>(Ljava/lang/Class;Ljava/lang/Object;)V
	invoke-interface {v0, v1}, Lcom/google/firebase/events/Publisher;->publish(Lcom/google/firebase/events/Event;)V
	:try_end_0
	.catchall {:try_start_0 .. :try_end_0} :catchall_0
	:cond_0
	monitor-exit p0
	return-void
	:catchall_0
	move-exception p1
	monitor-exit p0
	throw p1
.end method

.method public declared-synchronized isEnabled()Z
	.locals 1

	monitor-enter p0
	:try_start_0
	iget-boolean v0, p0, Lcom/google/firebase/internal/DataCollectionConfigStorage;->dataCollectionDefaultEnabled:Z
	:try_end_0
	.catchall {:try_start_0 .. :try_end_0} :catchall_0
	monitor-exit p0
	return v0
	:catchall_0
	move-exception v0
	monitor-exit p0
	throw v0
.end method

.method public declared-synchronized setEnabled(Ljava/lang/Boolean;)V
	.locals 2

	monitor-enter p0
	if-nez p1, :cond_0
	:try_start_0
	iget-object p1, p0, Lcom/google/firebase/internal/DataCollectionConfigStorage;->sharedPreferences:Landroid/content/SharedPreferences;
	invoke-interface {p1}, Landroid/content/SharedPreferences;->edit()Landroid/content/SharedPreferences$Editor;
	move-result-object p1
	const-string v0, "firebase_data_collection_default_enabled"
	invoke-interface {p1, v0}, Landroid/content/SharedPreferences$Editor;->remove(Ljava/lang/String;)Landroid/content/SharedPreferences$Editor;
	move-result-object p1
	invoke-interface {p1}, Landroid/content/SharedPreferences$Editor;->apply()V
	invoke-direct {p0}, Lcom/google/firebase/internal/DataCollectionConfigStorage;->readManifestDataCollectionEnabled()Z
	move-result p1
	invoke-direct {p0, p1}, Lcom/google/firebase/internal/DataCollectionConfigStorage;->updateDataCollectionDefaultEnabled(Z)V
	goto :goto_0
	:cond_0
	sget-object v0, Ljava/lang/Boolean;->TRUE:Ljava/lang/Boolean;
	invoke-virtual {v0, p1}, Ljava/lang/Boolean;->equals(Ljava/lang/Object;)Z
	move-result p1
	iget-object v0, p0, Lcom/google/firebase/internal/DataCollectionConfigStorage;->sharedPreferences:Landroid/content/SharedPreferences;
	invoke-interface {v0}, Landroid/content/SharedPreferences;->edit()Landroid/content/SharedPreferences$Editor;
	move-result-object v0
	const-string v1, "firebase_data_collection_default_enabled"
	invoke-interface {v0, v1, p1}, Landroid/content/SharedPreferences$Editor;->putBoolean(Ljava/lang/String;Z)Landroid/content/SharedPreferences$Editor;
	move-result-object v0
	invoke-interface {v0}, Landroid/content/SharedPreferences$Editor;->apply()V
	invoke-direct {p0, p1}, Lcom/google/firebase/internal/DataCollectionConfigStorage;->updateDataCollectionDefaultEnabled(Z)V
	:try_end_0
	.catchall {:try_start_0 .. :try_end_0} :catchall_0
	:goto_0
	monitor-exit p0
	return-void
	:catchall_0
	move-exception p1
	monitor-exit p0
	throw p1
.end method