granularity level: instruction
.class public final Lw/n;
.super Ljava/lang/Object;
.source "SourceFile"
.field public final a:Landroid/content/Context;
.field public b:I
.field public c:I
.method public constructor <init>(Landroid/content/Context;)V
.locals 1
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
const/4 v0, 0x0
iput v0, p0, Lw/n;->c:I
iput-object p1, p0, Lw/n;->a:Landroid/content/Context;
return-void
.end method
.method public final declared-synchronized a()I
.locals 5
monitor-enter p0
:try_start_0
iget v0, p0, Lw/n;->c:I
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
if-eqz v0, :cond_0
monitor-exit p0
return v0
:try_start_1
:cond_0
iget-object v0, p0, Lw/n;->a:Landroid/content/Context;
invoke-virtual {v0}, Landroid/content/Context;->getPackageManager()Landroid/content/pm/PackageManager;
move-result-object v0
iget-object v1, p0, Lw/n;->a:Landroid/content/Context;
invoke-static {v1}, Lf0/b;->a(Landroid/content/Context;)Lj1/c;
move-result-object v1
const-string v2, "com.google.android.c2dm.permission.SEND"
const-string v3, "com.google.android.gms"
iget-object v1, v1, Lj1/c;->a:Ljava/lang/Object;
check-cast v1, Landroid/content/Context;
invoke-virtual {v1}, Landroid/content/Context;->getPackageManager()Landroid/content/pm/PackageManager;
move-result-object v1
invoke-virtual {v1, v2, v3}, Landroid/content/pm/PackageManager;->checkPermission(Ljava/lang/String;Ljava/lang/String;)I
move-result v1
const/4 v2, -0x1
const/4 v3, 0x0
if-ne v1, v2, :cond_1
const-string v0, "Metadata"
const-string v1, "Google Play services missing or without correct permission."
invoke-static {v0, v1}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I
:try_end_1
.catchall {:try_start_1 .. :try_end_1} :catchall_0
monitor-exit p0
return v3
:try_start_2
:cond_1
invoke-static {}, Lp0/a;->u()Z
move-result v1
const/4 v2, 0x1
if-nez v1, :cond_3
new-instance v1, Landroid/content/Intent;
const-string v4, "com.google.android.c2dm.intent.REGISTER"
invoke-direct {v1, v4}, Landroid/content/Intent;-><init>(Ljava/lang/String;)V
const-string v4, "com.google.android.gms"
invoke-virtual {v1, v4}, Landroid/content/Intent;->setPackage(Ljava/lang/String;)Landroid/content/Intent;
invoke-virtual {v0, v1, v3}, Landroid/content/pm/PackageManager;->queryIntentServices(Landroid/content/Intent;I)Ljava/util/List;
move-result-object v1
if-eqz v1, :cond_3
invoke-interface {v1}, Ljava/util/List;->size()I
move-result v1
if-gtz v1, :cond_2
goto :goto_0
:cond_2
iput v2, p0, Lw/n;->c:I
:try_end_2
.catchall {:try_start_2 .. :try_end_2} :catchall_0
monitor-exit p0
return v2
:goto_0
:try_start_3
:cond_3
new-instance v1, Landroid/content/Intent;
const-string v4, "com.google.iid.TOKEN_REQUEST"
invoke-direct {v1, v4}, Landroid/content/Intent;-><init>(Ljava/lang/String;)V
const-string v4, "com.google.android.gms"
invoke-virtual {v1, v4}, Landroid/content/Intent;->setPackage(Ljava/lang/String;)Landroid/content/Intent;
invoke-virtual {v0, v1, v3}, Landroid/content/pm/PackageManager;->queryBroadcastReceivers(Landroid/content/Intent;I)Ljava/util/List;
move-result-object v0
const/4 v1, 0x2
if-eqz v0, :cond_5
invoke-interface {v0}, Ljava/util/List;->size()I
move-result v0
if-gtz v0, :cond_4
goto :goto_1
:cond_4
iput v1, p0, Lw/n;->c:I
:try_end_3
.catchall {:try_start_3 .. :try_end_3} :catchall_0
monitor-exit p0
return v1
:try_start_4
:goto_1
:cond_5
const-string v0, "Metadata"
const-string v3, "Failed to resolve IID implementation package, falling back"
invoke-static {v0, v3}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;)I
invoke-static {}, Lp0/a;->u()Z
move-result v0
if-eqz v0, :cond_6
iput v1, p0, Lw/n;->c:I
const/4 v2, 0x2
goto :goto_2
:cond_6
iput v2, p0, Lw/n;->c:I
:try_end_4
.catchall {:try_start_4 .. :try_end_4} :catchall_0
:goto_2
monitor-exit p0
return v2
:catchall_0
move-exception v0
monitor-exit p0
throw v0
.end method