1042 lines
31 KiB
Smali
1042 lines
31 KiB
Smali
.class public Landroidx/sharetarget/ShortcutsInfoSerialization;
|
|
.super Ljava/lang/Object;
|
|
.source "ShortcutsInfoSerialization.java"
|
|
|
|
|
|
# annotations
|
|
.annotation system Ldalvik/annotation/MemberClasses;
|
|
value = {
|
|
Landroidx/sharetarget/ShortcutsInfoSerialization$ShortcutContainer;
|
|
}
|
|
.end annotation
|
|
|
|
|
|
# static fields
|
|
.field public static final ATTR_ACTION:Ljava/lang/String; = "action"
|
|
|
|
.field public static final ATTR_COMPONENT:Ljava/lang/String; = "component"
|
|
|
|
.field public static final ATTR_DISABLED_MSG:Ljava/lang/String; = "disabled_message"
|
|
|
|
.field public static final ATTR_ICON_BMP_PATH:Ljava/lang/String; = "icon_bitmap_path"
|
|
|
|
.field public static final ATTR_ICON_RES_NAME:Ljava/lang/String; = "icon_resource_name"
|
|
|
|
.field public static final ATTR_ID:Ljava/lang/String; = "id"
|
|
|
|
.field public static final ATTR_LONG_LABEL:Ljava/lang/String; = "long_label"
|
|
|
|
.field public static final ATTR_NAME:Ljava/lang/String; = "name"
|
|
|
|
.field public static final ATTR_RANK:Ljava/lang/String; = "rank"
|
|
|
|
.field public static final ATTR_SHORT_LABEL:Ljava/lang/String; = "short_label"
|
|
|
|
.field public static final ATTR_TARGET_CLASS:Ljava/lang/String; = "targetClass"
|
|
|
|
.field public static final ATTR_TARGET_PACKAGE:Ljava/lang/String; = "targetPackage"
|
|
|
|
.field public static final TAG:Ljava/lang/String; = "ShortcutInfoCompatSaver"
|
|
|
|
.field public static final TAG_CATEGORY:Ljava/lang/String; = "categories"
|
|
|
|
.field public static final TAG_INTENT:Ljava/lang/String; = "intent"
|
|
|
|
.field public static final TAG_ROOT:Ljava/lang/String; = "share_targets"
|
|
|
|
.field public static final TAG_TARGET:Ljava/lang/String; = "target"
|
|
|
|
|
|
# direct methods
|
|
.method public constructor <init>()V
|
|
.locals 0
|
|
|
|
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public static getAttributeValue(Lorg/xmlpull/v1/XmlPullParser;Ljava/lang/String;)Ljava/lang/String;
|
|
.locals 1
|
|
.annotation build Landroidx/annotation/WorkerThread;
|
|
.end annotation
|
|
|
|
const-string v0, "http://schemas.android.com/apk/res/android"
|
|
|
|
invoke-interface {p0, v0, p1}, Lorg/xmlpull/v1/XmlPullParser;->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}, Lorg/xmlpull/v1/XmlPullParser;->getAttributeValue(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
|
|
|
|
move-result-object v0
|
|
|
|
:cond_0
|
|
return-object v0
|
|
.end method
|
|
|
|
.method public static loadFromXml(Ljava/io/File;Landroid/content/Context;)Ljava/util/Map;
|
|
.locals 4
|
|
.annotation build Landroidx/annotation/WorkerThread;
|
|
.end annotation
|
|
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"(",
|
|
"Ljava/io/File;",
|
|
"Landroid/content/Context;",
|
|
")",
|
|
"Ljava/util/Map<",
|
|
"Ljava/lang/String;",
|
|
"Landroidx/sharetarget/ShortcutsInfoSerialization$ShortcutContainer;",
|
|
">;"
|
|
}
|
|
.end annotation
|
|
|
|
new-instance v0, Landroidx/collection/ArrayMap;
|
|
|
|
invoke-direct {v0}, Landroidx/collection/ArrayMap;-><init>()V
|
|
|
|
:try_start_0
|
|
invoke-virtual {p0}, Ljava/io/File;->exists()Z
|
|
|
|
move-result v1
|
|
|
|
if-nez v1, :cond_0
|
|
|
|
return-object v0
|
|
|
|
:cond_0
|
|
new-instance v1, Ljava/io/FileInputStream;
|
|
|
|
invoke-direct {v1, p0}, Ljava/io/FileInputStream;-><init>(Ljava/io/File;)V
|
|
|
|
invoke-static {}, Landroid/util/Xml;->newPullParser()Lorg/xmlpull/v1/XmlPullParser;
|
|
|
|
move-result-object v2
|
|
|
|
const-string v3, "UTF_8"
|
|
|
|
invoke-interface {v2, v1, v3}, Lorg/xmlpull/v1/XmlPullParser;->setInput(Ljava/io/InputStream;Ljava/lang/String;)V
|
|
|
|
:cond_1
|
|
:goto_0
|
|
invoke-interface {v2}, Lorg/xmlpull/v1/XmlPullParser;->next()I
|
|
|
|
move-result v1
|
|
|
|
const/4 v3, 0x1
|
|
|
|
if-eq v1, v3, :cond_2
|
|
|
|
const/4 v3, 0x2
|
|
|
|
if-ne v1, v3, :cond_1
|
|
|
|
invoke-interface {v2}, Lorg/xmlpull/v1/XmlPullParser;->getName()Ljava/lang/String;
|
|
|
|
move-result-object v1
|
|
|
|
const-string v3, "target"
|
|
|
|
invoke-virtual {v1, v3}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
|
|
|
|
move-result v1
|
|
|
|
if-eqz v1, :cond_1
|
|
|
|
invoke-static {v2, p1}, Landroidx/sharetarget/ShortcutsInfoSerialization;->parseShortcutContainer(Lorg/xmlpull/v1/XmlPullParser;Landroid/content/Context;)Landroidx/sharetarget/ShortcutsInfoSerialization$ShortcutContainer;
|
|
|
|
move-result-object v1
|
|
|
|
if-eqz v1, :cond_1
|
|
|
|
iget-object v3, v1, Landroidx/sharetarget/ShortcutsInfoSerialization$ShortcutContainer;->mShortcutInfo:Landroidx/core/content/pm/ShortcutInfoCompat;
|
|
|
|
if-eqz v3, :cond_1
|
|
|
|
iget-object v3, v1, Landroidx/sharetarget/ShortcutsInfoSerialization$ShortcutContainer;->mShortcutInfo:Landroidx/core/content/pm/ShortcutInfoCompat;
|
|
|
|
invoke-virtual {v3}, Landroidx/core/content/pm/ShortcutInfoCompat;->getId()Ljava/lang/String;
|
|
|
|
move-result-object v3
|
|
|
|
invoke-virtual {v0, v3, v1}, Landroidx/collection/SimpleArrayMap;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
|
|
:try_end_0
|
|
.catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0
|
|
|
|
goto :goto_0
|
|
|
|
:catch_0
|
|
move-exception p1
|
|
|
|
invoke-virtual {p0}, Ljava/io/File;->delete()Z
|
|
|
|
new-instance v1, Ljava/lang/StringBuilder;
|
|
|
|
invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V
|
|
|
|
const-string v2, "Failed to load saved values from file "
|
|
|
|
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {p0}, Ljava/io/File;->getAbsolutePath()Ljava/lang/String;
|
|
|
|
move-result-object p0
|
|
|
|
invoke-virtual {v1, p0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
const-string p0, ". Old state removed, new added"
|
|
|
|
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
|
|
|
|
const-string v1, "ShortcutInfoCompatSaver"
|
|
|
|
invoke-static {v1, p0, p1}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
|
|
|
|
:cond_2
|
|
return-object v0
|
|
.end method
|
|
|
|
.method public static parseComponentName(Lorg/xmlpull/v1/XmlPullParser;)Landroid/content/ComponentName;
|
|
.locals 1
|
|
.annotation build Landroidx/annotation/WorkerThread;
|
|
.end annotation
|
|
|
|
const-string v0, "component"
|
|
|
|
invoke-static {p0, v0}, Landroidx/sharetarget/ShortcutsInfoSerialization;->getAttributeValue(Lorg/xmlpull/v1/XmlPullParser;Ljava/lang/String;)Ljava/lang/String;
|
|
|
|
move-result-object p0
|
|
|
|
invoke-static {p0}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z
|
|
|
|
move-result v0
|
|
|
|
if-eqz v0, :cond_0
|
|
|
|
const/4 p0, 0x0
|
|
|
|
goto :goto_0
|
|
|
|
:cond_0
|
|
invoke-static {p0}, Landroid/content/ComponentName;->unflattenFromString(Ljava/lang/String;)Landroid/content/ComponentName;
|
|
|
|
move-result-object p0
|
|
|
|
:goto_0
|
|
return-object p0
|
|
.end method
|
|
|
|
.method public static parseIntent(Lorg/xmlpull/v1/XmlPullParser;)Landroid/content/Intent;
|
|
.locals 3
|
|
.annotation build Landroidx/annotation/WorkerThread;
|
|
.end annotation
|
|
|
|
const-string v0, "action"
|
|
|
|
invoke-static {p0, v0}, Landroidx/sharetarget/ShortcutsInfoSerialization;->getAttributeValue(Lorg/xmlpull/v1/XmlPullParser;Ljava/lang/String;)Ljava/lang/String;
|
|
|
|
move-result-object v0
|
|
|
|
const-string v1, "targetPackage"
|
|
|
|
invoke-static {p0, v1}, Landroidx/sharetarget/ShortcutsInfoSerialization;->getAttributeValue(Lorg/xmlpull/v1/XmlPullParser;Ljava/lang/String;)Ljava/lang/String;
|
|
|
|
move-result-object v1
|
|
|
|
const-string v2, "targetClass"
|
|
|
|
invoke-static {p0, v2}, Landroidx/sharetarget/ShortcutsInfoSerialization;->getAttributeValue(Lorg/xmlpull/v1/XmlPullParser;Ljava/lang/String;)Ljava/lang/String;
|
|
|
|
move-result-object p0
|
|
|
|
if-nez v0, :cond_0
|
|
|
|
const/4 p0, 0x0
|
|
|
|
return-object p0
|
|
|
|
:cond_0
|
|
new-instance v2, Landroid/content/Intent;
|
|
|
|
invoke-direct {v2, v0}, Landroid/content/Intent;-><init>(Ljava/lang/String;)V
|
|
|
|
invoke-static {v1}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z
|
|
|
|
move-result v0
|
|
|
|
if-nez v0, :cond_1
|
|
|
|
invoke-static {p0}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z
|
|
|
|
move-result v0
|
|
|
|
if-nez v0, :cond_1
|
|
|
|
invoke-virtual {v2, v1, p0}, Landroid/content/Intent;->setClassName(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;
|
|
|
|
:cond_1
|
|
return-object v2
|
|
.end method
|
|
|
|
.method public static parseShortcutContainer(Lorg/xmlpull/v1/XmlPullParser;Landroid/content/Context;)Landroidx/sharetarget/ShortcutsInfoSerialization$ShortcutContainer;
|
|
.locals 16
|
|
.annotation build Landroidx/annotation/WorkerThread;
|
|
.end annotation
|
|
|
|
.annotation system Ldalvik/annotation/Throws;
|
|
value = {
|
|
Ljava/lang/Exception;
|
|
}
|
|
.end annotation
|
|
|
|
move-object/from16 v0, p0
|
|
|
|
invoke-interface/range {p0 .. p0}, Lorg/xmlpull/v1/XmlPullParser;->getName()Ljava/lang/String;
|
|
|
|
move-result-object v1
|
|
|
|
const-string v2, "target"
|
|
|
|
invoke-virtual {v1, v2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
|
|
|
|
move-result v1
|
|
|
|
const/4 v3, 0x0
|
|
|
|
if-nez v1, :cond_0
|
|
|
|
return-object v3
|
|
|
|
:cond_0
|
|
const-string v1, "id"
|
|
|
|
invoke-static {v0, v1}, Landroidx/sharetarget/ShortcutsInfoSerialization;->getAttributeValue(Lorg/xmlpull/v1/XmlPullParser;Ljava/lang/String;)Ljava/lang/String;
|
|
|
|
move-result-object v1
|
|
|
|
const-string v4, "short_label"
|
|
|
|
invoke-static {v0, v4}, Landroidx/sharetarget/ShortcutsInfoSerialization;->getAttributeValue(Lorg/xmlpull/v1/XmlPullParser;Ljava/lang/String;)Ljava/lang/String;
|
|
|
|
move-result-object v4
|
|
|
|
invoke-static {v1}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z
|
|
|
|
move-result v5
|
|
|
|
if-nez v5, :cond_f
|
|
|
|
invoke-static {v4}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z
|
|
|
|
move-result v5
|
|
|
|
if-eqz v5, :cond_1
|
|
|
|
goto/16 :goto_3
|
|
|
|
:cond_1
|
|
const-string v3, "rank"
|
|
|
|
invoke-static {v0, v3}, Landroidx/sharetarget/ShortcutsInfoSerialization;->getAttributeValue(Lorg/xmlpull/v1/XmlPullParser;Ljava/lang/String;)Ljava/lang/String;
|
|
|
|
move-result-object v3
|
|
|
|
invoke-static {v3}, Ljava/lang/Integer;->parseInt(Ljava/lang/String;)I
|
|
|
|
move-result v3
|
|
|
|
const-string v5, "long_label"
|
|
|
|
invoke-static {v0, v5}, Landroidx/sharetarget/ShortcutsInfoSerialization;->getAttributeValue(Lorg/xmlpull/v1/XmlPullParser;Ljava/lang/String;)Ljava/lang/String;
|
|
|
|
move-result-object v5
|
|
|
|
const-string v6, "disabled_message"
|
|
|
|
invoke-static {v0, v6}, Landroidx/sharetarget/ShortcutsInfoSerialization;->getAttributeValue(Lorg/xmlpull/v1/XmlPullParser;Ljava/lang/String;)Ljava/lang/String;
|
|
|
|
move-result-object v6
|
|
|
|
invoke-static/range {p0 .. p0}, Landroidx/sharetarget/ShortcutsInfoSerialization;->parseComponentName(Lorg/xmlpull/v1/XmlPullParser;)Landroid/content/ComponentName;
|
|
|
|
move-result-object v7
|
|
|
|
const-string v8, "icon_resource_name"
|
|
|
|
invoke-static {v0, v8}, Landroidx/sharetarget/ShortcutsInfoSerialization;->getAttributeValue(Lorg/xmlpull/v1/XmlPullParser;Ljava/lang/String;)Ljava/lang/String;
|
|
|
|
move-result-object v8
|
|
|
|
const-string v9, "icon_bitmap_path"
|
|
|
|
invoke-static {v0, v9}, Landroidx/sharetarget/ShortcutsInfoSerialization;->getAttributeValue(Lorg/xmlpull/v1/XmlPullParser;Ljava/lang/String;)Ljava/lang/String;
|
|
|
|
move-result-object v9
|
|
|
|
new-instance v10, Ljava/util/ArrayList;
|
|
|
|
invoke-direct {v10}, Ljava/util/ArrayList;-><init>()V
|
|
|
|
new-instance v11, Ljava/util/HashSet;
|
|
|
|
invoke-direct {v11}, Ljava/util/HashSet;-><init>()V
|
|
|
|
:cond_2
|
|
:goto_0
|
|
invoke-interface/range {p0 .. p0}, Lorg/xmlpull/v1/XmlPullParser;->next()I
|
|
|
|
move-result v12
|
|
|
|
const/4 v14, 0x1
|
|
|
|
if-eq v12, v14, :cond_9
|
|
|
|
const/4 v15, 0x2
|
|
|
|
if-ne v12, v15, :cond_8
|
|
|
|
invoke-interface/range {p0 .. p0}, Lorg/xmlpull/v1/XmlPullParser;->getName()Ljava/lang/String;
|
|
|
|
move-result-object v12
|
|
|
|
invoke-virtual {v12}, Ljava/lang/String;->hashCode()I
|
|
|
|
move-result v15
|
|
|
|
const v13, -0x468ec964
|
|
|
|
if-eq v15, v13, :cond_4
|
|
|
|
const v13, 0x4d47461c # 2.08953792E8f
|
|
|
|
if-eq v15, v13, :cond_3
|
|
|
|
goto :goto_1
|
|
|
|
:cond_3
|
|
const-string v13, "categories"
|
|
|
|
invoke-virtual {v12, v13}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
|
|
|
|
move-result v12
|
|
|
|
if-eqz v12, :cond_5
|
|
|
|
const/4 v13, 0x1
|
|
|
|
goto :goto_2
|
|
|
|
:cond_4
|
|
const-string v13, "intent"
|
|
|
|
invoke-virtual {v12, v13}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
|
|
|
|
move-result v12
|
|
|
|
if-eqz v12, :cond_5
|
|
|
|
const/4 v13, 0x0
|
|
|
|
goto :goto_2
|
|
|
|
:cond_5
|
|
:goto_1
|
|
const/4 v13, -0x1
|
|
|
|
:goto_2
|
|
if-eqz v13, :cond_7
|
|
|
|
if-eq v13, v14, :cond_6
|
|
|
|
goto :goto_0
|
|
|
|
:cond_6
|
|
const-string v12, "name"
|
|
|
|
invoke-static {v0, v12}, Landroidx/sharetarget/ShortcutsInfoSerialization;->getAttributeValue(Lorg/xmlpull/v1/XmlPullParser;Ljava/lang/String;)Ljava/lang/String;
|
|
|
|
move-result-object v12
|
|
|
|
invoke-static {v12}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z
|
|
|
|
move-result v13
|
|
|
|
if-nez v13, :cond_2
|
|
|
|
invoke-virtual {v11, v12}, Ljava/util/HashSet;->add(Ljava/lang/Object;)Z
|
|
|
|
goto :goto_0
|
|
|
|
:cond_7
|
|
invoke-static/range {p0 .. p0}, Landroidx/sharetarget/ShortcutsInfoSerialization;->parseIntent(Lorg/xmlpull/v1/XmlPullParser;)Landroid/content/Intent;
|
|
|
|
move-result-object v12
|
|
|
|
if-eqz v12, :cond_2
|
|
|
|
invoke-virtual {v10, v12}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z
|
|
|
|
goto :goto_0
|
|
|
|
:cond_8
|
|
const/4 v13, 0x3
|
|
|
|
if-ne v12, v13, :cond_2
|
|
|
|
invoke-interface/range {p0 .. p0}, Lorg/xmlpull/v1/XmlPullParser;->getName()Ljava/lang/String;
|
|
|
|
move-result-object v12
|
|
|
|
invoke-virtual {v12, v2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
|
|
|
|
move-result v12
|
|
|
|
if-eqz v12, :cond_2
|
|
|
|
:cond_9
|
|
new-instance v0, Landroidx/core/content/pm/ShortcutInfoCompat$Builder;
|
|
|
|
move-object/from16 v2, p1
|
|
|
|
invoke-direct {v0, v2, v1}, Landroidx/core/content/pm/ShortcutInfoCompat$Builder;-><init>(Landroid/content/Context;Ljava/lang/String;)V
|
|
|
|
invoke-virtual {v0, v4}, Landroidx/core/content/pm/ShortcutInfoCompat$Builder;->setShortLabel(Ljava/lang/CharSequence;)Landroidx/core/content/pm/ShortcutInfoCompat$Builder;
|
|
|
|
move-result-object v0
|
|
|
|
invoke-virtual {v0, v3}, Landroidx/core/content/pm/ShortcutInfoCompat$Builder;->setRank(I)Landroidx/core/content/pm/ShortcutInfoCompat$Builder;
|
|
|
|
move-result-object v0
|
|
|
|
invoke-static {v5}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z
|
|
|
|
move-result v1
|
|
|
|
if-nez v1, :cond_a
|
|
|
|
invoke-virtual {v0, v5}, Landroidx/core/content/pm/ShortcutInfoCompat$Builder;->setLongLabel(Ljava/lang/CharSequence;)Landroidx/core/content/pm/ShortcutInfoCompat$Builder;
|
|
|
|
:cond_a
|
|
invoke-static {v6}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z
|
|
|
|
move-result v1
|
|
|
|
if-nez v1, :cond_b
|
|
|
|
invoke-virtual {v0, v6}, Landroidx/core/content/pm/ShortcutInfoCompat$Builder;->setDisabledMessage(Ljava/lang/CharSequence;)Landroidx/core/content/pm/ShortcutInfoCompat$Builder;
|
|
|
|
:cond_b
|
|
if-eqz v7, :cond_c
|
|
|
|
invoke-virtual {v0, v7}, Landroidx/core/content/pm/ShortcutInfoCompat$Builder;->setActivity(Landroid/content/ComponentName;)Landroidx/core/content/pm/ShortcutInfoCompat$Builder;
|
|
|
|
:cond_c
|
|
invoke-virtual {v10}, Ljava/util/ArrayList;->isEmpty()Z
|
|
|
|
move-result v1
|
|
|
|
if-nez v1, :cond_d
|
|
|
|
const/4 v1, 0x0
|
|
|
|
new-array v1, v1, [Landroid/content/Intent;
|
|
|
|
invoke-virtual {v10, v1}, Ljava/util/ArrayList;->toArray([Ljava/lang/Object;)[Ljava/lang/Object;
|
|
|
|
move-result-object v1
|
|
|
|
check-cast v1, [Landroid/content/Intent;
|
|
|
|
invoke-virtual {v0, v1}, Landroidx/core/content/pm/ShortcutInfoCompat$Builder;->setIntents([Landroid/content/Intent;)Landroidx/core/content/pm/ShortcutInfoCompat$Builder;
|
|
|
|
:cond_d
|
|
invoke-virtual {v11}, Ljava/util/HashSet;->isEmpty()Z
|
|
|
|
move-result v1
|
|
|
|
if-nez v1, :cond_e
|
|
|
|
invoke-virtual {v0, v11}, Landroidx/core/content/pm/ShortcutInfoCompat$Builder;->setCategories(Ljava/util/Set;)Landroidx/core/content/pm/ShortcutInfoCompat$Builder;
|
|
|
|
:cond_e
|
|
new-instance v1, Landroidx/sharetarget/ShortcutsInfoSerialization$ShortcutContainer;
|
|
|
|
invoke-virtual {v0}, Landroidx/core/content/pm/ShortcutInfoCompat$Builder;->build()Landroidx/core/content/pm/ShortcutInfoCompat;
|
|
|
|
move-result-object v0
|
|
|
|
invoke-direct {v1, v0, v8, v9}, Landroidx/sharetarget/ShortcutsInfoSerialization$ShortcutContainer;-><init>(Landroidx/core/content/pm/ShortcutInfoCompat;Ljava/lang/String;Ljava/lang/String;)V
|
|
|
|
return-object v1
|
|
|
|
:cond_f
|
|
:goto_3
|
|
return-object v3
|
|
.end method
|
|
|
|
.method public static saveAsXml(Ljava/util/List;Ljava/io/File;)V
|
|
.locals 6
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"(",
|
|
"Ljava/util/List<",
|
|
"Landroidx/sharetarget/ShortcutsInfoSerialization$ShortcutContainer;",
|
|
">;",
|
|
"Ljava/io/File;",
|
|
")V"
|
|
}
|
|
.end annotation
|
|
|
|
const-string v0, "share_targets"
|
|
|
|
new-instance v1, Landroidx/core/util/AtomicFile;
|
|
|
|
invoke-direct {v1, p1}, Landroidx/core/util/AtomicFile;-><init>(Ljava/io/File;)V
|
|
|
|
const/4 p1, 0x0
|
|
|
|
:try_start_0
|
|
invoke-virtual {v1}, Landroidx/core/util/AtomicFile;->startWrite()Ljava/io/FileOutputStream;
|
|
|
|
move-result-object v2
|
|
:try_end_0
|
|
.catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_1
|
|
|
|
:try_start_1
|
|
new-instance v3, Ljava/io/BufferedOutputStream;
|
|
|
|
invoke-direct {v3, v2}, Ljava/io/BufferedOutputStream;-><init>(Ljava/io/OutputStream;)V
|
|
|
|
invoke-static {}, Landroid/util/Xml;->newSerializer()Lorg/xmlpull/v1/XmlSerializer;
|
|
|
|
move-result-object v4
|
|
|
|
const-string v5, "UTF_8"
|
|
|
|
invoke-interface {v4, v3, v5}, Lorg/xmlpull/v1/XmlSerializer;->setOutput(Ljava/io/OutputStream;Ljava/lang/String;)V
|
|
|
|
sget-object v5, Ljava/lang/Boolean;->TRUE:Ljava/lang/Boolean;
|
|
|
|
invoke-interface {v4, p1, v5}, Lorg/xmlpull/v1/XmlSerializer;->startDocument(Ljava/lang/String;Ljava/lang/Boolean;)V
|
|
|
|
invoke-interface {v4, p1, v0}, Lorg/xmlpull/v1/XmlSerializer;->startTag(Ljava/lang/String;Ljava/lang/String;)Lorg/xmlpull/v1/XmlSerializer;
|
|
|
|
invoke-interface {p0}, Ljava/util/List;->iterator()Ljava/util/Iterator;
|
|
|
|
move-result-object p0
|
|
|
|
:goto_0
|
|
invoke-interface {p0}, Ljava/util/Iterator;->hasNext()Z
|
|
|
|
move-result v5
|
|
|
|
if-eqz v5, :cond_0
|
|
|
|
invoke-interface {p0}, Ljava/util/Iterator;->next()Ljava/lang/Object;
|
|
|
|
move-result-object v5
|
|
|
|
check-cast v5, Landroidx/sharetarget/ShortcutsInfoSerialization$ShortcutContainer;
|
|
|
|
invoke-static {v4, v5}, Landroidx/sharetarget/ShortcutsInfoSerialization;->serializeShortcutContainer(Lorg/xmlpull/v1/XmlSerializer;Landroidx/sharetarget/ShortcutsInfoSerialization$ShortcutContainer;)V
|
|
|
|
goto :goto_0
|
|
|
|
:cond_0
|
|
invoke-interface {v4, p1, v0}, Lorg/xmlpull/v1/XmlSerializer;->endTag(Ljava/lang/String;Ljava/lang/String;)Lorg/xmlpull/v1/XmlSerializer;
|
|
|
|
invoke-interface {v4}, Lorg/xmlpull/v1/XmlSerializer;->endDocument()V
|
|
|
|
invoke-virtual {v3}, Ljava/io/BufferedOutputStream;->flush()V
|
|
|
|
invoke-virtual {v2}, Ljava/io/FileOutputStream;->flush()V
|
|
|
|
invoke-virtual {v1, v2}, Landroidx/core/util/AtomicFile;->finishWrite(Ljava/io/FileOutputStream;)V
|
|
:try_end_1
|
|
.catch Ljava/lang/Exception; {:try_start_1 .. :try_end_1} :catch_0
|
|
|
|
return-void
|
|
|
|
:catch_0
|
|
move-exception p0
|
|
|
|
move-object p1, v2
|
|
|
|
goto :goto_1
|
|
|
|
:catch_1
|
|
move-exception p0
|
|
|
|
:goto_1
|
|
const-string v0, "Failed to write to file "
|
|
|
|
invoke-static {v0}, Lf/e/b/a/a;->D(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
move-result-object v2
|
|
|
|
invoke-virtual {v1}, Landroidx/core/util/AtomicFile;->getBaseFile()Ljava/io/File;
|
|
|
|
move-result-object v3
|
|
|
|
invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
|
|
|
move-result-object v2
|
|
|
|
const-string v3, "ShortcutInfoCompatSaver"
|
|
|
|
invoke-static {v3, v2, p0}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
|
|
|
|
invoke-virtual {v1, p1}, Landroidx/core/util/AtomicFile;->failWrite(Ljava/io/FileOutputStream;)V
|
|
|
|
new-instance p1, Ljava/lang/RuntimeException;
|
|
|
|
invoke-static {v0}, Lf/e/b/a/a;->D(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
move-result-object v0
|
|
|
|
invoke-virtual {v1}, Landroidx/core/util/AtomicFile;->getBaseFile()Ljava/io/File;
|
|
|
|
move-result-object v1
|
|
|
|
invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
|
|
|
move-result-object v0
|
|
|
|
invoke-direct {p1, v0, p0}, Ljava/lang/RuntimeException;-><init>(Ljava/lang/String;Ljava/lang/Throwable;)V
|
|
|
|
throw p1
|
|
.end method
|
|
|
|
.method public static serializeAttribute(Lorg/xmlpull/v1/XmlSerializer;Ljava/lang/String;Ljava/lang/String;)V
|
|
.locals 1
|
|
.annotation build Landroidx/annotation/WorkerThread;
|
|
.end annotation
|
|
|
|
.annotation system Ldalvik/annotation/Throws;
|
|
value = {
|
|
Ljava/io/IOException;
|
|
}
|
|
.end annotation
|
|
|
|
invoke-static {p2}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z
|
|
|
|
move-result v0
|
|
|
|
if-eqz v0, :cond_0
|
|
|
|
return-void
|
|
|
|
:cond_0
|
|
const/4 v0, 0x0
|
|
|
|
invoke-interface {p0, v0, p1, p2}, Lorg/xmlpull/v1/XmlSerializer;->attribute(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Lorg/xmlpull/v1/XmlSerializer;
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public static serializeCategory(Lorg/xmlpull/v1/XmlSerializer;Ljava/lang/String;)V
|
|
.locals 3
|
|
.annotation build Landroidx/annotation/WorkerThread;
|
|
.end annotation
|
|
|
|
.annotation system Ldalvik/annotation/Throws;
|
|
value = {
|
|
Ljava/io/IOException;
|
|
}
|
|
.end annotation
|
|
|
|
invoke-static {p1}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z
|
|
|
|
move-result v0
|
|
|
|
if-eqz v0, :cond_0
|
|
|
|
return-void
|
|
|
|
:cond_0
|
|
const/4 v0, 0x0
|
|
|
|
const-string v1, "categories"
|
|
|
|
invoke-interface {p0, v0, v1}, Lorg/xmlpull/v1/XmlSerializer;->startTag(Ljava/lang/String;Ljava/lang/String;)Lorg/xmlpull/v1/XmlSerializer;
|
|
|
|
const-string v2, "name"
|
|
|
|
invoke-static {p0, v2, p1}, Landroidx/sharetarget/ShortcutsInfoSerialization;->serializeAttribute(Lorg/xmlpull/v1/XmlSerializer;Ljava/lang/String;Ljava/lang/String;)V
|
|
|
|
invoke-interface {p0, v0, v1}, Lorg/xmlpull/v1/XmlSerializer;->endTag(Ljava/lang/String;Ljava/lang/String;)Lorg/xmlpull/v1/XmlSerializer;
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public static serializeIntent(Lorg/xmlpull/v1/XmlSerializer;Landroid/content/Intent;)V
|
|
.locals 4
|
|
.annotation build Landroidx/annotation/WorkerThread;
|
|
.end annotation
|
|
|
|
.annotation system Ldalvik/annotation/Throws;
|
|
value = {
|
|
Ljava/io/IOException;
|
|
}
|
|
.end annotation
|
|
|
|
const/4 v0, 0x0
|
|
|
|
const-string v1, "intent"
|
|
|
|
invoke-interface {p0, v0, v1}, Lorg/xmlpull/v1/XmlSerializer;->startTag(Ljava/lang/String;Ljava/lang/String;)Lorg/xmlpull/v1/XmlSerializer;
|
|
|
|
invoke-virtual {p1}, Landroid/content/Intent;->getAction()Ljava/lang/String;
|
|
|
|
move-result-object v2
|
|
|
|
const-string v3, "action"
|
|
|
|
invoke-static {p0, v3, v2}, Landroidx/sharetarget/ShortcutsInfoSerialization;->serializeAttribute(Lorg/xmlpull/v1/XmlSerializer;Ljava/lang/String;Ljava/lang/String;)V
|
|
|
|
invoke-virtual {p1}, Landroid/content/Intent;->getComponent()Landroid/content/ComponentName;
|
|
|
|
move-result-object v2
|
|
|
|
if-eqz v2, :cond_0
|
|
|
|
invoke-virtual {p1}, Landroid/content/Intent;->getComponent()Landroid/content/ComponentName;
|
|
|
|
move-result-object v2
|
|
|
|
invoke-virtual {v2}, Landroid/content/ComponentName;->getPackageName()Ljava/lang/String;
|
|
|
|
move-result-object v2
|
|
|
|
const-string v3, "targetPackage"
|
|
|
|
invoke-static {p0, v3, v2}, Landroidx/sharetarget/ShortcutsInfoSerialization;->serializeAttribute(Lorg/xmlpull/v1/XmlSerializer;Ljava/lang/String;Ljava/lang/String;)V
|
|
|
|
invoke-virtual {p1}, Landroid/content/Intent;->getComponent()Landroid/content/ComponentName;
|
|
|
|
move-result-object p1
|
|
|
|
invoke-virtual {p1}, Landroid/content/ComponentName;->getClassName()Ljava/lang/String;
|
|
|
|
move-result-object p1
|
|
|
|
const-string v2, "targetClass"
|
|
|
|
invoke-static {p0, v2, p1}, Landroidx/sharetarget/ShortcutsInfoSerialization;->serializeAttribute(Lorg/xmlpull/v1/XmlSerializer;Ljava/lang/String;Ljava/lang/String;)V
|
|
|
|
:cond_0
|
|
invoke-interface {p0, v0, v1}, Lorg/xmlpull/v1/XmlSerializer;->endTag(Ljava/lang/String;Ljava/lang/String;)Lorg/xmlpull/v1/XmlSerializer;
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public static serializeShortcutContainer(Lorg/xmlpull/v1/XmlSerializer;Landroidx/sharetarget/ShortcutsInfoSerialization$ShortcutContainer;)V
|
|
.locals 6
|
|
.annotation build Landroidx/annotation/WorkerThread;
|
|
.end annotation
|
|
|
|
.annotation system Ldalvik/annotation/Throws;
|
|
value = {
|
|
Ljava/io/IOException;
|
|
}
|
|
.end annotation
|
|
|
|
const/4 v0, 0x0
|
|
|
|
const-string v1, "target"
|
|
|
|
invoke-interface {p0, v0, v1}, Lorg/xmlpull/v1/XmlSerializer;->startTag(Ljava/lang/String;Ljava/lang/String;)Lorg/xmlpull/v1/XmlSerializer;
|
|
|
|
iget-object v2, p1, Landroidx/sharetarget/ShortcutsInfoSerialization$ShortcutContainer;->mShortcutInfo:Landroidx/core/content/pm/ShortcutInfoCompat;
|
|
|
|
invoke-virtual {v2}, Landroidx/core/content/pm/ShortcutInfoCompat;->getId()Ljava/lang/String;
|
|
|
|
move-result-object v3
|
|
|
|
const-string v4, "id"
|
|
|
|
invoke-static {p0, v4, v3}, Landroidx/sharetarget/ShortcutsInfoSerialization;->serializeAttribute(Lorg/xmlpull/v1/XmlSerializer;Ljava/lang/String;Ljava/lang/String;)V
|
|
|
|
invoke-virtual {v2}, Landroidx/core/content/pm/ShortcutInfoCompat;->getShortLabel()Ljava/lang/CharSequence;
|
|
|
|
move-result-object v3
|
|
|
|
invoke-interface {v3}, Ljava/lang/CharSequence;->toString()Ljava/lang/String;
|
|
|
|
move-result-object v3
|
|
|
|
const-string v4, "short_label"
|
|
|
|
invoke-static {p0, v4, v3}, Landroidx/sharetarget/ShortcutsInfoSerialization;->serializeAttribute(Lorg/xmlpull/v1/XmlSerializer;Ljava/lang/String;Ljava/lang/String;)V
|
|
|
|
invoke-virtual {v2}, Landroidx/core/content/pm/ShortcutInfoCompat;->getRank()I
|
|
|
|
move-result v3
|
|
|
|
invoke-static {v3}, Ljava/lang/Integer;->toString(I)Ljava/lang/String;
|
|
|
|
move-result-object v3
|
|
|
|
const-string v4, "rank"
|
|
|
|
invoke-static {p0, v4, v3}, Landroidx/sharetarget/ShortcutsInfoSerialization;->serializeAttribute(Lorg/xmlpull/v1/XmlSerializer;Ljava/lang/String;Ljava/lang/String;)V
|
|
|
|
invoke-virtual {v2}, Landroidx/core/content/pm/ShortcutInfoCompat;->getLongLabel()Ljava/lang/CharSequence;
|
|
|
|
move-result-object v3
|
|
|
|
invoke-static {v3}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z
|
|
|
|
move-result v3
|
|
|
|
if-nez v3, :cond_0
|
|
|
|
invoke-virtual {v2}, Landroidx/core/content/pm/ShortcutInfoCompat;->getLongLabel()Ljava/lang/CharSequence;
|
|
|
|
move-result-object v3
|
|
|
|
invoke-interface {v3}, Ljava/lang/CharSequence;->toString()Ljava/lang/String;
|
|
|
|
move-result-object v3
|
|
|
|
const-string v4, "long_label"
|
|
|
|
invoke-static {p0, v4, v3}, Landroidx/sharetarget/ShortcutsInfoSerialization;->serializeAttribute(Lorg/xmlpull/v1/XmlSerializer;Ljava/lang/String;Ljava/lang/String;)V
|
|
|
|
:cond_0
|
|
invoke-virtual {v2}, Landroidx/core/content/pm/ShortcutInfoCompat;->getDisabledMessage()Ljava/lang/CharSequence;
|
|
|
|
move-result-object v3
|
|
|
|
invoke-static {v3}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z
|
|
|
|
move-result v3
|
|
|
|
if-nez v3, :cond_1
|
|
|
|
invoke-virtual {v2}, Landroidx/core/content/pm/ShortcutInfoCompat;->getDisabledMessage()Ljava/lang/CharSequence;
|
|
|
|
move-result-object v3
|
|
|
|
invoke-interface {v3}, Ljava/lang/CharSequence;->toString()Ljava/lang/String;
|
|
|
|
move-result-object v3
|
|
|
|
const-string v4, "disabled_message"
|
|
|
|
invoke-static {p0, v4, v3}, Landroidx/sharetarget/ShortcutsInfoSerialization;->serializeAttribute(Lorg/xmlpull/v1/XmlSerializer;Ljava/lang/String;Ljava/lang/String;)V
|
|
|
|
:cond_1
|
|
invoke-virtual {v2}, Landroidx/core/content/pm/ShortcutInfoCompat;->getActivity()Landroid/content/ComponentName;
|
|
|
|
move-result-object v3
|
|
|
|
if-eqz v3, :cond_2
|
|
|
|
invoke-virtual {v2}, Landroidx/core/content/pm/ShortcutInfoCompat;->getActivity()Landroid/content/ComponentName;
|
|
|
|
move-result-object v3
|
|
|
|
invoke-virtual {v3}, Landroid/content/ComponentName;->flattenToString()Ljava/lang/String;
|
|
|
|
move-result-object v3
|
|
|
|
const-string v4, "component"
|
|
|
|
invoke-static {p0, v4, v3}, Landroidx/sharetarget/ShortcutsInfoSerialization;->serializeAttribute(Lorg/xmlpull/v1/XmlSerializer;Ljava/lang/String;Ljava/lang/String;)V
|
|
|
|
:cond_2
|
|
iget-object v3, p1, Landroidx/sharetarget/ShortcutsInfoSerialization$ShortcutContainer;->mResourceName:Ljava/lang/String;
|
|
|
|
invoke-static {v3}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z
|
|
|
|
move-result v3
|
|
|
|
if-nez v3, :cond_3
|
|
|
|
iget-object v3, p1, Landroidx/sharetarget/ShortcutsInfoSerialization$ShortcutContainer;->mResourceName:Ljava/lang/String;
|
|
|
|
const-string v4, "icon_resource_name"
|
|
|
|
invoke-static {p0, v4, v3}, Landroidx/sharetarget/ShortcutsInfoSerialization;->serializeAttribute(Lorg/xmlpull/v1/XmlSerializer;Ljava/lang/String;Ljava/lang/String;)V
|
|
|
|
:cond_3
|
|
iget-object v3, p1, Landroidx/sharetarget/ShortcutsInfoSerialization$ShortcutContainer;->mBitmapPath:Ljava/lang/String;
|
|
|
|
invoke-static {v3}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z
|
|
|
|
move-result v3
|
|
|
|
if-nez v3, :cond_4
|
|
|
|
iget-object p1, p1, Landroidx/sharetarget/ShortcutsInfoSerialization$ShortcutContainer;->mBitmapPath:Ljava/lang/String;
|
|
|
|
const-string v3, "icon_bitmap_path"
|
|
|
|
invoke-static {p0, v3, p1}, Landroidx/sharetarget/ShortcutsInfoSerialization;->serializeAttribute(Lorg/xmlpull/v1/XmlSerializer;Ljava/lang/String;Ljava/lang/String;)V
|
|
|
|
:cond_4
|
|
invoke-virtual {v2}, Landroidx/core/content/pm/ShortcutInfoCompat;->getIntents()[Landroid/content/Intent;
|
|
|
|
move-result-object p1
|
|
|
|
array-length v3, p1
|
|
|
|
const/4 v4, 0x0
|
|
|
|
:goto_0
|
|
if-ge v4, v3, :cond_5
|
|
|
|
aget-object v5, p1, v4
|
|
|
|
invoke-static {p0, v5}, Landroidx/sharetarget/ShortcutsInfoSerialization;->serializeIntent(Lorg/xmlpull/v1/XmlSerializer;Landroid/content/Intent;)V
|
|
|
|
add-int/lit8 v4, v4, 0x1
|
|
|
|
goto :goto_0
|
|
|
|
:cond_5
|
|
invoke-virtual {v2}, Landroidx/core/content/pm/ShortcutInfoCompat;->getCategories()Ljava/util/Set;
|
|
|
|
move-result-object p1
|
|
|
|
invoke-interface {p1}, Ljava/util/Set;->iterator()Ljava/util/Iterator;
|
|
|
|
move-result-object p1
|
|
|
|
:goto_1
|
|
invoke-interface {p1}, Ljava/util/Iterator;->hasNext()Z
|
|
|
|
move-result v2
|
|
|
|
if-eqz v2, :cond_6
|
|
|
|
invoke-interface {p1}, Ljava/util/Iterator;->next()Ljava/lang/Object;
|
|
|
|
move-result-object v2
|
|
|
|
check-cast v2, Ljava/lang/String;
|
|
|
|
invoke-static {p0, v2}, Landroidx/sharetarget/ShortcutsInfoSerialization;->serializeCategory(Lorg/xmlpull/v1/XmlSerializer;Ljava/lang/String;)V
|
|
|
|
goto :goto_1
|
|
|
|
:cond_6
|
|
invoke-interface {p0, v0, v1}, Lorg/xmlpull/v1/XmlSerializer;->endTag(Ljava/lang/String;Ljava/lang/String;)Lorg/xmlpull/v1/XmlSerializer;
|
|
|
|
return-void
|
|
.end method
|