i.smali

.class public Ld0/i;
.super Ljava/lang/Thread;
.source "NetworkDispatcher.java"


# instance fields
.field public final a:Ljava/util/concurrent/BlockingQueue;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/concurrent/BlockingQueue<",
            "Lcom/android/volley/Request<",
            "*>;>;"
        }
    .end annotation
.end field

.field public final b:Ld0/h;

.field public final c:Ld0/b;

.field public final d:Ld0/p;

.field public volatile e:Z


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

    return-void
.end method

.method public constructor <init>(Ljava/util/concurrent/BlockingQueue;Ld0/h;Ld0/b;Ld0/p;)V
    .registers 6
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Ljava/util/concurrent/BlockingQueue<",
            "Lcom/android/volley/Request<",
            "*>;>;",
            "Ld0/h;",
            "Ld0/b;",
            "Ld0/p;",
            ")V"
        }
    .end annotation

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

    const/4 v0, 0x0

    iput-boolean v0, p0, Ld0/i;->e:Z

    iput-object p1, p0, Ld0/i;->a:Ljava/util/concurrent/BlockingQueue;

    iput-object p2, p0, Ld0/i;->b:Ld0/h;

    iput-object p3, p0, Ld0/i;->c:Ld0/b;

    iput-object p4, p0, Ld0/i;->d:Ld0/p;

    return-void
.end method


# virtual methods
.method public final a()V
    .registers 2
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/lang/InterruptedException;
        }
    .end annotation

    iget-object v0, p0, Ld0/i;->a:Ljava/util/concurrent/BlockingQueue;

    invoke-interface {v0}, Ljava/util/concurrent/BlockingQueue;->take()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/android/volley/Request;

    invoke-virtual {p0, v0}, Ld0/i;->b(Lcom/android/volley/Request;)V

    return-void
.end method

.method public final a(Lcom/android/volley/Request;)V
    .registers 4
    .annotation build Landroid/annotation/TargetApi;
        value = 0xe
    .end annotation

    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Lcom/android/volley/Request<",
            "*>;)V"
        }
    .end annotation

    sget v0, Landroid/os/Build$VERSION;->SDK_INT:I

    const/16 v1, 0xe

    if-lt v0, v1, :cond_d

    invoke-virtual {p1}, Lcom/android/volley/Request;->getTrafficStatsTag()I

    move-result p1

    invoke-static {p1}, Landroid/net/TrafficStats;->setThreadStatsTag(I)V

    :cond_d
    return-void
.end method

.method public final a(Lcom/android/volley/Request;Ld0/t;)V
    .registers 4
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Lcom/android/volley/Request<",
            "*>;",
            "Ld0/t;",
            ")V"
        }
    .end annotation

    invoke-virtual {p1, p2}, Lcom/android/volley/Request;->parseNetworkError(Ld0/t;)Ld0/t;

    move-result-object p2

    iget-object v0, p0, Ld0/i;->d:Ld0/p;

    invoke-interface {v0, p1, p2}, Ld0/p;->a(Lcom/android/volley/Request;Ld0/t;)V

    return-void
.end method

.method public b()V
    .registers 2

    const/4 v0, 0x1

    iput-boolean v0, p0, Ld0/i;->e:Z

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

    return-void
.end method

