DelegateComponent.smali

.class public Lorg/acdd/runtime/DelegateComponent;
.super Ljava/lang/Object;
.source "DelegateComponent.java"


# static fields
.field static apkApplications:Ljava/util/Map;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/Map",
            "<",
            "Ljava/lang/String;",
            "Landroid/app/Application;",
            ">;"
        }
    .end annotation
.end field

.field private static apkPackages:Ljava/util/Map;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/Map",
            "<",
            "Ljava/lang/String;",
            "Lorg/acdd/runtime/PackageLite;",
            ">;"
        }
    .end annotation
.end field

.field static final log:Lorg/acdd/log/Logger;


# direct methods
.method static constructor <clinit>()V
    .registers 1

    .prologue
    .line 55
    invoke-static {}, Lorg/acdd/log/LoggerFactory;->getInstance()Lorg/acdd/log/Logger;

    move-result-object v0

    sput-object v0, Lorg/acdd/runtime/DelegateComponent;->log:Lorg/acdd/log/Logger;

    .line 56
    new-instance v0, Ljava/util/concurrent/ConcurrentHashMap;

    invoke-direct {v0}, Ljava/util/concurrent/ConcurrentHashMap;-><init>()V

    sput-object v0, Lorg/acdd/runtime/DelegateComponent;->apkPackages:Ljava/util/Map;

    .line 57
    new-instance v0, Ljava/util/HashMap;

    invoke-direct {v0}, Ljava/util/HashMap;-><init>()V

    sput-object v0, Lorg/acdd/runtime/DelegateComponent;->apkApplications:Ljava/util/Map;

    .line 58
    return-void
.end method

.method public constructor <init>()V
    .registers 1

    .prologue
    .line 49
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method

.method private static chooseBestActivity(Landroid/content/Intent;Ljava/lang/String;ILjava/util/List;)Lorg/acdd/runtime/PackageLite$SimpleActivityInfo;
    .registers 5
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Landroid/content/Intent;",
            "Ljava/lang/String;",
            "I",
            "Ljava/util/List",
            "<",
            "Lorg/acdd/runtime/PackageLite$SimpleActivityInfo;",
            ">;)",
            "Lorg/acdd/runtime/PackageLite$SimpleActivityInfo;"
        }
    .end annotation

    .prologue
    .line 187
    const/4 v0, 0x0

    invoke-interface {p3, v0}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lorg/acdd/runtime/PackageLite$SimpleActivityInfo;

    return-object v0
.end method

.method public static getActivityInfo(Ljava/lang/String;)Lorg/acdd/runtime/PackageLite$SimpleActivityInfo;
    .registers 5

    .prologue
    const/4 v1, 0x0

    .line 115
    invoke-static {p0}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z

    move-result v0

    if-eqz v0, :cond_9

    move-object v0, v1

    .line 129
    :goto_8
    return-object v0

    .line 116
    :cond_9
    sget-object v0, Lorg/acdd/runtime/DelegateComponent;->apkPackages:Ljava/util/Map;

    invoke-interface {v0}, Ljava/util/Map;->entrySet()Ljava/util/Set;

    move-result-object v0

    invoke-interface {v0}, Ljava/util/Set;->iterator()Ljava/util/Iterator;

    move-result-object v2

    :cond_13
    invoke-interface {v2}, Ljava/util/Iterator;->hasNext()Z

    move-result v0

    if-eqz v0, :cond_3e

    invoke-interface {v2}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Ljava/util/Map$Entry;

    .line 117
    if-eqz v0, :cond_13

    .line 120
    invoke-interface {v0}, Ljava/util/Map$Entry;->getValue()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lorg/acdd/runtime/PackageLite;

    .line 121
    if-eqz v0, :cond_13

    iget-object v3, v0, Lorg/acdd/runtime/PackageLite;->activities:Ljava/util/Map;

    if-eqz v3, :cond_13

    .line 124
    iget-object v3, v0, Lorg/acdd/runtime/PackageLite;->activities:Ljava/util/Map;

    invoke-interface {v3, p0}, Ljava/util/Map;->containsKey(Ljava/lang/Object;)Z

    move-result v3

    if-eqz v3, :cond_13

    .line 125
    iget-object v0, v0, Lorg/acdd/runtime/PackageLite;->activities:Ljava/util/Map;

    invoke-interface {v0, p0}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lorg/acdd/runtime/PackageLite$SimpleActivityInfo;

    goto :goto_8

    :cond_3e
    move-object v0, v1

    .line 129
    goto :goto_8
.end method

.method public static getApkPackagesInfo()Ljava/lang/String;
    .registers 1

    .prologue
    .line 111
    sget-object v0, Lorg/acdd/runtime/DelegateComponent;->apkPackages:Ljava/util/Map;

    invoke-virtual {v0}, Ljava/lang/Object;->toString()Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method

