apkfuckery/com.discord/smali/androidx/sharetarget/ShareTargetXmlParser.smali
2020-07-14 22:43:59 +00:00

593 lines
16 KiB
Smali

.class public Landroidx/sharetarget/ShareTargetXmlParser;
.super Ljava/lang/Object;
.source "ShareTargetXmlParser.java"
# annotations
.annotation build Landroidx/annotation/RestrictTo;
value = {
.enum Landroidx/annotation/RestrictTo$Scope;->LIBRARY_GROUP_PREFIX:Landroidx/annotation/RestrictTo$Scope;
}
.end annotation
# static fields
.field public static final ATTR_HOST:Ljava/lang/String; = "host"
.field public static final ATTR_MIME_TYPE:Ljava/lang/String; = "mimeType"
.field public static final ATTR_NAME:Ljava/lang/String; = "name"
.field public static final ATTR_PATH:Ljava/lang/String; = "path"
.field public static final ATTR_PATH_PATTERN:Ljava/lang/String; = "pathPattern"
.field public static final ATTR_PATH_PREFIX:Ljava/lang/String; = "pathPrefix"
.field public static final ATTR_PORT:Ljava/lang/String; = "port"
.field public static final ATTR_SCHEME:Ljava/lang/String; = "scheme"
.field public static final ATTR_TARGET_CLASS:Ljava/lang/String; = "targetClass"
.field public static final GET_INSTANCE_LOCK:Ljava/lang/Object;
.field public static final META_DATA_APP_SHORTCUTS:Ljava/lang/String; = "android.app.shortcuts"
.field public static final TAG:Ljava/lang/String; = "ShareTargetXmlParser"
.field public static final TAG_CATEGORY:Ljava/lang/String; = "category"
.field public static final TAG_DATA:Ljava/lang/String; = "data"
.field public static final TAG_SHARE_TARGET:Ljava/lang/String; = "share-target"
.field public static sShareTargets:Ljava/util/ArrayList;
.annotation system Ldalvik/annotation/Signature;
value = {
"Ljava/util/ArrayList<",
"Landroidx/sharetarget/ShareTargetCompat;",
">;"
}
.end annotation
.end field
# direct methods
.method public static constructor <clinit>()V
.locals 1
new-instance v0, Ljava/lang/Object;
invoke-direct {v0}, Ljava/lang/Object;-><init>()V
sput-object v0, Landroidx/sharetarget/ShareTargetXmlParser;->GET_INSTANCE_LOCK:Ljava/lang/Object;
return-void
.end method
.method public constructor <init>()V
.locals 0
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
return-void
.end method
.method public static getAttributeValue(Landroid/content/res/XmlResourceParser;Ljava/lang/String;)Ljava/lang/String;
.locals 1
const-string v0, "http://schemas.android.com/apk/res/android"
invoke-interface {p0, v0, p1}, Landroid/content/res/XmlResourceParser;->getAttributeValue(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
move-result-object v0
if-nez v0, :cond_0
const/4 v0, 0x0
invoke-interface {p0, v0, p1}, Landroid/content/res/XmlResourceParser;->getAttributeValue(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
move-result-object v0
:cond_0
return-object v0
.end method
.method public static getShareTargets(Landroid/content/Context;)Ljava/util/ArrayList;
.locals 2
.annotation build Landroidx/annotation/WorkerThread;
.end annotation
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Landroid/content/Context;",
")",
"Ljava/util/ArrayList<",
"Landroidx/sharetarget/ShareTargetCompat;",
">;"
}
.end annotation
sget-object v0, Landroidx/sharetarget/ShareTargetXmlParser;->sShareTargets:Ljava/util/ArrayList;
if-nez v0, :cond_1
sget-object v0, Landroidx/sharetarget/ShareTargetXmlParser;->GET_INSTANCE_LOCK:Ljava/lang/Object;
monitor-enter v0
:try_start_0
sget-object v1, Landroidx/sharetarget/ShareTargetXmlParser;->sShareTargets:Ljava/util/ArrayList;
if-nez v1, :cond_0
invoke-static {p0}, Landroidx/sharetarget/ShareTargetXmlParser;->parseShareTargets(Landroid/content/Context;)Ljava/util/ArrayList;
move-result-object p0
sput-object p0, Landroidx/sharetarget/ShareTargetXmlParser;->sShareTargets:Ljava/util/ArrayList;
:cond_0
monitor-exit v0
goto :goto_0
:catchall_0
move-exception p0
monitor-exit v0
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
throw p0
:cond_1
:goto_0
sget-object p0, Landroidx/sharetarget/ShareTargetXmlParser;->sShareTargets:Ljava/util/ArrayList;
return-object p0
.end method
.method public static getXmlResourceParser(Landroid/content/Context;Landroid/content/pm/ActivityInfo;)Landroid/content/res/XmlResourceParser;
.locals 1
invoke-virtual {p0}, Landroid/content/Context;->getPackageManager()Landroid/content/pm/PackageManager;
move-result-object p0
const-string v0, "android.app.shortcuts"
invoke-virtual {p1, p0, v0}, Landroid/content/pm/ActivityInfo;->loadXmlMetaData(Landroid/content/pm/PackageManager;Ljava/lang/String;)Landroid/content/res/XmlResourceParser;
move-result-object p0
if-eqz p0, :cond_0
return-object p0
:cond_0
new-instance p0, Ljava/lang/IllegalArgumentException;
const-string v0, "Failed to open android.app.shortcuts meta-data resource of "
invoke-static {v0}, Lf/e/b/a/a;->D(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v0
iget-object p1, p1, Landroid/content/pm/ActivityInfo;->name:Ljava/lang/String;
invoke-virtual {v0, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object p1
invoke-direct {p0, p1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
throw p0
.end method
.method public static parseShareTarget(Landroid/content/res/XmlResourceParser;)Landroidx/sharetarget/ShareTargetCompat;
.locals 8
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/lang/Exception;
}
.end annotation
const-string v0, "targetClass"
invoke-static {p0, v0}, Landroidx/sharetarget/ShareTargetXmlParser;->getAttributeValue(Landroid/content/res/XmlResourceParser;Ljava/lang/String;)Ljava/lang/String;
move-result-object v0
new-instance v1, Ljava/util/ArrayList;
invoke-direct {v1}, Ljava/util/ArrayList;-><init>()V
new-instance v2, Ljava/util/ArrayList;
invoke-direct {v2}, Ljava/util/ArrayList;-><init>()V
:cond_0
:goto_0
invoke-interface {p0}, Landroid/content/res/XmlResourceParser;->next()I
move-result v3
const/4 v4, 0x1
if-eq v3, v4, :cond_7
const/4 v5, 0x2
if-ne v3, v5, :cond_6
invoke-interface {p0}, Landroid/content/res/XmlResourceParser;->getName()Ljava/lang/String;
move-result-object v3
const/4 v5, -0x1
invoke-virtual {v3}, Ljava/lang/String;->hashCode()I
move-result v6
const v7, 0x2eefaa
if-eq v6, v7, :cond_2
const v7, 0x302bcfe
if-eq v6, v7, :cond_1
goto :goto_1
:cond_1
const-string v6, "category"
invoke-virtual {v3, v6}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v3
if-eqz v3, :cond_3
const/4 v5, 0x1
goto :goto_1
:cond_2
const-string v6, "data"
invoke-virtual {v3, v6}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v3
if-eqz v3, :cond_3
const/4 v5, 0x0
:cond_3
:goto_1
if-eqz v5, :cond_5
if-eq v5, v4, :cond_4
goto :goto_0
:cond_4
const-string v3, "name"
invoke-static {p0, v3}, Landroidx/sharetarget/ShareTargetXmlParser;->getAttributeValue(Landroid/content/res/XmlResourceParser;Ljava/lang/String;)Ljava/lang/String;
move-result-object v3
invoke-virtual {v2, v3}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z
goto :goto_0
:cond_5
invoke-static {p0}, Landroidx/sharetarget/ShareTargetXmlParser;->parseTargetData(Landroid/content/res/XmlResourceParser;)Landroidx/sharetarget/ShareTargetCompat$TargetData;
move-result-object v3
invoke-virtual {v1, v3}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z
goto :goto_0
:cond_6
const/4 v4, 0x3
if-ne v3, v4, :cond_0
invoke-interface {p0}, Landroid/content/res/XmlResourceParser;->getName()Ljava/lang/String;
move-result-object v3
const-string v4, "share-target"
invoke-virtual {v3, v4}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v3
if-eqz v3, :cond_0
:cond_7
invoke-virtual {v1}, Ljava/util/ArrayList;->isEmpty()Z
move-result p0
if-nez p0, :cond_9
if-eqz v0, :cond_9
invoke-virtual {v2}, Ljava/util/ArrayList;->isEmpty()Z
move-result p0
if-eqz p0, :cond_8
goto :goto_2
:cond_8
new-instance p0, Landroidx/sharetarget/ShareTargetCompat;
invoke-virtual {v1}, Ljava/util/ArrayList;->size()I
move-result v3
new-array v3, v3, [Landroidx/sharetarget/ShareTargetCompat$TargetData;
invoke-virtual {v1, v3}, Ljava/util/ArrayList;->toArray([Ljava/lang/Object;)[Ljava/lang/Object;
move-result-object v1
check-cast v1, [Landroidx/sharetarget/ShareTargetCompat$TargetData;
invoke-virtual {v2}, Ljava/util/ArrayList;->size()I
move-result v3
new-array v3, v3, [Ljava/lang/String;
invoke-virtual {v2, v3}, Ljava/util/ArrayList;->toArray([Ljava/lang/Object;)[Ljava/lang/Object;
move-result-object v2
check-cast v2, [Ljava/lang/String;
invoke-direct {p0, v1, v0, v2}, Landroidx/sharetarget/ShareTargetCompat;-><init>([Landroidx/sharetarget/ShareTargetCompat$TargetData;Ljava/lang/String;[Ljava/lang/String;)V
return-object p0
:cond_9
:goto_2
const/4 p0, 0x0
return-object p0
.end method
.method public static parseShareTargets(Landroid/content/Context;)Ljava/util/ArrayList;
.locals 5
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Landroid/content/Context;",
")",
"Ljava/util/ArrayList<",
"Landroidx/sharetarget/ShareTargetCompat;",
">;"
}
.end annotation
new-instance v0, Ljava/util/ArrayList;
invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V
new-instance v1, Landroid/content/Intent;
const-string v2, "android.intent.action.MAIN"
invoke-direct {v1, v2}, Landroid/content/Intent;-><init>(Ljava/lang/String;)V
const-string v2, "android.intent.category.LAUNCHER"
invoke-virtual {v1, v2}, Landroid/content/Intent;->addCategory(Ljava/lang/String;)Landroid/content/Intent;
invoke-virtual {p0}, Landroid/content/Context;->getPackageName()Ljava/lang/String;
move-result-object v2
invoke-virtual {v1, v2}, Landroid/content/Intent;->setPackage(Ljava/lang/String;)Landroid/content/Intent;
invoke-virtual {p0}, Landroid/content/Context;->getPackageManager()Landroid/content/pm/PackageManager;
move-result-object v2
const/16 v3, 0x80
invoke-virtual {v2, v1, v3}, Landroid/content/pm/PackageManager;->queryIntentActivities(Landroid/content/Intent;I)Ljava/util/List;
move-result-object v1
if-nez v1, :cond_0
return-object v0
:cond_0
invoke-interface {v1}, Ljava/util/List;->iterator()Ljava/util/Iterator;
move-result-object v1
:cond_1
:goto_0
invoke-interface {v1}, Ljava/util/Iterator;->hasNext()Z
move-result v2
if-eqz v2, :cond_2
invoke-interface {v1}, Ljava/util/Iterator;->next()Ljava/lang/Object;
move-result-object v2
check-cast v2, Landroid/content/pm/ResolveInfo;
iget-object v2, v2, Landroid/content/pm/ResolveInfo;->activityInfo:Landroid/content/pm/ActivityInfo;
iget-object v3, v2, Landroid/content/pm/ActivityInfo;->metaData:Landroid/os/Bundle;
if-eqz v3, :cond_1
const-string v4, "android.app.shortcuts"
invoke-virtual {v3, v4}, Landroid/os/Bundle;->containsKey(Ljava/lang/String;)Z
move-result v3
if-eqz v3, :cond_1
invoke-static {p0, v2}, Landroidx/sharetarget/ShareTargetXmlParser;->parseShareTargets(Landroid/content/Context;Landroid/content/pm/ActivityInfo;)Ljava/util/ArrayList;
move-result-object v2
invoke-virtual {v0, v2}, Ljava/util/ArrayList;->addAll(Ljava/util/Collection;)Z
goto :goto_0
:cond_2
return-object v0
.end method
.method public static parseShareTargets(Landroid/content/Context;Landroid/content/pm/ActivityInfo;)Ljava/util/ArrayList;
.locals 3
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Landroid/content/Context;",
"Landroid/content/pm/ActivityInfo;",
")",
"Ljava/util/ArrayList<",
"Landroidx/sharetarget/ShareTargetCompat;",
">;"
}
.end annotation
new-instance v0, Ljava/util/ArrayList;
invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V
invoke-static {p0, p1}, Landroidx/sharetarget/ShareTargetXmlParser;->getXmlResourceParser(Landroid/content/Context;Landroid/content/pm/ActivityInfo;)Landroid/content/res/XmlResourceParser;
move-result-object p0
:cond_0
:goto_0
:try_start_0
invoke-interface {p0}, Landroid/content/res/XmlResourceParser;->next()I
move-result p1
const/4 v1, 0x1
if-eq p1, v1, :cond_1
const/4 v1, 0x2
if-ne p1, v1, :cond_0
invoke-interface {p0}, Landroid/content/res/XmlResourceParser;->getName()Ljava/lang/String;
move-result-object p1
const-string v1, "share-target"
invoke-virtual {p1, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result p1
if-eqz p1, :cond_0
invoke-static {p0}, Landroidx/sharetarget/ShareTargetXmlParser;->parseShareTarget(Landroid/content/res/XmlResourceParser;)Landroidx/sharetarget/ShareTargetCompat;
move-result-object p1
if-eqz p1, :cond_0
invoke-virtual {v0, p1}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z
:try_end_0
.catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0
goto :goto_0
:catch_0
move-exception p1
const-string v1, "ShareTargetXmlParser"
const-string v2, "Failed to parse the Xml resource: "
invoke-static {v1, v2, p1}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
:cond_1
invoke-interface {p0}, Landroid/content/res/XmlResourceParser;->close()V
return-object v0
.end method
.method public static parseTargetData(Landroid/content/res/XmlResourceParser;)Landroidx/sharetarget/ShareTargetCompat$TargetData;
.locals 9
const-string v0, "scheme"
invoke-static {p0, v0}, Landroidx/sharetarget/ShareTargetXmlParser;->getAttributeValue(Landroid/content/res/XmlResourceParser;Ljava/lang/String;)Ljava/lang/String;
move-result-object v2
const-string v0, "host"
invoke-static {p0, v0}, Landroidx/sharetarget/ShareTargetXmlParser;->getAttributeValue(Landroid/content/res/XmlResourceParser;Ljava/lang/String;)Ljava/lang/String;
move-result-object v3
const-string v0, "port"
invoke-static {p0, v0}, Landroidx/sharetarget/ShareTargetXmlParser;->getAttributeValue(Landroid/content/res/XmlResourceParser;Ljava/lang/String;)Ljava/lang/String;
move-result-object v4
const-string v0, "path"
invoke-static {p0, v0}, Landroidx/sharetarget/ShareTargetXmlParser;->getAttributeValue(Landroid/content/res/XmlResourceParser;Ljava/lang/String;)Ljava/lang/String;
move-result-object v5
const-string v0, "pathPattern"
invoke-static {p0, v0}, Landroidx/sharetarget/ShareTargetXmlParser;->getAttributeValue(Landroid/content/res/XmlResourceParser;Ljava/lang/String;)Ljava/lang/String;
move-result-object v6
const-string v0, "pathPrefix"
invoke-static {p0, v0}, Landroidx/sharetarget/ShareTargetXmlParser;->getAttributeValue(Landroid/content/res/XmlResourceParser;Ljava/lang/String;)Ljava/lang/String;
move-result-object v7
const-string v0, "mimeType"
invoke-static {p0, v0}, Landroidx/sharetarget/ShareTargetXmlParser;->getAttributeValue(Landroid/content/res/XmlResourceParser;Ljava/lang/String;)Ljava/lang/String;
move-result-object v8
new-instance p0, Landroidx/sharetarget/ShareTargetCompat$TargetData;
move-object v1, p0
invoke-direct/range {v1 .. v8}, Landroidx/sharetarget/ShareTargetCompat$TargetData;-><init>(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
return-object p0
.end method