.method public b(Lcom/android/volley/Request;)V
    .registers 8
    .annotation build Landroidx/annotation/VisibleForTesting;
    .end annotation

    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Lcom/android/volley/Request<",
            "*>;)V"
        }
    .end annotation

    invoke-static {}, Landroid/os/SystemClock;->elapsedRealtime()J

    move-result-wide v0

    :try_start_4
    const-string v2, "network-queue-take"

    invoke-virtual {p1, v2}, Lcom/android/volley/Request;->addMarker(Ljava/lang/String;)V

    invoke-virtual {p1}, Lcom/android/volley/Request;->isCanceled()Z

    move-result v2

    if-eqz v2, :cond_18

    const-string v2, "network-discard-cancelled"

    invoke-virtual {p1, v2}, Lcom/android/volley/Request;->finish(Ljava/lang/String;)V

    invoke-virtual {p1}, Lcom/android/volley/Request;->notifyListenerResponseNotUsable()V

    return-void

    :cond_18
    invoke-virtual {p0, p1}, Ld0/i;->a(Lcom/android/volley/Request;)V

    iget-object v2, p0, Ld0/i;->b:Ld0/h;

    invoke-interface {v2, p1}, Ld0/h;->a(Lcom/android/volley/Request;)Ld0/k;

    move-result-object v2

    const-string v3, "network-http-complete"

    invoke-virtual {p1, v3}, Lcom/android/volley/Request;->addMarker(Ljava/lang/String;)V

    iget-boolean v3, v2, Ld0/k;->e:Z

    if-eqz v3, :cond_39

    invoke-virtual {p1}, Lcom/android/volley/Request;->hasHadResponseDelivered()Z

    move-result v3

    if-eqz v3, :cond_39

    const-string v2, "not-modified"

    invoke-virtual {p1, v2}, Lcom/android/volley/Request;->finish(Ljava/lang/String;)V

    invoke-virtual {p1}, Lcom/android/volley/Request;->notifyListenerResponseNotUsable()V

    return-void

    :cond_39
    invoke-virtual {p1, v2}, Lcom/android/volley/Request;->parseNetworkResponse(Ld0/k;)Ld0/o;

    move-result-object v2

    const-string v3, "network-parse-complete"

    invoke-virtual {p1, v3}, Lcom/android/volley/Request;->addMarker(Ljava/lang/String;)V

    invoke-virtual {p1}, Lcom/android/volley/Request;->shouldCache()Z

    move-result v3

    if-eqz v3, :cond_5c

    iget-object v3, v2, Ld0/o;->b:Ld0/b$a;

    if-eqz v3, :cond_5c

    iget-object v3, p0, Ld0/i;->c:Ld0/b;

    invoke-virtual {p1}, Lcom/android/volley/Request;->getCacheKey()Ljava/lang/String;

    move-result-object v4

    iget-object v5, v2, Ld0/o;->b:Ld0/b$a;

    invoke-interface {v3, v4, v5}, Ld0/b;->a(Ljava/lang/String;Ld0/b$a;)V

    const-string v3, "network-cache-written"

    invoke-virtual {p1, v3}, Lcom/android/volley/Request;->addMarker(Ljava/lang/String;)V

    :cond_5c
    invoke-virtual {p1}, Lcom/android/volley/Request;->markDelivered()V

    iget-object v3, p0, Ld0/i;->d:Ld0/p;

    invoke-interface {v3, p1, v2}, Ld0/p;->a(Lcom/android/volley/Request;Ld0/o;)V

    invoke-virtual {p1, v2}, Lcom/android/volley/Request;->notifyListenerResponseReceived(Ld0/o;)V
    :try_end_67
    .catch Ld0/t; {:try_start_4 .. :try_end_67} :catch_8e
    .catch Ljava/lang/Exception; {:try_start_4 .. :try_end_67} :catch_68

    goto :goto_9d

    :catch_68
    move-exception v2

    const/4 v3, 0x1

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

    const/4 v4, 0x0

    invoke-virtual {v2}, Ljava/lang/Exception;->toString()Ljava/lang/String;

    move-result-object v5

    aput-object v5, v3, v4

    const-string v4, "Unhandled exception %s"

    invoke-static {v2, v4, v3}, Ld0/u;->a(Ljava/lang/Throwable;Ljava/lang/String;[Ljava/lang/Object;)V

    new-instance v3, Ld0/t;

    invoke-direct {v3, v2}, Ld0/t;-><init>(Ljava/lang/Throwable;)V

    invoke-static {}, Landroid/os/SystemClock;->elapsedRealtime()J

    move-result-wide v4

    sub-long/2addr v4, v0

    invoke-virtual {v3, v4, v5}, Ld0/t;->a(J)V

    iget-object v0, p0, Ld0/i;->d:Ld0/p;

    invoke-interface {v0, p1, v3}, Ld0/p;->a(Lcom/android/volley/Request;Ld0/t;)V

    invoke-virtual {p1}, Lcom/android/volley/Request;->notifyListenerResponseNotUsable()V

    goto :goto_9d

    :catch_8e
    move-exception v2

    invoke-static {}, Landroid/os/SystemClock;->elapsedRealtime()J

    move-result-wide v3

    sub-long/2addr v3, v0

    invoke-virtual {v2, v3, v4}, Ld0/t;->a(J)V

    invoke-virtual {p0, p1, v2}, Ld0/i;->a(Lcom/android/volley/Request;Ld0/t;)V

    invoke-virtual {p1}, Lcom/android/volley/Request;->notifyListenerResponseNotUsable()V

    :goto_9d
    return-void
.end method

.method public run()V
    .registers 3

    const/16 v0, 0xa

    invoke-static {v0}, Landroid/os/Process;->setThreadPriority(I)V

    :goto_5
    :try_start_5
    invoke-virtual {p0}, Ld0/i;->a()V
    :try_end_8
    .catch Ljava/lang/InterruptedException; {:try_start_5 .. :try_end_8} :catch_9

    goto :goto_5

    :catch_9
    iget-boolean v0, p0, Ld0/i;->e:Z

    if-eqz v0, :cond_15

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

    move-result-object v0

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

    return-void

    :cond_15
    const/4 v0, 0x0

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

    const-string v1, "Ignoring spurious interrupt of NetworkDispatcher thread; use quit() to terminate it"

    invoke-static {v1, v0}, Ld0/u;->c(Ljava/lang/String;[Ljava/lang/Object;)V

    goto :goto_5
.end method