.method public static getPackage(Ljava/lang/String;)Lorg/acdd/runtime/PackageLite;
    .registers 2

    .prologue
    .line 65
    sget-object v0, Lorg/acdd/runtime/DelegateComponent;->apkPackages:Ljava/util/Map;

    invoke-interface {v0, p0}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lorg/acdd/runtime/PackageLite;

    return-object v0
.end method

.method public static locateComponent(Ljava/lang/String;)Ljava/lang/String;
    .registers 6

    .prologue
    const/4 v2, 0x0

    .line 94
    invoke-static {p0}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z

    move-result v0

    if-eqz v0, :cond_9

    move-object v0, v2

    .line 107
    :goto_8
    return-object v0

    .line 95
    :cond_9
    sget-object v0, Lorg/acdd/runtime/DelegateComponent;->apkPackages:Ljava/util/Map;

    invoke-interface {v0}, Ljava/util/Map;->entrySet()Ljava/util/Set;

    move-result-object v0

    invoke-interface {v0}, Ljava/util/Set;->iterator()Ljava/util/Iterator;

    move-result-object v3

    :cond_13
    invoke-interface {v3}, Ljava/util/Iterator;->hasNext()Z

    move-result v0

    if-eqz v0, :cond_3c

    invoke-interface {v3}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Ljava/util/Map$Entry;

    .line 96
    if-eqz v0, :cond_13

    .line 99
    invoke-interface {v0}, Ljava/util/Map$Entry;->getValue()Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Lorg/acdd/runtime/PackageLite;

    .line 100
    if-eqz v1, :cond_13

    iget-object v4, v1, Lorg/acdd/runtime/PackageLite;->components:Ljava/util/Set;

    if-eqz v4, :cond_13

    .line 103
    iget-object v1, v1, Lorg/acdd/runtime/PackageLite;->components:Ljava/util/Set;

    invoke-interface {v1, p0}, Ljava/util/Set;->contains(Ljava/lang/Object;)Z

    move-result v1

    if-eqz v1, :cond_13

    .line 104
    invoke-interface {v0}, Ljava/util/Map$Entry;->getKey()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Ljava/lang/String;

    goto :goto_8

    :cond_3c
    move-object v0, v2

    .line 107
    goto :goto_8
.end method

.method public static putPackage(Ljava/lang/String;Lorg/acdd/runtime/PackageLite;)V
    .registers 3

    .prologue
    .line 75
    sget-object v0, Lorg/acdd/runtime/DelegateComponent;->apkPackages:Ljava/util/Map;

    invoke-interface {v0, p0, p1}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;

    .line 76
    return-void
.end method

.method private static queryIntentActivities(Lorg/acdd/runtime/PackageLite;Landroid/content/Intent;I)Ljava/util/List;
    .registers 12
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Lorg/acdd/runtime/PackageLite;",
            "Landroid/content/Intent;",
            "I)",
            "Ljava/util/List",
            "<",
            "Lorg/acdd/runtime/PackageLite$SimpleActivityInfo;",
            ">;"
        }
    .end annotation

    .prologue
    .line 159
    invoke-virtual {p1}, Landroid/content/Intent;->getComponent()Landroid/content/ComponentName;

    move-result-object v3

    .line 160
    new-instance v4, Ljava/util/ArrayList;

    invoke-direct {v4}, Ljava/util/ArrayList;-><init>()V

    .line 161
    sget-object v0, Lorg/acdd/runtime/RuntimeVariables;->androidApplication:Landroid/app/Application;

    invoke-virtual {v0}, Landroid/app/Application;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v5

    .line 163
    iget-object v0, p0, Lorg/acdd/runtime/PackageLite;->activities:Ljava/util/Map;

    invoke-interface {v0}, Ljava/util/Map;->entrySet()Ljava/util/Set;

    move-result-object v0

    invoke-interface {v0}, Ljava/util/Set;->iterator()Ljava/util/Iterator;

    move-result-object v6

    :cond_19
    :goto_19
    invoke-interface {v6}, Ljava/util/Iterator;->hasNext()Z

    move-result v0

    if-eqz v0, :cond_66

    invoke-interface {v6}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Ljava/util/Map$Entry;

    .line 164
    invoke-interface {v0}, Ljava/util/Map$Entry;->getValue()Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Lorg/acdd/runtime/PackageLite$SimpleActivityInfo;

    .line 165
    if-eqz v1, :cond_19

    .line 168
    invoke-interface {v0}, Ljava/util/Map$Entry;->getKey()Ljava/lang/Object;

    move-result-object v2

    check-cast v2, Ljava/lang/String;

    invoke-virtual {v2, v3}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v2

    if-eqz v2, :cond_41

    .line 169
    invoke-interface {v0}, Ljava/util/Map$Entry;->getValue()Ljava/lang/Object;

    move-result-object v0

    invoke-interface {v4, v0}, Ljava/util/List;->add(Ljava/lang/Object;)Z

    goto :goto_19

    .line 170
    :cond_41
    if-nez v3, :cond_19

    .line 172
    iget-object v0, v1, Lorg/acdd/runtime/PackageLite$SimpleActivityInfo;->intents:Ljava/util/ArrayList;

    if-eqz v0, :cond_19

    .line 173
    iget-object v0, v1, Lorg/acdd/runtime/PackageLite$SimpleActivityInfo;->intents:Ljava/util/ArrayList;

    invoke-virtual {v0}, Ljava/util/ArrayList;->iterator()Ljava/util/Iterator;

    move-result-object v2

    :cond_4d
    invoke-interface {v2}, Ljava/util/Iterator;->hasNext()Z

    move-result v0

    if-eqz v0, :cond_19

    invoke-interface {v2}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Landroid/content/pm/PackageParser$IntentInfo;

    .line 174
    const/4 v7, 0x1

    const-string v8, "DelegateComponent"

    invoke-virtual {v0, v5, p1, v7, v8}, Landroid/content/pm/PackageParser$IntentInfo;->match(Landroid/content/ContentResolver;Landroid/content/Intent;ZLjava/lang/String;)I

    move-result v0

    if-ltz v0, :cond_4d

    .line 175
    invoke-interface {v4, v1}, Ljava/util/List;->add(Ljava/lang/Object;)Z

    goto :goto_19

    .line 183
    :cond_66
    return-object v4
