a.smali

.class public final Ld1/a;
.super Ljava/lang/Object;
.source "ActiveResources.java"


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Ld1/a$d;,
        Ld1/a$c;
    }
.end annotation


# instance fields
.field public final a:Z

.field public final b:Ljava/util/Map;
    .annotation build Landroidx/annotation/VisibleForTesting;
    .end annotation

    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/Map<",
            "La1/d;",
            "Ld1/a$d;",
            ">;"
        }
    .end annotation
.end field

.field public final c:Ljava/lang/ref/ReferenceQueue;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/lang/ref/ReferenceQueue<",
            "Ld1/o<",
            "*>;>;"
        }
    .end annotation
.end field

.field public d:Ld1/o$a;

.field public volatile e:Z

.field public volatile f:Ld1/a$c;
    .annotation build Landroidx/annotation/Nullable;
    .end annotation
.end field


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

    return-void
.end method

.method public constructor <init>(Z)V
    .registers 3

    new-instance v0, Ld1/a$a;

    invoke-direct {v0}, Ld1/a$a;-><init>()V

    invoke-static {v0}, Ljava/util/concurrent/Executors;->newSingleThreadExecutor(Ljava/util/concurrent/ThreadFactory;)Ljava/util/concurrent/ExecutorService;

    move-result-object v0

    invoke-direct {p0, p1, v0}, Ld1/a;-><init>(ZLjava/util/concurrent/Executor;)V

    return-void
.end method

.method public constructor <init>(ZLjava/util/concurrent/Executor;)V
    .registers 4
    .annotation build Landroidx/annotation/VisibleForTesting;
    .end annotation

    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, Ld1/a;->b:Ljava/util/Map;

    new-instance v0, Ljava/lang/ref/ReferenceQueue;

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

    iput-object v0, p0, Ld1/a;->c:Ljava/lang/ref/ReferenceQueue;

    iput-boolean p1, p0, Ld1/a;->a:Z

    new-instance p1, Ld1/a$b;

    invoke-direct {p1, p0}, Ld1/a$b;-><init>(Ld1/a;)V

    invoke-interface {p2, p1}, Ljava/util/concurrent/Executor;->execute(Ljava/lang/Runnable;)V

    return-void
.end method


# virtual methods
.method public a()V
    .registers 2

    :cond_0
    :goto_0
    iget-boolean v0, p0, Ld1/a;->e:Z

    if-nez v0, :cond_1f

    :try_start_4
    iget-object v0, p0, Ld1/a;->c:Ljava/lang/ref/ReferenceQueue;

    invoke-virtual {v0}, Ljava/lang/ref/ReferenceQueue;->remove()Ljava/lang/ref/Reference;

    move-result-object v0

    check-cast v0, Ld1/a$d;

    invoke-virtual {p0, v0}, Ld1/a;->a(Ld1/a$d;)V

    iget-object v0, p0, Ld1/a;->f:Ld1/a$c;

    if-eqz v0, :cond_0

    invoke-interface {v0}, Ld1/a$c;->a()V
    :try_end_16
    .catch Ljava/lang/InterruptedException; {:try_start_4 .. :try_end_16} :catch_17

    goto :goto_0

    :catch_17
    invoke-static {}, Ljava/lang/Thread;->currentThread()Ljava/lang/Thread;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/Thread;->interrupt()V

    goto :goto_0

    :cond_1f
    return-void
.end method

.method public declared-synchronized a(La1/d;)V
    .registers 3

    monitor-enter p0

    :try_start_1
    iget-object v0, p0, Ld1/a;->b:Ljava/util/Map;

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

    move-result-object p1

    check-cast p1, Ld1/a$d;

    if-eqz p1, :cond_e

    invoke-virtual {p1}, Ld1/a$d;->a()V
    :try_end_e
    .catchall {:try_start_1 .. :try_end_e} :catchall_10

    :cond_e
    monitor-exit p0

    return-void

    :catchall_10
    move-exception p1

    monitor-exit p0

    throw p1
.end method

.method public declared-synchronized a(La1/d;Ld1/o;)V
    .registers 6
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "La1/d;",
            "Ld1/o<",
            "*>;)V"
        }
    .end annotation

    monitor-enter p0

    :try_start_1
    new-instance v0, Ld1/a$d;

    iget-object v1, p0, Ld1/a;->c:Ljava/lang/ref/ReferenceQueue;

    iget-boolean v2, p0, Ld1/a;->a:Z

    invoke-direct {v0, p1, p2, v1, v2}, Ld1/a$d;-><init>(La1/d;Ld1/o;Ljava/lang/ref/ReferenceQueue;Z)V

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

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

    move-result-object p1

    check-cast p1, Ld1/a$d;

    if-eqz p1, :cond_17

    invoke-virtual {p1}, Ld1/a$d;->a()V
    :try_end_17
    .catchall {:try_start_1 .. :try_end_17} :catchall_19

    :cond_17
    monitor-exit p0

    return-void

    :catchall_19
    move-exception p1

    monitor-exit p0

    throw p1
