517 lines
16 KiB
Smali
517 lines
16 KiB
Smali
.class public Landroidx/work/impl/workers/ConstraintTrackingWorker;
|
|
.super Landroidx/work/ListenableWorker;
|
|
|
|
# interfaces
|
|
.implements Landroidx/work/impl/constraints/WorkConstraintsCallback;
|
|
|
|
|
|
# annotations
|
|
.annotation build Landroidx/annotation/RestrictTo;
|
|
value = {
|
|
.enum Landroidx/annotation/RestrictTo$Scope;->LIBRARY_GROUP:Landroidx/annotation/RestrictTo$Scope;
|
|
}
|
|
.end annotation
|
|
|
|
|
|
# static fields
|
|
.field public static final ARGUMENT_CLASS_NAME:Ljava/lang/String; = "androidx.work.impl.workers.ConstraintTrackingWorker.ARGUMENT_CLASS_NAME"
|
|
|
|
.field private static final TAG:Ljava/lang/String; = "ConstraintTrkngWrkr"
|
|
|
|
|
|
# instance fields
|
|
.field volatile mAreConstraintsUnmet:Z
|
|
|
|
.field private mDelegate:Landroidx/work/ListenableWorker;
|
|
.annotation build Landroidx/annotation/Nullable;
|
|
.end annotation
|
|
.end field
|
|
|
|
.field mFuture:Landroidx/work/impl/utils/futures/SettableFuture;
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"Landroidx/work/impl/utils/futures/SettableFuture<",
|
|
"Landroidx/work/ListenableWorker$Payload;",
|
|
">;"
|
|
}
|
|
.end annotation
|
|
.end field
|
|
|
|
.field final mLock:Ljava/lang/Object;
|
|
|
|
.field private mWorkerParameters:Landroidx/work/WorkerParameters;
|
|
|
|
|
|
# direct methods
|
|
.method public constructor <init>(Landroid/content/Context;Landroidx/work/WorkerParameters;)V
|
|
.locals 0
|
|
.param p1 # Landroid/content/Context;
|
|
.annotation build Landroidx/annotation/NonNull;
|
|
.end annotation
|
|
.end param
|
|
.param p2 # Landroidx/work/WorkerParameters;
|
|
.annotation build Landroidx/annotation/NonNull;
|
|
.end annotation
|
|
.end param
|
|
|
|
invoke-direct {p0, p1, p2}, Landroidx/work/ListenableWorker;-><init>(Landroid/content/Context;Landroidx/work/WorkerParameters;)V
|
|
|
|
iput-object p2, p0, Landroidx/work/impl/workers/ConstraintTrackingWorker;->mWorkerParameters:Landroidx/work/WorkerParameters;
|
|
|
|
new-instance p1, Ljava/lang/Object;
|
|
|
|
invoke-direct {p1}, Ljava/lang/Object;-><init>()V
|
|
|
|
iput-object p1, p0, Landroidx/work/impl/workers/ConstraintTrackingWorker;->mLock:Ljava/lang/Object;
|
|
|
|
const/4 p1, 0x0
|
|
|
|
iput-boolean p1, p0, Landroidx/work/impl/workers/ConstraintTrackingWorker;->mAreConstraintsUnmet:Z
|
|
|
|
invoke-static {}, Landroidx/work/impl/utils/futures/SettableFuture;->create()Landroidx/work/impl/utils/futures/SettableFuture;
|
|
|
|
move-result-object p1
|
|
|
|
iput-object p1, p0, Landroidx/work/impl/workers/ConstraintTrackingWorker;->mFuture:Landroidx/work/impl/utils/futures/SettableFuture;
|
|
|
|
return-void
|
|
.end method
|
|
|
|
|
|
# virtual methods
|
|
.method public getDelegate()Landroidx/work/ListenableWorker;
|
|
.locals 1
|
|
.annotation build Landroidx/annotation/RestrictTo;
|
|
value = {
|
|
.enum Landroidx/annotation/RestrictTo$Scope;->LIBRARY_GROUP:Landroidx/annotation/RestrictTo$Scope;
|
|
}
|
|
.end annotation
|
|
|
|
.annotation build Landroidx/annotation/VisibleForTesting;
|
|
.end annotation
|
|
|
|
iget-object v0, p0, Landroidx/work/impl/workers/ConstraintTrackingWorker;->mDelegate:Landroidx/work/ListenableWorker;
|
|
|
|
return-object v0
|
|
.end method
|
|
|
|
.method public getWorkDatabase()Landroidx/work/impl/WorkDatabase;
|
|
.locals 1
|
|
.annotation build Landroidx/annotation/RestrictTo;
|
|
value = {
|
|
.enum Landroidx/annotation/RestrictTo$Scope;->LIBRARY_GROUP:Landroidx/annotation/RestrictTo$Scope;
|
|
}
|
|
.end annotation
|
|
|
|
.annotation build Landroidx/annotation/VisibleForTesting;
|
|
.end annotation
|
|
|
|
invoke-static {}, Landroidx/work/impl/WorkManagerImpl;->getInstance()Landroidx/work/impl/WorkManagerImpl;
|
|
|
|
move-result-object v0
|
|
|
|
invoke-virtual {v0}, Landroidx/work/impl/WorkManagerImpl;->getWorkDatabase()Landroidx/work/impl/WorkDatabase;
|
|
|
|
move-result-object v0
|
|
|
|
return-object v0
|
|
.end method
|
|
|
|
.method public onAllConstraintsMet(Ljava/util/List;)V
|
|
.locals 0
|
|
.param p1 # Ljava/util/List;
|
|
.annotation build Landroidx/annotation/NonNull;
|
|
.end annotation
|
|
.end param
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"(",
|
|
"Ljava/util/List<",
|
|
"Ljava/lang/String;",
|
|
">;)V"
|
|
}
|
|
.end annotation
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public onAllConstraintsNotMet(Ljava/util/List;)V
|
|
.locals 5
|
|
.param p1 # Ljava/util/List;
|
|
.annotation build Landroidx/annotation/NonNull;
|
|
.end annotation
|
|
.end param
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"(",
|
|
"Ljava/util/List<",
|
|
"Ljava/lang/String;",
|
|
">;)V"
|
|
}
|
|
.end annotation
|
|
|
|
const-string v0, "ConstraintTrkngWrkr"
|
|
|
|
const-string v1, "Constraints changed for %s"
|
|
|
|
const/4 v2, 0x1
|
|
|
|
new-array v3, v2, [Ljava/lang/Object;
|
|
|
|
const/4 v4, 0x0
|
|
|
|
aput-object p1, v3, v4
|
|
|
|
invoke-static {v1, v3}, Ljava/lang/String;->format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;
|
|
|
|
move-result-object p1
|
|
|
|
new-array v1, v4, [Ljava/lang/Throwable;
|
|
|
|
invoke-static {v0, p1, v1}, Landroidx/work/Logger;->debug(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Throwable;)V
|
|
|
|
iget-object p1, p0, Landroidx/work/impl/workers/ConstraintTrackingWorker;->mLock:Ljava/lang/Object;
|
|
|
|
monitor-enter p1
|
|
|
|
:try_start_0
|
|
iput-boolean v2, p0, Landroidx/work/impl/workers/ConstraintTrackingWorker;->mAreConstraintsUnmet:Z
|
|
|
|
monitor-exit p1
|
|
|
|
return-void
|
|
|
|
:catchall_0
|
|
move-exception v0
|
|
|
|
monitor-exit p1
|
|
:try_end_0
|
|
.catchall {:try_start_0 .. :try_end_0} :catchall_0
|
|
|
|
throw v0
|
|
.end method
|
|
|
|
.method public onStopped()V
|
|
.locals 1
|
|
|
|
invoke-super {p0}, Landroidx/work/ListenableWorker;->onStopped()V
|
|
|
|
iget-object v0, p0, Landroidx/work/impl/workers/ConstraintTrackingWorker;->mDelegate:Landroidx/work/ListenableWorker;
|
|
|
|
if-eqz v0, :cond_0
|
|
|
|
iget-object v0, p0, Landroidx/work/impl/workers/ConstraintTrackingWorker;->mDelegate:Landroidx/work/ListenableWorker;
|
|
|
|
invoke-virtual {v0}, Landroidx/work/ListenableWorker;->stop()V
|
|
|
|
:cond_0
|
|
return-void
|
|
.end method
|
|
|
|
.method setFutureFailed()V
|
|
.locals 4
|
|
|
|
iget-object v0, p0, Landroidx/work/impl/workers/ConstraintTrackingWorker;->mFuture:Landroidx/work/impl/utils/futures/SettableFuture;
|
|
|
|
new-instance v1, Landroidx/work/ListenableWorker$Payload;
|
|
|
|
sget-object v2, Landroidx/work/ListenableWorker$Result;->FAILURE:Landroidx/work/ListenableWorker$Result;
|
|
|
|
sget-object v3, Landroidx/work/Data;->EMPTY:Landroidx/work/Data;
|
|
|
|
invoke-direct {v1, v2, v3}, Landroidx/work/ListenableWorker$Payload;-><init>(Landroidx/work/ListenableWorker$Result;Landroidx/work/Data;)V
|
|
|
|
invoke-virtual {v0, v1}, Landroidx/work/impl/utils/futures/SettableFuture;->set(Ljava/lang/Object;)Z
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method setFutureRetry()V
|
|
.locals 4
|
|
|
|
iget-object v0, p0, Landroidx/work/impl/workers/ConstraintTrackingWorker;->mFuture:Landroidx/work/impl/utils/futures/SettableFuture;
|
|
|
|
new-instance v1, Landroidx/work/ListenableWorker$Payload;
|
|
|
|
sget-object v2, Landroidx/work/ListenableWorker$Result;->RETRY:Landroidx/work/ListenableWorker$Result;
|
|
|
|
sget-object v3, Landroidx/work/Data;->EMPTY:Landroidx/work/Data;
|
|
|
|
invoke-direct {v1, v2, v3}, Landroidx/work/ListenableWorker$Payload;-><init>(Landroidx/work/ListenableWorker$Result;Landroidx/work/Data;)V
|
|
|
|
invoke-virtual {v0, v1}, Landroidx/work/impl/utils/futures/SettableFuture;->set(Ljava/lang/Object;)Z
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method setupAndRunConstraintTrackingWork()V
|
|
.locals 7
|
|
|
|
invoke-virtual {p0}, Landroidx/work/impl/workers/ConstraintTrackingWorker;->getInputData()Landroidx/work/Data;
|
|
|
|
move-result-object v0
|
|
|
|
const-string v1, "androidx.work.impl.workers.ConstraintTrackingWorker.ARGUMENT_CLASS_NAME"
|
|
|
|
invoke-virtual {v0, v1}, Landroidx/work/Data;->getString(Ljava/lang/String;)Ljava/lang/String;
|
|
|
|
move-result-object v0
|
|
|
|
invoke-static {v0}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z
|
|
|
|
move-result v1
|
|
|
|
const/4 v2, 0x0
|
|
|
|
if-eqz v1, :cond_0
|
|
|
|
const-string v0, "ConstraintTrkngWrkr"
|
|
|
|
const-string v1, "No worker to delegate to."
|
|
|
|
new-array v2, v2, [Ljava/lang/Throwable;
|
|
|
|
invoke-static {v0, v1, v2}, Landroidx/work/Logger;->error(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Throwable;)V
|
|
|
|
invoke-virtual {p0}, Landroidx/work/impl/workers/ConstraintTrackingWorker;->setFutureFailed()V
|
|
|
|
return-void
|
|
|
|
:cond_0
|
|
invoke-virtual {p0}, Landroidx/work/impl/workers/ConstraintTrackingWorker;->getWorkerFactory()Landroidx/work/WorkerFactory;
|
|
|
|
move-result-object v1
|
|
|
|
invoke-virtual {p0}, Landroidx/work/impl/workers/ConstraintTrackingWorker;->getApplicationContext()Landroid/content/Context;
|
|
|
|
move-result-object v3
|
|
|
|
iget-object v4, p0, Landroidx/work/impl/workers/ConstraintTrackingWorker;->mWorkerParameters:Landroidx/work/WorkerParameters;
|
|
|
|
invoke-virtual {v1, v3, v0, v4}, Landroidx/work/WorkerFactory;->createWorkerWithDefaultFallback(Landroid/content/Context;Ljava/lang/String;Landroidx/work/WorkerParameters;)Landroidx/work/ListenableWorker;
|
|
|
|
move-result-object v1
|
|
|
|
iput-object v1, p0, Landroidx/work/impl/workers/ConstraintTrackingWorker;->mDelegate:Landroidx/work/ListenableWorker;
|
|
|
|
iget-object v1, p0, Landroidx/work/impl/workers/ConstraintTrackingWorker;->mDelegate:Landroidx/work/ListenableWorker;
|
|
|
|
if-nez v1, :cond_1
|
|
|
|
const-string v0, "ConstraintTrkngWrkr"
|
|
|
|
const-string v1, "No worker to delegate to."
|
|
|
|
new-array v2, v2, [Ljava/lang/Throwable;
|
|
|
|
invoke-static {v0, v1, v2}, Landroidx/work/Logger;->debug(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Throwable;)V
|
|
|
|
invoke-virtual {p0}, Landroidx/work/impl/workers/ConstraintTrackingWorker;->setFutureFailed()V
|
|
|
|
return-void
|
|
|
|
:cond_1
|
|
invoke-virtual {p0}, Landroidx/work/impl/workers/ConstraintTrackingWorker;->getWorkDatabase()Landroidx/work/impl/WorkDatabase;
|
|
|
|
move-result-object v1
|
|
|
|
invoke-virtual {v1}, Landroidx/work/impl/WorkDatabase;->workSpecDao()Landroidx/work/impl/model/WorkSpecDao;
|
|
|
|
move-result-object v1
|
|
|
|
invoke-virtual {p0}, Landroidx/work/impl/workers/ConstraintTrackingWorker;->getId()Ljava/util/UUID;
|
|
|
|
move-result-object v3
|
|
|
|
invoke-virtual {v3}, Ljava/util/UUID;->toString()Ljava/lang/String;
|
|
|
|
move-result-object v3
|
|
|
|
invoke-interface {v1, v3}, Landroidx/work/impl/model/WorkSpecDao;->getWorkSpec(Ljava/lang/String;)Landroidx/work/impl/model/WorkSpec;
|
|
|
|
move-result-object v1
|
|
|
|
if-nez v1, :cond_2
|
|
|
|
invoke-virtual {p0}, Landroidx/work/impl/workers/ConstraintTrackingWorker;->setFutureFailed()V
|
|
|
|
return-void
|
|
|
|
:cond_2
|
|
new-instance v3, Landroidx/work/impl/constraints/WorkConstraintsTracker;
|
|
|
|
invoke-virtual {p0}, Landroidx/work/impl/workers/ConstraintTrackingWorker;->getApplicationContext()Landroid/content/Context;
|
|
|
|
move-result-object v4
|
|
|
|
invoke-direct {v3, v4, p0}, Landroidx/work/impl/constraints/WorkConstraintsTracker;-><init>(Landroid/content/Context;Landroidx/work/impl/constraints/WorkConstraintsCallback;)V
|
|
|
|
invoke-static {v1}, Ljava/util/Collections;->singletonList(Ljava/lang/Object;)Ljava/util/List;
|
|
|
|
move-result-object v1
|
|
|
|
invoke-virtual {v3, v1}, Landroidx/work/impl/constraints/WorkConstraintsTracker;->replace(Ljava/util/List;)V
|
|
|
|
invoke-virtual {p0}, Landroidx/work/impl/workers/ConstraintTrackingWorker;->getId()Ljava/util/UUID;
|
|
|
|
move-result-object v1
|
|
|
|
invoke-virtual {v1}, Ljava/util/UUID;->toString()Ljava/lang/String;
|
|
|
|
move-result-object v1
|
|
|
|
invoke-virtual {v3, v1}, Landroidx/work/impl/constraints/WorkConstraintsTracker;->areAllConstraintsMet(Ljava/lang/String;)Z
|
|
|
|
move-result v1
|
|
|
|
const/4 v3, 0x1
|
|
|
|
if-eqz v1, :cond_4
|
|
|
|
const-string v1, "ConstraintTrkngWrkr"
|
|
|
|
const-string v4, "Constraints met for delegate %s"
|
|
|
|
new-array v5, v3, [Ljava/lang/Object;
|
|
|
|
aput-object v0, v5, v2
|
|
|
|
invoke-static {v4, v5}, Ljava/lang/String;->format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;
|
|
|
|
move-result-object v4
|
|
|
|
new-array v5, v2, [Ljava/lang/Throwable;
|
|
|
|
invoke-static {v1, v4, v5}, Landroidx/work/Logger;->debug(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Throwable;)V
|
|
|
|
:try_start_0
|
|
iget-object v1, p0, Landroidx/work/impl/workers/ConstraintTrackingWorker;->mDelegate:Landroidx/work/ListenableWorker;
|
|
|
|
invoke-virtual {v1}, Landroidx/work/ListenableWorker;->startWork()Lcom/google/a/a/a/a;
|
|
|
|
move-result-object v1
|
|
|
|
new-instance v4, Landroidx/work/impl/workers/ConstraintTrackingWorker$2;
|
|
|
|
invoke-direct {v4, p0, v1}, Landroidx/work/impl/workers/ConstraintTrackingWorker$2;-><init>(Landroidx/work/impl/workers/ConstraintTrackingWorker;Lcom/google/a/a/a/a;)V
|
|
|
|
invoke-virtual {p0}, Landroidx/work/impl/workers/ConstraintTrackingWorker;->getBackgroundExecutor()Ljava/util/concurrent/Executor;
|
|
|
|
move-result-object v5
|
|
|
|
invoke-interface {v1, v4, v5}, Lcom/google/a/a/a/a;->addListener(Ljava/lang/Runnable;Ljava/util/concurrent/Executor;)V
|
|
:try_end_0
|
|
.catch Ljava/lang/Throwable; {:try_start_0 .. :try_end_0} :catch_0
|
|
|
|
return-void
|
|
|
|
:catch_0
|
|
move-exception v1
|
|
|
|
const-string v4, "ConstraintTrkngWrkr"
|
|
|
|
const-string v5, "Delegated worker %s threw exception in startWork."
|
|
|
|
new-array v6, v3, [Ljava/lang/Object;
|
|
|
|
aput-object v0, v6, v2
|
|
|
|
invoke-static {v5, v6}, Ljava/lang/String;->format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;
|
|
|
|
move-result-object v0
|
|
|
|
new-array v3, v3, [Ljava/lang/Throwable;
|
|
|
|
aput-object v1, v3, v2
|
|
|
|
invoke-static {v4, v0, v3}, Landroidx/work/Logger;->debug(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Throwable;)V
|
|
|
|
iget-object v1, p0, Landroidx/work/impl/workers/ConstraintTrackingWorker;->mLock:Ljava/lang/Object;
|
|
|
|
monitor-enter v1
|
|
|
|
:try_start_1
|
|
iget-boolean v0, p0, Landroidx/work/impl/workers/ConstraintTrackingWorker;->mAreConstraintsUnmet:Z
|
|
|
|
if-eqz v0, :cond_3
|
|
|
|
const-string v0, "ConstraintTrkngWrkr"
|
|
|
|
const-string v3, "Constraints were unmet, Retrying."
|
|
|
|
new-array v2, v2, [Ljava/lang/Throwable;
|
|
|
|
invoke-static {v0, v3, v2}, Landroidx/work/Logger;->debug(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Throwable;)V
|
|
|
|
invoke-virtual {p0}, Landroidx/work/impl/workers/ConstraintTrackingWorker;->setFutureRetry()V
|
|
|
|
goto :goto_0
|
|
|
|
:cond_3
|
|
invoke-virtual {p0}, Landroidx/work/impl/workers/ConstraintTrackingWorker;->setFutureFailed()V
|
|
|
|
:goto_0
|
|
monitor-exit v1
|
|
|
|
return-void
|
|
|
|
:catchall_0
|
|
move-exception v0
|
|
|
|
monitor-exit v1
|
|
:try_end_1
|
|
.catchall {:try_start_1 .. :try_end_1} :catchall_0
|
|
|
|
throw v0
|
|
|
|
:cond_4
|
|
const-string v1, "ConstraintTrkngWrkr"
|
|
|
|
const-string v4, "Constraints not met for delegate %s. Requesting retry."
|
|
|
|
new-array v3, v3, [Ljava/lang/Object;
|
|
|
|
aput-object v0, v3, v2
|
|
|
|
invoke-static {v4, v3}, Ljava/lang/String;->format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;
|
|
|
|
move-result-object v0
|
|
|
|
new-array v2, v2, [Ljava/lang/Throwable;
|
|
|
|
invoke-static {v1, v0, v2}, Landroidx/work/Logger;->debug(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Throwable;)V
|
|
|
|
invoke-virtual {p0}, Landroidx/work/impl/workers/ConstraintTrackingWorker;->setFutureRetry()V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public startWork()Lcom/google/a/a/a/a;
|
|
.locals 2
|
|
.annotation build Landroidx/annotation/NonNull;
|
|
.end annotation
|
|
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"()",
|
|
"Lcom/google/a/a/a/a<",
|
|
"Landroidx/work/ListenableWorker$Payload;",
|
|
">;"
|
|
}
|
|
.end annotation
|
|
|
|
invoke-virtual {p0}, Landroidx/work/impl/workers/ConstraintTrackingWorker;->getBackgroundExecutor()Ljava/util/concurrent/Executor;
|
|
|
|
move-result-object v0
|
|
|
|
new-instance v1, Landroidx/work/impl/workers/ConstraintTrackingWorker$1;
|
|
|
|
invoke-direct {v1, p0}, Landroidx/work/impl/workers/ConstraintTrackingWorker$1;-><init>(Landroidx/work/impl/workers/ConstraintTrackingWorker;)V
|
|
|
|
invoke-interface {v0, v1}, Ljava/util/concurrent/Executor;->execute(Ljava/lang/Runnable;)V
|
|
|
|
iget-object v0, p0, Landroidx/work/impl/workers/ConstraintTrackingWorker;->mFuture:Landroidx/work/impl/utils/futures/SettableFuture;
|
|
|
|
return-object v0
|
|
.end method
|