.class public Ln1/c;
.super Ljava/lang/Object;
.source ""

# interfaces
.implements Lm1/d;
.implements Lq1/c;
.implements Lm1/a;


# static fields
.field public static final z:Ljava/lang/String;


# instance fields
.field public final r:Landroid/content/Context;

.field public final s:Lm1/j;

.field public final t:Lq1/d;

.field public final u:Ljava/util/Set;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/Set<",
            "Lu1/p;",
            ">;"
        }
    .end annotation
.end field

.field public v:Ln1/b;

.field public w:Z

.field public final x:Ljava/lang/Object;

.field public y:Ljava/lang/Boolean;


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

    const-string v0, "GreedyScheduler"

    invoke-static {v0}, Ll1/i;->e(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    sput-object v0, Ln1/c;->z:Ljava/lang/String;

    return-void
.end method

.method public constructor <init>(Landroid/content/Context;Landroidx/work/b;Lx1/a;Lm1/j;)V
    .registers 6

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

    new-instance v0, Ljava/util/HashSet;

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

    iput-object v0, p0, Ln1/c;->u:Ljava/util/Set;

    iput-object p1, p0, Ln1/c;->r:Landroid/content/Context;

    iput-object p4, p0, Ln1/c;->s:Lm1/j;

    new-instance p4, Lq1/d;

    invoke-direct {p4, p1, p3, p0}, Lq1/d;-><init>(Landroid/content/Context;Lx1/a;Lq1/c;)V

    iput-object p4, p0, Ln1/c;->t:Lq1/d;

    new-instance p1, Ln1/b;

    .line 1
    iget-object p2, p2, Landroidx/work/b;->e:Lf/o;

    .line 2
    invoke-direct {p1, p0, p2}, Ln1/b;-><init>(Ln1/c;Lf/o;)V

    iput-object p1, p0, Ln1/c;->v:Ln1/b;

    new-instance p1, Ljava/lang/Object;

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

    iput-object p1, p0, Ln1/c;->x:Ljava/lang/Object;

    return-void
.end method


# virtual methods
.method public a(Ljava/lang/String;Z)V
    .registers 9

    .line 1
    iget-object p2, p0, Ln1/c;->x:Ljava/lang/Object;

    monitor-enter p2

    :try_start_3
    iget-object v0, p0, Ln1/c;->u:Ljava/util/Set;

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

    move-result-object v0

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

    move-result v1

    if-eqz v1, :cond_40

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

    move-result-object v1

    check-cast v1, Lu1/p;

    iget-object v2, v1, Lu1/p;->a:Ljava/lang/String;

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

    move-result v2

    if-eqz v2, :cond_9

    invoke-static {}, Ll1/i;->c()Ll1/i;

    move-result-object v0

    sget-object v2, Ln1/c;->z:Ljava/lang/String;

    const-string v3, "Stopping tracking for %s"

    const/4 v4, 0x1

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

    const/4 v5, 0x0

    aput-object p1, v4, v5

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

    move-result-object p1

    new-array v3, v5, [Ljava/lang/Throwable;

    invoke-virtual {v0, v2, p1, v3}, Ll1/i;->a(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Throwable;)V

    iget-object p1, p0, Ln1/c;->u:Ljava/util/Set;

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

    iget-object p1, p0, Ln1/c;->t:Lq1/d;

    iget-object v0, p0, Ln1/c;->u:Ljava/util/Set;

    invoke-virtual {p1, v0}, Lq1/d;->b(Ljava/lang/Iterable;)V

    :cond_40
    monitor-exit p2

    return-void

    :catchall_42
    move-exception p1

    monitor-exit p2
    :try_end_44
    .catchall {:try_start_3 .. :try_end_44} :catchall_42

    throw p1
.end method

.method public b(Ljava/lang/String;)V
    .registers 7

    iget-object v0, p0, Ln1/c;->y:Ljava/lang/Boolean;

    if-nez v0, :cond_14

    .line 1
    iget-object v0, p0, Ln1/c;->s:Lm1/j;

    .line 2
    iget-object v0, v0, Lm1/j;->b:Landroidx/work/b;

    .line 3
    iget-object v1, p0, Ln1/c;->r:Landroid/content/Context;

    invoke-static {v1, v0}, Lv1/i;->a(Landroid/content/Context;Landroidx/work/b;)Z

    move-result v0

    invoke-static {v0}, Ljava/lang/Boolean;->valueOf(Z)Ljava/lang/Boolean;

    move-result-object v0

    iput-object v0, p0, Ln1/c;->y:Ljava/lang/Boolean;

    .line 4
    :cond_14
    iget-object v0, p0, Ln1/c;->y:Ljava/lang/Boolean;

    invoke-virtual {v0}, Ljava/lang/Boolean;->booleanValue()Z

    move-result v0

    const/4 v1, 0x0

    if-nez v0, :cond_2b

    invoke-static {}, Ll1/i;->c()Ll1/i;

    move-result-object p1

    sget-object v0, Ln1/c;->z:Ljava/lang/String;

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

    const-string v2, "Ignoring schedule request in non-main process"

    invoke-virtual {p1, v0, v2, v1}, Ll1/i;->d(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Throwable;)V

    return-void

    .line 5
    :cond_2b
    iget-boolean v0, p0, Ln1/c;->w:Z

    const/4 v2, 0x1

    if-nez v0, :cond_39

    iget-object v0, p0, Ln1/c;->s:Lm1/j;

    .line 6
    iget-object v0, v0, Lm1/j;->f:Lm1/c;

    .line 7
    invoke-virtual {v0, p0}, Lm1/c;->b(Lm1/a;)V

    iput-boolean v2, p0, Ln1/c;->w:Z

    .line 8
    :cond_39
    invoke-static {}, Ll1/i;->c()Ll1/i;

    move-result-object v0

    sget-object v3, Ln1/c;->z:Ljava/lang/String;

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

    aput-object p1, v2, v1

    const-string v4, "Cancelling work ID %s"

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

    move-result-object v2

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

    invoke-virtual {v0, v3, v2, v1}, Ll1/i;->a(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Throwable;)V

    iget-object v0, p0, Ln1/c;->v:Ln1/b;

    if-eqz v0, :cond_65

    .line 9
    iget-object v1, v0, Ln1/b;->c:Ljava/util/Map;

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

    move-result-object v1

    check-cast v1, Ljava/lang/Runnable;

    if-eqz v1, :cond_65

    iget-object v0, v0, Ln1/b;->b:Lf/o;

    .line 10
    iget-object v0, v0, Lf/o;->s:Ljava/lang/Object;

    check-cast v0, Landroid/os/Handler;

    invoke-virtual {v0, v1}, Landroid/os/Handler;->removeCallbacks(Ljava/lang/Runnable;)V

    .line 11
    :cond_65
    iget-object v0, p0, Ln1/c;->s:Lm1/j;

    invoke-virtual {v0, p1}, Lm1/j;->f(Ljava/lang/String;)V

    return-void
.end method

.method public varargs c([Lu1/p;)V
    .registers 15

    iget-object v0, p0, Ln1/c;->y:Ljava/lang/Boolean;

    if-nez v0, :cond_14

    .line 1
    iget-object v0, p0, Ln1/c;->s:Lm1/j;

    .line 2
    iget-object v0, v0, Lm1/j;->b:Landroidx/work/b;

    .line 3
    iget-object v1, p0, Ln1/c;->r:Landroid/content/Context;

    invoke-static {v1, v0}, Lv1/i;->a(Landroid/content/Context;Landroidx/work/b;)Z

    move-result v0

    invoke-static {v0}, Ljava/lang/Boolean;->valueOf(Z)Ljava/lang/Boolean;

    move-result-object v0

    iput-object v0, p0, Ln1/c;->y:Ljava/lang/Boolean;

    .line 4
    :cond_14
    iget-object v0, p0, Ln1/c;->y:Ljava/lang/Boolean;

    invoke-virtual {v0}, Ljava/lang/Boolean;->booleanValue()Z

    move-result v0

    const/4 v1, 0x0

    if-nez v0, :cond_2b

    invoke-static {}, Ll1/i;->c()Ll1/i;

    move-result-object p1

    sget-object v0, Ln1/c;->z:Ljava/lang/String;

    const-string v2, "Ignoring schedule request in a secondary process"

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

    invoke-virtual {p1, v0, v2, v1}, Ll1/i;->d(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Throwable;)V

    return-void

    .line 5
    :cond_2b
    iget-boolean v0, p0, Ln1/c;->w:Z

    const/4 v2, 0x1

    if-nez v0, :cond_39

    iget-object v0, p0, Ln1/c;->s:Lm1/j;

    .line 6
    iget-object v0, v0, Lm1/j;->f:Lm1/c;

    .line 7
    invoke-virtual {v0, p0}, Lm1/c;->b(Lm1/a;)V

    iput-boolean v2, p0, Ln1/c;->w:Z

    .line 8
    :cond_39
    new-instance v0, Ljava/util/HashSet;

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

    new-instance v3, Ljava/util/HashSet;

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

    array-length v4, p1

    move v5, v1

    :goto_45
    if-ge v5, v4, :cond_108

    aget-object v6, p1, v5

    invoke-virtual {v6}, Lu1/p;->a()J

    move-result-wide v7

    invoke-static {}, Ljava/lang/System;->currentTimeMillis()J

    move-result-wide v9

    iget-object v11, v6, Lu1/p;->b:Landroidx/work/f;

    sget-object v12, Landroidx/work/f;->r:Landroidx/work/f;

    if-ne v11, v12, :cond_104

    cmp-long v7, v9, v7

    if-gez v7, :cond_93

    iget-object v7, p0, Ln1/c;->v:Ln1/b;

    if-eqz v7, :cond_104

    .line 9
    iget-object v8, v7, Ln1/b;->c:Ljava/util/Map;

    iget-object v9, v6, Lu1/p;->a:Ljava/lang/String;

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

    move-result-object v8

    check-cast v8, Ljava/lang/Runnable;

    if-eqz v8, :cond_74

    iget-object v9, v7, Ln1/b;->b:Lf/o;

    .line 10
    iget-object v9, v9, Lf/o;->s:Ljava/lang/Object;

    check-cast v9, Landroid/os/Handler;

    invoke-virtual {v9, v8}, Landroid/os/Handler;->removeCallbacks(Ljava/lang/Runnable;)V

    .line 11
    :cond_74
    new-instance v8, Ln1/a;

    invoke-direct {v8, v7, v6}, Ln1/a;-><init>(Ln1/b;Lu1/p;)V

    iget-object v9, v7, Ln1/b;->c:Ljava/util/Map;

    iget-object v10, v6, Lu1/p;->a:Ljava/lang/String;

    invoke-interface {v9, v10, v8}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;

    invoke-static {}, Ljava/lang/System;->currentTimeMillis()J

    move-result-wide v9

    invoke-virtual {v6}, Lu1/p;->a()J

    move-result-wide v11

    sub-long/2addr v11, v9

    iget-object v6, v7, Ln1/b;->b:Lf/o;

    .line 12
    iget-object v6, v6, Lf/o;->s:Ljava/lang/Object;

    check-cast v6, Landroid/os/Handler;

    invoke-virtual {v6, v8, v11, v12}, Landroid/os/Handler;->postDelayed(Ljava/lang/Runnable;J)Z

    goto :goto_104

    .line 13
    :cond_93
    invoke-virtual {v6}, Lu1/p;->b()Z

    move-result v7

    if-eqz v7, :cond_da

    iget-object v7, v6, Lu1/p;->j:Ll1/b;

    .line 14
    iget-boolean v8, v7, Ll1/b;->c:Z

    if-eqz v8, :cond_b5

    .line 15
    invoke-static {}, Ll1/i;->c()Ll1/i;

    move-result-object v7

    sget-object v8, Ln1/c;->z:Ljava/lang/String;

    const-string v9, "Ignoring WorkSpec %s, Requires device idle."

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

    aput-object v6, v10, v1

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

    move-result-object v6

    new-array v9, v1, [Ljava/lang/Throwable;

    invoke-virtual {v7, v8, v6, v9}, Ll1/i;->a(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Throwable;)V

    goto :goto_104

    :cond_b5
    invoke-virtual {v7}, Ll1/b;->a()Z

    move-result v7

    if-eqz v7, :cond_d1

    invoke-static {}, Ll1/i;->c()Ll1/i;

    move-result-object v7

    sget-object v8, Ln1/c;->z:Ljava/lang/String;

    const-string v9, "Ignoring WorkSpec %s, Requires ContentUri triggers."

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

    aput-object v6, v10, v1

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

    move-result-object v6

    new-array v9, v1, [Ljava/lang/Throwable;

    invoke-virtual {v7, v8, v6, v9}, Ll1/i;->a(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Throwable;)V

    goto :goto_104

    :cond_d1
    invoke-virtual {v0, v6}, Ljava/util/HashSet;->add(Ljava/lang/Object;)Z

    iget-object v6, v6, Lu1/p;->a:Ljava/lang/String;

    invoke-virtual {v3, v6}, Ljava/util/HashSet;->add(Ljava/lang/Object;)Z

    goto :goto_104

    :cond_da
    invoke-static {}, Ll1/i;->c()Ll1/i;

    move-result-object v7

    sget-object v8, Ln1/c;->z:Ljava/lang/String;

    const-string v9, "Starting work for %s"

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

    iget-object v11, v6, Lu1/p;->a:Ljava/lang/String;

    aput-object v11, v10, v1

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

    move-result-object v9

    new-array v10, v1, [Ljava/lang/Throwable;

    invoke-virtual {v7, v8, v9, v10}, Ll1/i;->a(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Throwable;)V

    iget-object v7, p0, Ln1/c;->s:Lm1/j;

    iget-object v6, v6, Lu1/p;->a:Ljava/lang/String;

    .line 16
    iget-object v8, v7, Lm1/j;->d:Lx1/a;

    new-instance v9, Lv1/k;

    const/4 v10, 0x0

    invoke-direct {v9, v7, v6, v10}, Lv1/k;-><init>(Lm1/j;Ljava/lang/String;Landroidx/work/WorkerParameters$a;)V

    check-cast v8, Lx1/b;

    .line 17
    iget-object v6, v8, Lx1/b;->a:Lv1/j;

    invoke-virtual {v6, v9}, Lv1/j;->execute(Ljava/lang/Runnable;)V

    :cond_104
    :goto_104
    add-int/lit8 v5, v5, 0x1

    goto/16 :goto_45

    .line 18
    :cond_108
    iget-object p1, p0, Ln1/c;->x:Ljava/lang/Object;

    monitor-enter p1

    :try_start_10b
    invoke-virtual {v0}, Ljava/util/HashSet;->isEmpty()Z

    move-result v4

    if-nez v4, :cond_138

    invoke-static {}, Ll1/i;->c()Ll1/i;

    move-result-object v4

    sget-object v5, Ln1/c;->z:Ljava/lang/String;

    const-string v6, "Starting tracking for [%s]"

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

    const-string v7, ","

    invoke-static {v7, v3}, Landroid/text/TextUtils;->join(Ljava/lang/CharSequence;Ljava/lang/Iterable;)Ljava/lang/String;

    move-result-object v3

    aput-object v3, v2, v1

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

    move-result-object v2

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

    invoke-virtual {v4, v5, v2, v1}, Ll1/i;->a(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Throwable;)V

    iget-object v1, p0, Ln1/c;->u:Ljava/util/Set;

    invoke-interface {v1, v0}, Ljava/util/Set;->addAll(Ljava/util/Collection;)Z

    iget-object v0, p0, Ln1/c;->t:Lq1/d;

    iget-object v1, p0, Ln1/c;->u:Ljava/util/Set;

    invoke-virtual {v0, v1}, Lq1/d;->b(Ljava/lang/Iterable;)V

    :cond_138
    monitor-exit p1

    return-void

    :catchall_13a
    move-exception v0

    monitor-exit p1
    :try_end_13c
    .catchall {:try_start_10b .. :try_end_13c} :catchall_13a

    throw v0
.end method

.method public d(Ljava/util/List;)V
    .registers 8
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Ljava/util/List<",
            "Ljava/lang/String;",
            ">;)V"
        }
    .end annotation

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

    move-result-object p1

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

    move-result v0

    if-eqz v0, :cond_2d

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

    move-result-object v0

    check-cast v0, Ljava/lang/String;

    invoke-static {}, Ll1/i;->c()Ll1/i;

    move-result-object v1

    sget-object v2, Ln1/c;->z:Ljava/lang/String;

    const/4 v3, 0x1

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

    const/4 v4, 0x0

    aput-object v0, v3, v4

    const-string v5, "Constraints not met: Cancelling work ID %s"

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

    move-result-object v3

    new-array v4, v4, [Ljava/lang/Throwable;

    invoke-virtual {v1, v2, v3, v4}, Ll1/i;->a(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Throwable;)V

    iget-object v1, p0, Ln1/c;->s:Lm1/j;

    invoke-virtual {v1, v0}, Lm1/j;->f(Ljava/lang/String;)V

    goto :goto_4

    :cond_2d
    return-void
.end method

.method public e(Ljava/util/List;)V
    .registers 8
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Ljava/util/List<",
            "Ljava/lang/String;",
            ">;)V"
        }
    .end annotation

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

    move-result-object p1

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

    move-result v0

    if-eqz v0, :cond_39

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

    move-result-object v0

    check-cast v0, Ljava/lang/String;

    invoke-static {}, Ll1/i;->c()Ll1/i;

    move-result-object v1

    sget-object v2, Ln1/c;->z:Ljava/lang/String;

    const/4 v3, 0x1

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

    const/4 v4, 0x0

    aput-object v0, v3, v4

    const-string v5, "Constraints met: Scheduling work ID %s"

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

    move-result-object v3

    new-array v4, v4, [Ljava/lang/Throwable;

    invoke-virtual {v1, v2, v3, v4}, Ll1/i;->a(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Throwable;)V

    iget-object v1, p0, Ln1/c;->s:Lm1/j;

    .line 1
    iget-object v2, v1, Lm1/j;->d:Lx1/a;

    new-instance v3, Lv1/k;

    const/4 v4, 0x0

    invoke-direct {v3, v1, v0, v4}, Lv1/k;-><init>(Lm1/j;Ljava/lang/String;Landroidx/work/WorkerParameters$a;)V

    check-cast v2, Lx1/b;

    .line 2
    iget-object v0, v2, Lx1/b;->a:Lv1/j;

    invoke-virtual {v0, v3}, Lv1/j;->execute(Ljava/lang/Runnable;)V

    goto :goto_4

    :cond_39
    return-void
.end method

.method public f()Z
    .registers 2

    const/4 v0, 0x0

    return v0
.end method
