granularity level: instruction

		.class final Lcom/google/firebase/messaging/ProxyNotificationInitializer;
.super Ljava/lang/Object;
.source "ProxyNotificationInitializer.java"


.field private static final MANIFEST_METADATA_NOTIFICATION_DELEGATION_ENABLED:Ljava/lang/String; = "firebase_messaging_notification_delegation_enabled"


.method private constructor <init>()V
	.locals 0

	invoke-direct {p0}, Ljava/lang/Object;-><init>()V
	return-void
.end method

.method private static allowedToUse(Landroid/content/Context;)Z
	.locals 1

	invoke-static {}, Landroid/os/Binder;->getCallingUid()I
	move-result v0
	invoke-virtual {p0}, Landroid/content/Context;->getApplicationInfo()Landroid/content/pm/ApplicationInfo;
	move-result-object p0
	iget p0, p0, Landroid/content/pm/ApplicationInfo;->uid:I
	if-ne v0, p0, :cond_0
	const/4 p0, 0x1
	goto :goto_0
	:cond_0
	const/4 p0, 0x0
	:goto_0
	return p0
.end method

.method static initialize(Landroid/content/Context;)V
	.locals 2

	invoke-static {p0}, Lcom/google/firebase/messaging/ProxyNotificationPreferences;->isProxyNotificationInitialized(Landroid/content/Context;)Z
	move-result v0
	if-eqz v0, :cond_0
	return-void
	:cond_0
	new-instance v0, Lcom/google/firebase/messaging/EnhancedIntentService$$ExternalSyntheticLambda1;
	invoke-direct {v0}, Lcom/google/firebase/messaging/EnhancedIntentService$$ExternalSyntheticLambda1;-><init>()V
	invoke-static {p0}, Lcom/google/firebase/messaging/ProxyNotificationInitializer;->shouldEnableProxyNotification(Landroid/content/Context;)Z
	move-result v1
	invoke-static {v0, p0, v1}, Lcom/google/firebase/messaging/ProxyNotificationInitializer;->setEnableProxyNotification(Ljava/util/concurrent/Executor;Landroid/content/Context;Z)Lcom/google/android/gms/tasks/Task;
	return-void
.end method

