apkfuckery/com.discord/smali/androidx/browser/trusted/TrustedWebActivityServiceConnectionPool.smali

506 lines
15 KiB
Smali
Raw Normal View History

2020-07-08 16:44:49 +00:00
.class public final Landroidx/browser/trusted/TrustedWebActivityServiceConnectionPool;
.super Ljava/lang/Object;
.source "TrustedWebActivityServiceConnectionPool.java"
# annotations
.annotation system Ldalvik/annotation/MemberClasses;
value = {
Landroidx/browser/trusted/TrustedWebActivityServiceConnectionPool$BindToServiceAsyncTask;
}
.end annotation
# static fields
.field public static final TAG:Ljava/lang/String; = "TWAConnectionPool"
# instance fields
.field public final mConnections:Ljava/util/Map;
.annotation system Ldalvik/annotation/Signature;
value = {
"Ljava/util/Map<",
"Landroid/net/Uri;",
"Landroidx/browser/trusted/ConnectionHolder;",
">;"
}
.end annotation
.end field
.field public final mContext:Landroid/content/Context;
# direct methods
.method public constructor <init>(Landroid/content/Context;)V
.locals 1
.param p1 # Landroid/content/Context;
.annotation build Landroidx/annotation/NonNull;
.end annotation
.end param
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
new-instance v0, Ljava/util/HashMap;
invoke-direct {v0}, Ljava/util/HashMap;-><init>()V
iput-object v0, p0, Landroidx/browser/trusted/TrustedWebActivityServiceConnectionPool;->mConnections:Ljava/util/Map;
invoke-virtual {p1}, Landroid/content/Context;->getApplicationContext()Landroid/content/Context;
move-result-object p1
iput-object p1, p0, Landroidx/browser/trusted/TrustedWebActivityServiceConnectionPool;->mContext:Landroid/content/Context;
return-void
.end method
.method public static create(Landroid/content/Context;)Landroidx/browser/trusted/TrustedWebActivityServiceConnectionPool;
.locals 1
.param p0 # Landroid/content/Context;
.annotation build Landroidx/annotation/NonNull;
.end annotation
.end param
.annotation build Landroidx/annotation/NonNull;
.end annotation
new-instance v0, Landroidx/browser/trusted/TrustedWebActivityServiceConnectionPool;
invoke-direct {v0, p0}, Landroidx/browser/trusted/TrustedWebActivityServiceConnectionPool;-><init>(Landroid/content/Context;)V
return-object v0
.end method
.method private createServiceIntent(Landroid/content/Context;Landroid/net/Uri;Ljava/util/Set;Z)Landroid/content/Intent;
.locals 7
.annotation build Landroidx/annotation/Nullable;
.end annotation
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Landroid/content/Context;",
"Landroid/net/Uri;",
"Ljava/util/Set<",
"Landroidx/browser/trusted/Token;",
">;Z)",
"Landroid/content/Intent;"
}
.end annotation
const/4 v0, 0x0
if-eqz p3, :cond_9
invoke-interface {p3}, Ljava/util/Set;->size()I
move-result v1
if-nez v1, :cond_0
goto/16 :goto_1
:cond_0
new-instance v1, Landroid/content/Intent;
invoke-direct {v1}, Landroid/content/Intent;-><init>()V
invoke-virtual {v1, p2}, Landroid/content/Intent;->setData(Landroid/net/Uri;)Landroid/content/Intent;
const-string v2, "android.intent.action.VIEW"
invoke-virtual {v1, v2}, Landroid/content/Intent;->setAction(Ljava/lang/String;)Landroid/content/Intent;
invoke-virtual {p1}, Landroid/content/Context;->getPackageManager()Landroid/content/pm/PackageManager;
move-result-object v2
const/high16 v3, 0x10000
invoke-virtual {v2, v1, v3}, Landroid/content/pm/PackageManager;->queryIntentActivities(Landroid/content/Intent;I)Ljava/util/List;
move-result-object v1
invoke-interface {v1}, Ljava/util/List;->iterator()Ljava/util/Iterator;
move-result-object v1
move-object v2, v0
:cond_1
:goto_0
invoke-interface {v1}, Ljava/util/Iterator;->hasNext()Z
move-result v3
if-eqz v3, :cond_3
invoke-interface {v1}, Ljava/util/Iterator;->next()Ljava/lang/Object;
move-result-object v3
check-cast v3, Landroid/content/pm/ResolveInfo;
iget-object v3, v3, Landroid/content/pm/ResolveInfo;->activityInfo:Landroid/content/pm/ActivityInfo;
iget-object v3, v3, Landroid/content/pm/ActivityInfo;->packageName:Ljava/lang/String;
invoke-interface {p3}, Ljava/util/Set;->iterator()Ljava/util/Iterator;
move-result-object v4
:cond_2
invoke-interface {v4}, Ljava/util/Iterator;->hasNext()Z
move-result v5
if-eqz v5, :cond_1
invoke-interface {v4}, Ljava/util/Iterator;->next()Ljava/lang/Object;
move-result-object v5
check-cast v5, Landroidx/browser/trusted/Token;
invoke-virtual {p1}, Landroid/content/Context;->getPackageManager()Landroid/content/pm/PackageManager;
move-result-object v6
invoke-virtual {v5, v3, v6}, Landroidx/browser/trusted/Token;->matches(Ljava/lang/String;Landroid/content/pm/PackageManager;)Z
move-result v5
if-eqz v5, :cond_2
move-object v2, v3
goto :goto_0
:cond_3
const-string p3, "TWAConnectionPool"
if-nez v2, :cond_5
if-eqz p4, :cond_4
new-instance p1, Ljava/lang/StringBuilder;
invoke-direct {p1}, Ljava/lang/StringBuilder;-><init>()V
const-string p4, "No TWA candidates for "
invoke-virtual {p1, p4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
invoke-virtual {p1, p2}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
const-string p2, " have been registered."
invoke-virtual {p1, p2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
invoke-virtual {p1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object p1
invoke-static {p3, p1}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;)I
:cond_4
return-object v0
:cond_5
new-instance v1, Landroid/content/Intent;
invoke-direct {v1}, Landroid/content/Intent;-><init>()V
invoke-virtual {v1, v2}, Landroid/content/Intent;->setPackage(Ljava/lang/String;)Landroid/content/Intent;
const-string v3, "android.support.customtabs.trusted.TRUSTED_WEB_ACTIVITY_SERVICE"
invoke-virtual {v1, v3}, Landroid/content/Intent;->setAction(Ljava/lang/String;)Landroid/content/Intent;
invoke-virtual {p1}, Landroid/content/Context;->getPackageManager()Landroid/content/pm/PackageManager;
move-result-object p1
const/high16 v3, 0x20000
invoke-virtual {p1, v1, v3}, Landroid/content/pm/PackageManager;->resolveService(Landroid/content/Intent;I)Landroid/content/pm/ResolveInfo;
move-result-object p1
if-nez p1, :cond_7
if-eqz p4, :cond_6
const-string p1, "Could not find TWAService for "
2020-09-28 19:40:16 +00:00
invoke-static {p1, v2, p3}, Lf/e/c/a/a;->U(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
2020-07-08 16:44:49 +00:00
:cond_6
return-object v0
:cond_7
if-eqz p4, :cond_8
const-string p4, "Found "
2020-09-28 19:40:16 +00:00
invoke-static {p4}, Lf/e/c/a/a;->E(Ljava/lang/String;)Ljava/lang/StringBuilder;
2020-07-08 16:44:49 +00:00
move-result-object p4
iget-object v0, p1, Landroid/content/pm/ResolveInfo;->serviceInfo:Landroid/content/pm/ServiceInfo;
iget-object v0, v0, Landroid/content/pm/ServiceInfo;->name:Ljava/lang/String;
invoke-virtual {p4, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
const-string v0, " to handle request for "
invoke-virtual {p4, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
invoke-virtual {p4, p2}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
invoke-virtual {p4}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object p2
invoke-static {p3, p2}, Landroid/util/Log;->i(Ljava/lang/String;Ljava/lang/String;)I
:cond_8
new-instance p2, Landroid/content/Intent;
invoke-direct {p2}, Landroid/content/Intent;-><init>()V
new-instance p3, Landroid/content/ComponentName;
iget-object p1, p1, Landroid/content/pm/ResolveInfo;->serviceInfo:Landroid/content/pm/ServiceInfo;
iget-object p1, p1, Landroid/content/pm/ServiceInfo;->name:Ljava/lang/String;
invoke-direct {p3, v2, p1}, Landroid/content/ComponentName;-><init>(Ljava/lang/String;Ljava/lang/String;)V
invoke-virtual {p2, p3}, Landroid/content/Intent;->setComponent(Landroid/content/ComponentName;)Landroid/content/Intent;
return-object p2
:cond_9
:goto_1
return-object v0
.end method
# virtual methods
.method public synthetic a(Landroid/net/Uri;)V
.locals 1
iget-object v0, p0, Landroidx/browser/trusted/TrustedWebActivityServiceConnectionPool;->mConnections:Ljava/util/Map;
invoke-interface {v0, p1}, Ljava/util/Map;->remove(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object p1
check-cast p1, Landroidx/browser/trusted/ConnectionHolder;
return-void
.end method
2020-07-23 01:06:17 +00:00
.method public connect(Landroid/net/Uri;Ljava/util/Set;Ljava/util/concurrent/Executor;)Lf/h/b/a/a/a;
2020-07-08 16:44:49 +00:00
.locals 2
.param p1 # Landroid/net/Uri;
.annotation build Landroidx/annotation/NonNull;
.end annotation
.end param
.param p2 # Ljava/util/Set;
.annotation build Landroidx/annotation/NonNull;
.end annotation
.end param
.param p3 # Ljava/util/concurrent/Executor;
.annotation build Landroidx/annotation/NonNull;
.end annotation
.end param
.annotation build Landroidx/annotation/MainThread;
.end annotation
.annotation build Landroidx/annotation/NonNull;
.end annotation
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Landroid/net/Uri;",
"Ljava/util/Set<",
"Landroidx/browser/trusted/Token;",
">;",
"Ljava/util/concurrent/Executor;",
")",
2020-07-23 01:06:17 +00:00
"Lf/h/b/a/a/a<",
2020-07-08 16:44:49 +00:00
"Landroidx/browser/trusted/TrustedWebActivityServiceConnection;",
">;"
}
.end annotation
iget-object v0, p0, Landroidx/browser/trusted/TrustedWebActivityServiceConnectionPool;->mConnections:Ljava/util/Map;
invoke-interface {v0, p1}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object v0
check-cast v0, Landroidx/browser/trusted/ConnectionHolder;
if-eqz v0, :cond_0
2020-07-23 01:06:17 +00:00
invoke-virtual {v0}, Landroidx/browser/trusted/ConnectionHolder;->getServiceWrapper()Lf/h/b/a/a/a;
2020-07-08 16:44:49 +00:00
move-result-object p1
return-object p1
:cond_0
iget-object v0, p0, Landroidx/browser/trusted/TrustedWebActivityServiceConnectionPool;->mContext:Landroid/content/Context;
const/4 v1, 0x1
invoke-direct {p0, v0, p1, p2, v1}, Landroidx/browser/trusted/TrustedWebActivityServiceConnectionPool;->createServiceIntent(Landroid/content/Context;Landroid/net/Uri;Ljava/util/Set;Z)Landroid/content/Intent;
move-result-object p2
if-nez p2, :cond_1
new-instance p1, Ljava/lang/IllegalArgumentException;
const-string p2, "No service exists for scope"
invoke-direct {p1, p2}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
2020-07-23 01:06:17 +00:00
invoke-static {p1}, Landroidx/browser/trusted/FutureUtils;->immediateFailedFuture(Ljava/lang/Throwable;)Lf/h/b/a/a/a;
2020-07-08 16:44:49 +00:00
move-result-object p1
return-object p1
:cond_1
new-instance v0, Landroidx/browser/trusted/ConnectionHolder;
2020-09-22 07:09:10 +00:00
new-instance v1, Lx/a/b/c;
2020-07-08 16:44:49 +00:00
2020-09-22 07:09:10 +00:00
invoke-direct {v1, p0, p1}, Lx/a/b/c;-><init>(Landroidx/browser/trusted/TrustedWebActivityServiceConnectionPool;Landroid/net/Uri;)V
2020-07-08 16:44:49 +00:00
invoke-direct {v0, v1}, Landroidx/browser/trusted/ConnectionHolder;-><init>(Ljava/lang/Runnable;)V
iget-object v1, p0, Landroidx/browser/trusted/TrustedWebActivityServiceConnectionPool;->mConnections:Ljava/util/Map;
invoke-interface {v1, p1, v0}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
new-instance p1, Landroidx/browser/trusted/TrustedWebActivityServiceConnectionPool$BindToServiceAsyncTask;
iget-object v1, p0, Landroidx/browser/trusted/TrustedWebActivityServiceConnectionPool;->mContext:Landroid/content/Context;
invoke-direct {p1, v1, p2, v0}, Landroidx/browser/trusted/TrustedWebActivityServiceConnectionPool$BindToServiceAsyncTask;-><init>(Landroid/content/Context;Landroid/content/Intent;Landroidx/browser/trusted/ConnectionHolder;)V
const/4 p2, 0x0
new-array p2, p2, [Ljava/lang/Void;
invoke-virtual {p1, p3, p2}, Landroid/os/AsyncTask;->executeOnExecutor(Ljava/util/concurrent/Executor;[Ljava/lang/Object;)Landroid/os/AsyncTask;
2020-07-23 01:06:17 +00:00
invoke-virtual {v0}, Landroidx/browser/trusted/ConnectionHolder;->getServiceWrapper()Lf/h/b/a/a/a;
2020-07-08 16:44:49 +00:00
move-result-object p1
return-object p1
.end method
.method public serviceExistsForScope(Landroid/net/Uri;Ljava/util/Set;)Z
.locals 3
.param p1 # Landroid/net/Uri;
.annotation build Landroidx/annotation/NonNull;
.end annotation
.end param
.param p2 # Ljava/util/Set;
.annotation build Landroidx/annotation/NonNull;
.end annotation
.end param
.annotation build Landroidx/annotation/MainThread;
.end annotation
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Landroid/net/Uri;",
"Ljava/util/Set<",
"Landroidx/browser/trusted/Token;",
">;)Z"
}
.end annotation
iget-object v0, p0, Landroidx/browser/trusted/TrustedWebActivityServiceConnectionPool;->mConnections:Ljava/util/Map;
invoke-interface {v0, p1}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object v0
const/4 v1, 0x1
if-eqz v0, :cond_0
return v1
:cond_0
iget-object v0, p0, Landroidx/browser/trusted/TrustedWebActivityServiceConnectionPool;->mContext:Landroid/content/Context;
const/4 v2, 0x0
invoke-direct {p0, v0, p1, p2, v2}, Landroidx/browser/trusted/TrustedWebActivityServiceConnectionPool;->createServiceIntent(Landroid/content/Context;Landroid/net/Uri;Ljava/util/Set;Z)Landroid/content/Intent;
move-result-object p1
if-eqz p1, :cond_1
goto :goto_0
:cond_1
const/4 v1, 0x0
:goto_0
return v1
.end method
.method public unbindAllConnections()V
.locals 3
iget-object v0, p0, Landroidx/browser/trusted/TrustedWebActivityServiceConnectionPool;->mConnections:Ljava/util/Map;
invoke-interface {v0}, Ljava/util/Map;->values()Ljava/util/Collection;
move-result-object v0
invoke-interface {v0}, Ljava/util/Collection;->iterator()Ljava/util/Iterator;
move-result-object v0
:goto_0
invoke-interface {v0}, Ljava/util/Iterator;->hasNext()Z
move-result v1
if-eqz v1, :cond_0
invoke-interface {v0}, Ljava/util/Iterator;->next()Ljava/lang/Object;
move-result-object v1
check-cast v1, Landroidx/browser/trusted/ConnectionHolder;
iget-object v2, p0, Landroidx/browser/trusted/TrustedWebActivityServiceConnectionPool;->mContext:Landroid/content/Context;
invoke-virtual {v2, v1}, Landroid/content/Context;->unbindService(Landroid/content/ServiceConnection;)V
goto :goto_0
:cond_0
iget-object v0, p0, Landroidx/browser/trusted/TrustedWebActivityServiceConnectionPool;->mConnections:Ljava/util/Map;
invoke-interface {v0}, Ljava/util/Map;->clear()V
return-void
.end method