.end method

.method public a(Ld1/a$d;)V
    .registers 7
    .param p1    # Ld1/a$d;
        .annotation build Landroidx/annotation/NonNull;
        .end annotation
    .end param

    iget-object v0, p0, Ld1/a;->d:Ld1/o$a;

    monitor-enter v0

    :try_start_3
    monitor-enter p0
    :try_end_4
    .catchall {:try_start_3 .. :try_end_4} :catchall_34

    :try_start_4
    iget-object v1, p0, Ld1/a;->b:Ljava/util/Map;

    iget-object v2, p1, Ld1/a$d;->a:La1/d;

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

    iget-boolean v1, p1, Ld1/a$d;->b:Z

    if-eqz v1, :cond_2e

    iget-object v1, p1, Ld1/a$d;->c:Ld1/u;

    if-nez v1, :cond_14

    goto :goto_2e

    :cond_14
    new-instance v1, Ld1/o;

    iget-object v2, p1, Ld1/a$d;->c:Ld1/u;

    const/4 v3, 0x1

    const/4 v4, 0x0

    invoke-direct {v1, v2, v3, v4}, Ld1/o;-><init>(Ld1/u;ZZ)V

    iget-object v2, p1, Ld1/a$d;->a:La1/d;

    iget-object v3, p0, Ld1/a;->d:Ld1/o$a;

    invoke-virtual {v1, v2, v3}, Ld1/o;->a(La1/d;Ld1/o$a;)V

    iget-object v2, p0, Ld1/a;->d:Ld1/o$a;

    iget-object p1, p1, Ld1/a$d;->a:La1/d;

    invoke-interface {v2, p1, v1}, Ld1/o$a;->a(La1/d;Ld1/o;)V

    monitor-exit p0
    :try_end_2c
    .catchall {:try_start_4 .. :try_end_2c} :catchall_31

    :try_start_2c
    monitor-exit v0
    :try_end_2d
    .catchall {:try_start_2c .. :try_end_2d} :catchall_34

    return-void

    :cond_2e
    :goto_2e
    :try_start_2e
    monitor-exit p0
    :try_end_2f
    .catchall {:try_start_2e .. :try_end_2f} :catchall_31

    :try_start_2f
    monitor-exit v0
    :try_end_30
    .catchall {:try_start_2f .. :try_end_30} :catchall_34

    return-void

    :catchall_31
    move-exception p1

    :try_start_32
    monitor-exit p0
    :try_end_33
    .catchall {:try_start_32 .. :try_end_33} :catchall_31

    :try_start_33
    throw p1

    :catchall_34
    move-exception p1

    monitor-exit v0
    :try_end_36
    .catchall {:try_start_33 .. :try_end_36} :catchall_34

    throw p1
.end method

.method public a(Ld1/o$a;)V
    .registers 3

    monitor-enter p1

    :try_start_1
    monitor-enter p0
    :try_end_2
    .catchall {:try_start_1 .. :try_end_2} :catchall_a

    :try_start_2
    iput-object p1, p0, Ld1/a;->d:Ld1/o$a;

    monitor-exit p0
    :try_end_5
    .catchall {:try_start_2 .. :try_end_5} :catchall_7

    :try_start_5
    monitor-exit p1
    :try_end_6
    .catchall {:try_start_5 .. :try_end_6} :catchall_a

    return-void

    :catchall_7
    move-exception v0

    :try_start_8
    monitor-exit p0
    :try_end_9
    .catchall {:try_start_8 .. :try_end_9} :catchall_7

    :try_start_9
    throw v0

    :catchall_a
    move-exception v0

    monitor-exit p1
    :try_end_c
    .catchall {:try_start_9 .. :try_end_c} :catchall_a

    throw v0
.end method

.method public declared-synchronized b(La1/d;)Ld1/o;
    .registers 3
    .annotation build Landroidx/annotation/Nullable;
    .end annotation

    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "La1/d;",
            ")",
            "Ld1/o<",
            "*>;"
        }
    .end annotation

    monitor-enter p0

    :try_start_1
    iget-object v0, p0, Ld1/a;->b:Ljava/util/Map;

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

    move-result-object p1

    check-cast p1, Ld1/a$d;
    :try_end_9
    .catchall {:try_start_1 .. :try_end_9} :catchall_1b

    if-nez p1, :cond_e

    const/4 p1, 0x0

    monitor-exit p0

    return-object p1

    :cond_e
    :try_start_e
    invoke-virtual {p1}, Ljava/lang/ref/WeakReference;->get()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Ld1/o;

    if-nez v0, :cond_19

    invoke-virtual {p0, p1}, Ld1/a;->a(Ld1/a$d;)V
    :try_end_19
    .catchall {:try_start_e .. :try_end_19} :catchall_1b

    :cond_19
    monitor-exit p0

    return-object v0

    :catchall_1b
    move-exception p1

    monitor-exit p0

    throw p1
.end method