.method static isProxyNotificationEnabled(Landroid/content/Context;)Z
	.locals 4

	invoke-static {}, Lcom/google/android/gms/common/util/PlatformVersion;->isAtLeastQ()Z
	move-result v0
	const/4 v1, 0x3
	const/4 v2, 0x0
	const-string v3, "FirebaseMessaging"
	if-nez v0, :cond_1
	invoke-static {v3, v1}, Landroid/util/Log;->isLoggable(Ljava/lang/String;I)Z
	move-result p0
	if-eqz p0, :cond_0
	const-string p0, "Platform doesn\'t support proxying."
	invoke-static {v3, p0}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I
	:cond_0
	return v2
	:cond_1
	invoke-static {p0}, Lcom/google/firebase/messaging/ProxyNotificationInitializer;->allowedToUse(Landroid/content/Context;)Z
	move-result v0
	if-nez v0, :cond_2
	new-instance v0, Ljava/lang/StringBuilder;
	invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V
	const-string v1, "error retrieving notification delegate for package "
	invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
	invoke-virtual {p0}, Landroid/content/Context;->getPackageName()Ljava/lang/String;
	move-result-object p0
	invoke-virtual {v0, p0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
	invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
	move-result-object p0
	invoke-static {v3, p0}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I
	return v2
	:cond_2
	const-class v0, Landroid/app/NotificationManager;
	invoke-virtual {p0, v0}, Landroid/content/Context;->getSystemService(Ljava/lang/Class;)Ljava/lang/Object;
	move-result-object p0
	check-cast p0, Landroid/app/NotificationManager;
	invoke-virtual {p0}, Landroid/app/NotificationManager;->getNotificationDelegate()Ljava/lang/String;
	move-result-object p0
	const-string v0, "com.google.android.gms"
	invoke-virtual {v0, p0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
	move-result p0
	if-eqz p0, :cond_4
	invoke-static {v3, v1}, Landroid/util/Log;->isLoggable(Ljava/lang/String;I)Z
	move-result p0
	if-eqz p0, :cond_3
	const-string p0, "GMS core is set for proxying"
	invoke-static {v3, p0}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I
	:cond_3
	const/4 p0, 0x1
	return p0
	:cond_4
	return v2
.end method

.method static synthetic lambda$setEnableProxyNotification$0(Landroid/content/Context;ZLcom/google/android/gms/tasks/TaskCompletionSource;)V
	.locals 3

	const/4 v0, 0x0
	:try_start_0
	invoke-static {p0}, Lcom/google/firebase/messaging/ProxyNotificationInitializer;->allowedToUse(Landroid/content/Context;)Z
	move-result v1
	if-nez v1, :cond_0
	const-string p1, "FirebaseMessaging"
	new-instance v1, Ljava/lang/StringBuilder;
	invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V
	const-string v2, "error configuring notification delegate for package "
	invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
	invoke-virtual {p0}, Landroid/content/Context;->getPackageName()Ljava/lang/String;
	move-result-object p0
	invoke-virtual {v1, p0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
	invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
	move-result-object p0
	invoke-static {p1, p0}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I
	:try_end_0
	.catchall {:try_start_0 .. :try_end_0} :catchall_0
	invoke-virtual {p2, v0}, Lcom/google/android/gms/tasks/TaskCompletionSource;->trySetResult(Ljava/lang/Object;)Z
	return-void
	:cond_0
	const/4 v1, 0x1
	:try_start_1
	invoke-static {p0, v1}, Lcom/google/firebase/messaging/ProxyNotificationPreferences;->setProxyNotificationsInitialized(Landroid/content/Context;Z)V
	const-class v1, Landroid/app/NotificationManager;
	invoke-virtual {p0, v1}, Landroid/content/Context;->getSystemService(Ljava/lang/Class;)Ljava/lang/Object;
	move-result-object p0
	check-cast p0, Landroid/app/NotificationManager;
	:try_end_1
	.catchall {:try_start_1 .. :try_end_1} :catchall_0
	const-string v1, "com.google.android.gms"
	if-eqz p1, :cond_1
	:try_start_2
	invoke-virtual {p0, v1}, Landroid/app/NotificationManager;->setNotificationDelegate(Ljava/lang/String;)V
	goto :goto_0
	:cond_1
	invoke-virtual {p0}, Landroid/app/NotificationManager;->getNotificationDelegate()Ljava/lang/String;
	move-result-object p1
	invoke-virtual {v1, p1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
	move-result p1
	if-eqz p1, :cond_2
	invoke-virtual {p0, v0}, Landroid/app/NotificationManager;->setNotificationDelegate(Ljava/lang/String;)V
	:try_end_2
	.catchall {:try_start_2 .. :try_end_2} :catchall_0
	:goto_0
	:cond_2
	invoke-virtual {p2, v0}, Lcom/google/android/gms/tasks/TaskCompletionSource;->trySetResult(Ljava/lang/Object;)Z
	return-void
	:catchall_0
	move-exception p0
	invoke-virtual {p2, v0}, Lcom/google/android/gms/tasks/TaskCompletionSource;->trySetResult(Ljava/lang/Object;)Z
	throw p0
.end method

.method static setEnableProxyNotification(Ljava/util/concurrent/Executor;Landroid/content/Context;Z)Lcom/google/android/gms/tasks/Task;
	.locals 2
	.annotation system Ldalvik/annotation/Signature;
	value = {
	"(",
	"Ljava/util/concurrent/Executor;",
	"Landroid/content/Context;",
	"Z)",
	"Lcom/google/android/gms/tasks/Task<",
	"Ljava/lang/Void;",
	">;"
	}
	.end annotation

	invoke-static {}, Lcom/google/android/gms/common/util/PlatformVersion;->isAtLeastQ()Z
	move-result v0
	if-nez v0, :cond_0
	const/4 p0, 0x0
	invoke-static {p0}, Lcom/google/android/gms/tasks/Tasks;->forResult(Ljava/lang/Object;)Lcom/google/android/gms/tasks/Task;
	move-result-object p0
	return-object p0
	:cond_0
	new-instance v0, Lcom/google/android/gms/tasks/TaskCompletionSource;
	invoke-direct {v0}, Lcom/google/android/gms/tasks/TaskCompletionSource;-><init>()V
	new-instance v1, Lcom/google/firebase/messaging/ProxyNotificationInitializer$$ExternalSyntheticLambda0;
	invoke-direct {v1, p1, p2, v0}, Lcom/google/firebase/messaging/ProxyNotificationInitializer$$ExternalSyntheticLambda0;-><init>(Landroid/content/Context;ZLcom/google/android/gms/tasks/TaskCompletionSource;)V
	invoke-interface {p0, v1}, Ljava/util/concurrent/Executor;->execute(Ljava/lang/Runnable;)V
	invoke-virtual {v0}, Lcom/google/android/gms/tasks/TaskCompletionSource;->getTask()Lcom/google/android/gms/tasks/Task;
	move-result-object p0
	return-object p0
.end method

.method private static shouldEnableProxyNotification(Landroid/content/Context;)Z
	.locals 3

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