.class public final Lg1/a;
.super Ljava/lang/Object;
.source ""


# static fields
.field public static volatile d:Lg1/a;

.field public static final e:Ljava/lang/Object;


# instance fields
.field public final a:Ljava/util/Map;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/Map<",
            "Ljava/lang/Class<",
            "*>;",
            "Ljava/lang/Object;",
            ">;"
        }
    .end annotation
.end field

.field public final b:Ljava/util/Set;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/Set<",
            "Ljava/lang/Class<",
            "+",
            "Lg1/b<",
            "*>;>;>;"
        }
    .end annotation
.end field

.field public final c:Landroid/content/Context;


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

    new-instance v0, Ljava/lang/Object;

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

    sput-object v0, Lg1/a;->e:Ljava/lang/Object;

    return-void
.end method

.method public constructor <init>(Landroid/content/Context;)V
    .registers 2

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

    invoke-virtual {p1}, Landroid/content/Context;->getApplicationContext()Landroid/content/Context;

    move-result-object p1

    iput-object p1, p0, Lg1/a;->c:Landroid/content/Context;

    new-instance p1, Ljava/util/HashSet;

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

    iput-object p1, p0, Lg1/a;->b:Ljava/util/Set;

    new-instance p1, Ljava/util/HashMap;

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

    iput-object p1, p0, Lg1/a;->a:Ljava/util/Map;

    return-void
.end method

.method public static b(Landroid/content/Context;)Lg1/a;
    .registers 3

    sget-object v0, Lg1/a;->d:Lg1/a;

    if-nez v0, :cond_17

    sget-object v0, Lg1/a;->e:Ljava/lang/Object;

    monitor-enter v0

    :try_start_7
    sget-object v1, Lg1/a;->d:Lg1/a;

    if-nez v1, :cond_12

    new-instance v1, Lg1/a;

    invoke-direct {v1, p0}, Lg1/a;-><init>(Landroid/content/Context;)V

    sput-object v1, Lg1/a;->d:Lg1/a;

    :cond_12
    monitor-exit v0

    goto :goto_17

    :catchall_14
    move-exception p0

    monitor-exit v0
    :try_end_16
    .catchall {:try_start_7 .. :try_end_16} :catchall_14

    throw p0

    :cond_17
    :goto_17
    sget-object p0, Lg1/a;->d:Lg1/a;

    return-object p0
.end method


# virtual methods
.method public a(Ljava/lang/Class;Ljava/util/Set;)Ljava/lang/Object;
    .registers 8
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "<T:",
            "Ljava/lang/Object;",
            ">(",
            "Ljava/lang/Class<",
            "+",
            "Lg1/b<",
            "*>;>;",
            "Ljava/util/Set<",
            "Ljava/lang/Class<",
            "*>;>;)TT;"
        }
    .end annotation

    sget-object v0, Lg1/a;->e:Ljava/lang/Object;

    monitor-enter v0

    :try_start_3
    invoke-static {}, Lh1/a;->a()Z

    move-result v1
    :try_end_7
    .catchall {:try_start_3 .. :try_end_7} :catchall_91

    if-eqz v1, :cond_10

    :try_start_9
    invoke-virtual {p1}, Ljava/lang/Class;->getSimpleName()Ljava/lang/String;

    move-result-object v1

    .line 1
    invoke-static {v1}, Landroid/os/Trace;->beginSection(Ljava/lang/String;)V

    .line 2
    :cond_10
    invoke-interface {p2, p1}, Ljava/util/Set;->contains(Ljava/lang/Object;)Z

    move-result v1

    const/4 v2, 0x0

    if-nez v1, :cond_77

    iget-object v1, p0, Lg1/a;->a:Ljava/util/Map;

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

    move-result v1

    if-nez v1, :cond_6c

    invoke-interface {p2, p1}, Ljava/util/Set;->add(Ljava/lang/Object;)Z
    :try_end_22
    .catchall {:try_start_9 .. :try_end_22} :catchall_8c

    :try_start_22
    new-array v1, v2, [Ljava/lang/Class;

    invoke-virtual {p1, v1}, Ljava/lang/Class;->getDeclaredConstructor([Ljava/lang/Class;)Ljava/lang/reflect/Constructor;

    move-result-object v1

    new-array v2, v2, [Ljava/lang/Object;

    invoke-virtual {v1, v2}, Ljava/lang/reflect/Constructor;->newInstance([Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Lg1/b;

    invoke-interface {v1}, Lg1/b;->a()Ljava/util/List;

    move-result-object v2

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

    move-result v3

    if-nez v3, :cond_56

    invoke-interface {v2}, Ljava/util/List;->iterator()Ljava/util/Iterator;

    move-result-object v2

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

    move-result v3

    if-eqz v3, :cond_56

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

    move-result-object v3

    check-cast v3, Ljava/lang/Class;

    iget-object v4, p0, Lg1/a;->a:Ljava/util/Map;

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

    move-result v4

    if-nez v4, :cond_3e

    invoke-virtual {p0, v3, p2}, Lg1/a;->a(Ljava/lang/Class;Ljava/util/Set;)Ljava/lang/Object;

    goto :goto_3e

    :cond_56
    iget-object v2, p0, Lg1/a;->c:Landroid/content/Context;

    invoke-interface {v1, v2}, Lg1/b;->b(Landroid/content/Context;)Ljava/lang/Object;

    move-result-object v1

    invoke-interface {p2, p1}, Ljava/util/Set;->remove(Ljava/lang/Object;)Z

    iget-object p2, p0, Lg1/a;->a:Ljava/util/Map;

    invoke-interface {p2, p1, v1}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
    :try_end_64
    .catchall {:try_start_22 .. :try_end_64} :catchall_65

    goto :goto_72

    :catchall_65
    move-exception p1

    :try_start_66
    new-instance p2, Lg1/c;

    invoke-direct {p2, p1}, Lg1/c;-><init>(Ljava/lang/Throwable;)V

    throw p2

    :cond_6c
    iget-object p2, p0, Lg1/a;->a:Ljava/util/Map;

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

    move-result-object v1
    :try_end_72
    .catchall {:try_start_66 .. :try_end_72} :catchall_8c

    .line 3
    :goto_72
    :try_start_72
    invoke-static {}, Landroid/os/Trace;->endSection()V

    .line 4
    monitor-exit v0
    :try_end_76
    .catchall {:try_start_72 .. :try_end_76} :catchall_91

    return-object v1

    :cond_77
    :try_start_77
    const-string p2, "Cannot initialize %s. Cycle detected."

    const/4 v1, 0x1

    new-array v1, v1, [Ljava/lang/Object;

    invoke-virtual {p1}, Ljava/lang/Class;->getName()Ljava/lang/String;

    move-result-object p1

    aput-object p1, v1, v2

    invoke-static {p2, v1}, Ljava/lang/String;->format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    move-result-object p1

    new-instance p2, Ljava/lang/IllegalStateException;

    invoke-direct {p2, p1}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V

    throw p2
    :try_end_8c
    .catchall {:try_start_77 .. :try_end_8c} :catchall_8c

    :catchall_8c
    move-exception p1

    .line 5
    :try_start_8d
    invoke-static {}, Landroid/os/Trace;->endSection()V

    .line 6
    throw p1

    :catchall_91
    move-exception p1

    monitor-exit v0
    :try_end_93
    .catchall {:try_start_8d .. :try_end_93} :catchall_91

    throw p1
.end method
