307 lines
8.4 KiB
Smali
307 lines
8.4 KiB
Smali
.class public Landroidx/browser/customtabs/CustomTabsClient;
|
|
.super Ljava/lang/Object;
|
|
.source "CustomTabsClient.java"
|
|
|
|
|
|
# instance fields
|
|
.field public final mService:Ls/a/a/b;
|
|
|
|
.field public final mServiceComponentName:Landroid/content/ComponentName;
|
|
|
|
|
|
# direct methods
|
|
.method public constructor <init>(Ls/a/a/b;Landroid/content/ComponentName;)V
|
|
.locals 0
|
|
.annotation build Landroidx/annotation/RestrictTo;
|
|
value = {
|
|
.enum Landroidx/annotation/RestrictTo$Scope;->LIBRARY_GROUP:Landroidx/annotation/RestrictTo$Scope;
|
|
}
|
|
.end annotation
|
|
|
|
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
|
|
|
|
iput-object p1, p0, Landroidx/browser/customtabs/CustomTabsClient;->mService:Ls/a/a/b;
|
|
|
|
iput-object p2, p0, Landroidx/browser/customtabs/CustomTabsClient;->mServiceComponentName:Landroid/content/ComponentName;
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public static bindCustomTabsService(Landroid/content/Context;Ljava/lang/String;Landroidx/browser/customtabs/CustomTabsServiceConnection;)Z
|
|
.locals 2
|
|
|
|
new-instance v0, Landroid/content/Intent;
|
|
|
|
const-string v1, "android.support.customtabs.action.CustomTabsService"
|
|
|
|
invoke-direct {v0, v1}, Landroid/content/Intent;-><init>(Ljava/lang/String;)V
|
|
|
|
invoke-static {p1}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z
|
|
|
|
move-result v1
|
|
|
|
if-nez v1, :cond_0
|
|
|
|
invoke-virtual {v0, p1}, Landroid/content/Intent;->setPackage(Ljava/lang/String;)Landroid/content/Intent;
|
|
|
|
:cond_0
|
|
const/16 p1, 0x21
|
|
|
|
invoke-virtual {p0, v0, p2, p1}, Landroid/content/Context;->bindService(Landroid/content/Intent;Landroid/content/ServiceConnection;I)Z
|
|
|
|
move-result p0
|
|
|
|
return p0
|
|
.end method
|
|
|
|
.method public static connectAndInitialize(Landroid/content/Context;Ljava/lang/String;)Z
|
|
.locals 2
|
|
|
|
const/4 v0, 0x0
|
|
|
|
if-nez p1, :cond_0
|
|
|
|
return v0
|
|
|
|
:cond_0
|
|
invoke-virtual {p0}, Landroid/content/Context;->getApplicationContext()Landroid/content/Context;
|
|
|
|
move-result-object p0
|
|
|
|
new-instance v1, Landroidx/browser/customtabs/CustomTabsClient$1;
|
|
|
|
invoke-direct {v1, p0}, Landroidx/browser/customtabs/CustomTabsClient$1;-><init>(Landroid/content/Context;)V
|
|
|
|
:try_start_0
|
|
invoke-static {p0, p1, v1}, Landroidx/browser/customtabs/CustomTabsClient;->bindCustomTabsService(Landroid/content/Context;Ljava/lang/String;Landroidx/browser/customtabs/CustomTabsServiceConnection;)Z
|
|
|
|
move-result p0
|
|
:try_end_0
|
|
.catch Ljava/lang/SecurityException; {:try_start_0 .. :try_end_0} :catch_0
|
|
|
|
return p0
|
|
|
|
:catch_0
|
|
return v0
|
|
.end method
|
|
|
|
.method public static getPackageName(Landroid/content/Context;Ljava/util/List;)Ljava/lang/String;
|
|
.locals 1
|
|
.param p1 # Ljava/util/List;
|
|
.annotation build Landroidx/annotation/Nullable;
|
|
.end annotation
|
|
.end param
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"(",
|
|
"Landroid/content/Context;",
|
|
"Ljava/util/List<",
|
|
"Ljava/lang/String;",
|
|
">;)",
|
|
"Ljava/lang/String;"
|
|
}
|
|
.end annotation
|
|
|
|
const/4 v0, 0x0
|
|
|
|
invoke-static {p0, p1, v0}, Landroidx/browser/customtabs/CustomTabsClient;->getPackageName(Landroid/content/Context;Ljava/util/List;Z)Ljava/lang/String;
|
|
|
|
move-result-object p0
|
|
|
|
return-object p0
|
|
.end method
|
|
|
|
.method public static getPackageName(Landroid/content/Context;Ljava/util/List;Z)Ljava/lang/String;
|
|
.locals 4
|
|
.param p1 # Ljava/util/List;
|
|
.annotation build Landroidx/annotation/Nullable;
|
|
.end annotation
|
|
.end param
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"(",
|
|
"Landroid/content/Context;",
|
|
"Ljava/util/List<",
|
|
"Ljava/lang/String;",
|
|
">;Z)",
|
|
"Ljava/lang/String;"
|
|
}
|
|
.end annotation
|
|
|
|
invoke-virtual {p0}, Landroid/content/Context;->getPackageManager()Landroid/content/pm/PackageManager;
|
|
|
|
move-result-object p0
|
|
|
|
if-nez p1, :cond_0
|
|
|
|
new-instance v0, Ljava/util/ArrayList;
|
|
|
|
invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V
|
|
|
|
goto :goto_0
|
|
|
|
:cond_0
|
|
move-object v0, p1
|
|
|
|
:goto_0
|
|
new-instance v1, Landroid/content/Intent;
|
|
|
|
const-string v2, "http://"
|
|
|
|
invoke-static {v2}, Landroid/net/Uri;->parse(Ljava/lang/String;)Landroid/net/Uri;
|
|
|
|
move-result-object v2
|
|
|
|
const-string v3, "android.intent.action.VIEW"
|
|
|
|
invoke-direct {v1, v3, v2}, Landroid/content/Intent;-><init>(Ljava/lang/String;Landroid/net/Uri;)V
|
|
|
|
const/4 v2, 0x0
|
|
|
|
if-nez p2, :cond_2
|
|
|
|
invoke-virtual {p0, v1, v2}, Landroid/content/pm/PackageManager;->resolveActivity(Landroid/content/Intent;I)Landroid/content/pm/ResolveInfo;
|
|
|
|
move-result-object p2
|
|
|
|
if-eqz p2, :cond_2
|
|
|
|
iget-object p2, p2, Landroid/content/pm/ResolveInfo;->activityInfo:Landroid/content/pm/ActivityInfo;
|
|
|
|
iget-object p2, p2, Landroid/content/pm/ActivityInfo;->packageName:Ljava/lang/String;
|
|
|
|
new-instance v1, Ljava/util/ArrayList;
|
|
|
|
invoke-interface {v0}, Ljava/util/List;->size()I
|
|
|
|
move-result v0
|
|
|
|
add-int/lit8 v0, v0, 0x1
|
|
|
|
invoke-direct {v1, v0}, Ljava/util/ArrayList;-><init>(I)V
|
|
|
|
invoke-interface {v1, p2}, Ljava/util/List;->add(Ljava/lang/Object;)Z
|
|
|
|
if-eqz p1, :cond_1
|
|
|
|
invoke-interface {v1, p1}, Ljava/util/List;->addAll(Ljava/util/Collection;)Z
|
|
|
|
:cond_1
|
|
move-object v0, v1
|
|
|
|
:cond_2
|
|
new-instance p1, Landroid/content/Intent;
|
|
|
|
const-string p2, "android.support.customtabs.action.CustomTabsService"
|
|
|
|
invoke-direct {p1, p2}, Landroid/content/Intent;-><init>(Ljava/lang/String;)V
|
|
|
|
invoke-interface {v0}, Ljava/util/List;->iterator()Ljava/util/Iterator;
|
|
|
|
move-result-object p2
|
|
|
|
:cond_3
|
|
invoke-interface {p2}, Ljava/util/Iterator;->hasNext()Z
|
|
|
|
move-result v0
|
|
|
|
if-eqz v0, :cond_4
|
|
|
|
invoke-interface {p2}, Ljava/util/Iterator;->next()Ljava/lang/Object;
|
|
|
|
move-result-object v0
|
|
|
|
check-cast v0, Ljava/lang/String;
|
|
|
|
invoke-virtual {p1, v0}, Landroid/content/Intent;->setPackage(Ljava/lang/String;)Landroid/content/Intent;
|
|
|
|
invoke-virtual {p0, p1, v2}, Landroid/content/pm/PackageManager;->resolveService(Landroid/content/Intent;I)Landroid/content/pm/ResolveInfo;
|
|
|
|
move-result-object v1
|
|
|
|
if-eqz v1, :cond_3
|
|
|
|
return-object v0
|
|
|
|
:cond_4
|
|
const/4 p0, 0x0
|
|
|
|
return-object p0
|
|
.end method
|
|
|
|
|
|
# virtual methods
|
|
.method public extraCommand(Ljava/lang/String;Landroid/os/Bundle;)Landroid/os/Bundle;
|
|
.locals 1
|
|
|
|
:try_start_0
|
|
iget-object v0, p0, Landroidx/browser/customtabs/CustomTabsClient;->mService:Ls/a/a/b;
|
|
|
|
invoke-interface {v0, p1, p2}, Ls/a/a/b;->extraCommand(Ljava/lang/String;Landroid/os/Bundle;)Landroid/os/Bundle;
|
|
|
|
move-result-object p1
|
|
:try_end_0
|
|
.catch Landroid/os/RemoteException; {:try_start_0 .. :try_end_0} :catch_0
|
|
|
|
return-object p1
|
|
|
|
:catch_0
|
|
const/4 p1, 0x0
|
|
|
|
return-object p1
|
|
.end method
|
|
|
|
.method public newSession(Landroidx/browser/customtabs/CustomTabsCallback;)Landroidx/browser/customtabs/CustomTabsSession;
|
|
.locals 3
|
|
|
|
new-instance v0, Landroidx/browser/customtabs/CustomTabsClient$2;
|
|
|
|
invoke-direct {v0, p0, p1}, Landroidx/browser/customtabs/CustomTabsClient$2;-><init>(Landroidx/browser/customtabs/CustomTabsClient;Landroidx/browser/customtabs/CustomTabsCallback;)V
|
|
|
|
const/4 p1, 0x0
|
|
|
|
:try_start_0
|
|
iget-object v1, p0, Landroidx/browser/customtabs/CustomTabsClient;->mService:Ls/a/a/b;
|
|
|
|
invoke-interface {v1, v0}, Ls/a/a/b;->newSession(Ls/a/a/a;)Z
|
|
|
|
move-result v1
|
|
:try_end_0
|
|
.catch Landroid/os/RemoteException; {:try_start_0 .. :try_end_0} :catch_0
|
|
|
|
if-nez v1, :cond_0
|
|
|
|
return-object p1
|
|
|
|
:cond_0
|
|
new-instance p1, Landroidx/browser/customtabs/CustomTabsSession;
|
|
|
|
iget-object v1, p0, Landroidx/browser/customtabs/CustomTabsClient;->mService:Ls/a/a/b;
|
|
|
|
iget-object v2, p0, Landroidx/browser/customtabs/CustomTabsClient;->mServiceComponentName:Landroid/content/ComponentName;
|
|
|
|
invoke-direct {p1, v1, v0, v2}, Landroidx/browser/customtabs/CustomTabsSession;-><init>(Ls/a/a/b;Ls/a/a/a;Landroid/content/ComponentName;)V
|
|
|
|
:catch_0
|
|
return-object p1
|
|
.end method
|
|
|
|
.method public warmup(J)Z
|
|
.locals 1
|
|
|
|
:try_start_0
|
|
iget-object v0, p0, Landroidx/browser/customtabs/CustomTabsClient;->mService:Ls/a/a/b;
|
|
|
|
invoke-interface {v0, p1, p2}, Ls/a/a/b;->warmup(J)Z
|
|
|
|
move-result p1
|
|
:try_end_0
|
|
.catch Landroid/os/RemoteException; {:try_start_0 .. :try_end_0} :catch_0
|
|
|
|
return p1
|
|
|
|
:catch_0
|
|
const/4 p1, 0x0
|
|
|
|
return p1
|
|
.end method
|