.end method

.method public static removePackage(Ljava/lang/String;)V
    .registers 2

    .prologue
    .line 84
    sget-object v0, Lorg/acdd/runtime/DelegateComponent;->apkPackages:Ljava/util/Map;

    invoke-interface {v0, p0}, Ljava/util/Map;->remove(Ljava/lang/Object;)Ljava/lang/Object;

    .line 85
    return-void
.end method

.method public static resolveActivity(Landroid/content/Intent;)Lorg/acdd/runtime/PackageLite$SimpleActivityInfo;
    .registers 2

    .prologue
    .line 133
    const/4 v0, 0x0

    invoke-static {p0, v0}, Lorg/acdd/runtime/DelegateComponent;->resolveActivity(Landroid/content/Intent;I)Lorg/acdd/runtime/PackageLite$SimpleActivityInfo;

    move-result-object v0

    return-object v0
.end method

.method public static resolveActivity(Landroid/content/Intent;I)Lorg/acdd/runtime/PackageLite$SimpleActivityInfo;
    .registers 4

    .prologue
    .line 137
    sget-object v0, Lorg/acdd/runtime/DelegateComponent;->apkPackages:Ljava/util/Map;

    invoke-interface {v0}, Ljava/util/Map;->entrySet()Ljava/util/Set;

    move-result-object v0

    invoke-interface {v0}, Ljava/util/Set;->iterator()Ljava/util/Iterator;

    move-result-object v1

    :cond_a
    invoke-interface {v1}, Ljava/util/Iterator;->hasNext()Z

    move-result v0

    if-eqz v0, :cond_23

    invoke-interface {v1}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Ljava/util/Map$Entry;

    .line 138
    invoke-interface {v0}, Ljava/util/Map$Entry;->getValue()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lorg/acdd/runtime/PackageLite;

    .line 139
    invoke-static {v0, p0, p1}, Lorg/acdd/runtime/DelegateComponent;->resolveActivity(Lorg/acdd/runtime/PackageLite;Landroid/content/Intent;I)Lorg/acdd/runtime/PackageLite$SimpleActivityInfo;

    move-result-object v0

    .line 140
    if-eqz v0, :cond_a

    .line 145
    :goto_22
    return-object v0

    :cond_23
    const/4 v0, 0x0

    goto :goto_22
.end method

.method private static resolveActivity(Lorg/acdd/runtime/PackageLite;Landroid/content/Intent;I)Lorg/acdd/runtime/PackageLite$SimpleActivityInfo;
    .registers 5

    .prologue
    .line 149
    invoke-static {p0, p1, p2}, Lorg/acdd/runtime/DelegateComponent;->queryIntentActivities(Lorg/acdd/runtime/PackageLite;Landroid/content/Intent;I)Ljava/util/List;

    move-result-object v0

    .line 150
    if-eqz v0, :cond_c

    invoke-interface {v0}, Ljava/util/List;->isEmpty()Z

    move-result v1

    if-eqz v1, :cond_e

    .line 151
    :cond_c
    const/4 v0, 0x0

    .line 155
    :goto_d
    return-object v0

    .line 154
    :cond_e
    sget-object v1, Lorg/acdd/runtime/RuntimeVariables;->androidApplication:Landroid/app/Application;

    invoke-virtual {v1}, Landroid/app/Application;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v1

    .line 155
    invoke-virtual {p1, v1}, Landroid/content/Intent;->resolveTypeIfNeeded(Landroid/content/ContentResolver;)Ljava/lang/String;

    move-result-object v1

    invoke-static {p1, v1, p2, v0}, Lorg/acdd/runtime/DelegateComponent;->chooseBestActivity(Landroid/content/Intent;Ljava/lang/String;ILjava/util/List;)Lorg/acdd/runtime/PackageLite$SimpleActivityInfo;

    move-result-object v0

    goto :goto_d
.end method