apkfuckery/com.discord/smali/androidx/loader/content/ModernAsyncTask.smali
2019-02-04 21:08:30 +01:00

587 lines
18 KiB
Smali

.class abstract Landroidx/loader/content/ModernAsyncTask;
.super Ljava/lang/Object;
# annotations
.annotation system Ldalvik/annotation/MemberClasses;
value = {
Landroidx/loader/content/ModernAsyncTask$AsyncTaskResult;,
Landroidx/loader/content/ModernAsyncTask$WorkerRunnable;,
Landroidx/loader/content/ModernAsyncTask$InternalHandler;,
Landroidx/loader/content/ModernAsyncTask$Status;
}
.end annotation
.annotation system Ldalvik/annotation/Signature;
value = {
"<Params:",
"Ljava/lang/Object;",
"Progress:",
"Ljava/lang/Object;",
"Result:",
"Ljava/lang/Object;",
">",
"Ljava/lang/Object;"
}
.end annotation
# static fields
.field private static final CORE_POOL_SIZE:I = 0x5
.field private static final KEEP_ALIVE:I = 0x1
.field private static final LOG_TAG:Ljava/lang/String; = "AsyncTask"
.field private static final MAXIMUM_POOL_SIZE:I = 0x80
.field private static final MESSAGE_POST_PROGRESS:I = 0x2
.field private static final MESSAGE_POST_RESULT:I = 0x1
.field public static final THREAD_POOL_EXECUTOR:Ljava/util/concurrent/Executor;
.field private static volatile sDefaultExecutor:Ljava/util/concurrent/Executor;
.field private static sHandler:Landroidx/loader/content/ModernAsyncTask$InternalHandler;
.field private static final sPoolWorkQueue:Ljava/util/concurrent/BlockingQueue;
.annotation system Ldalvik/annotation/Signature;
value = {
"Ljava/util/concurrent/BlockingQueue<",
"Ljava/lang/Runnable;",
">;"
}
.end annotation
.end field
.field private static final sThreadFactory:Ljava/util/concurrent/ThreadFactory;
# instance fields
.field final mCancelled:Ljava/util/concurrent/atomic/AtomicBoolean;
.field private final mFuture:Ljava/util/concurrent/FutureTask;
.annotation system Ldalvik/annotation/Signature;
value = {
"Ljava/util/concurrent/FutureTask<",
"TResult;>;"
}
.end annotation
.end field
.field private volatile mStatus:Landroidx/loader/content/ModernAsyncTask$Status;
.field final mTaskInvoked:Ljava/util/concurrent/atomic/AtomicBoolean;
.field private final mWorker:Landroidx/loader/content/ModernAsyncTask$WorkerRunnable;
.annotation system Ldalvik/annotation/Signature;
value = {
"Landroidx/loader/content/ModernAsyncTask$WorkerRunnable<",
"TParams;TResult;>;"
}
.end annotation
.end field
# direct methods
.method static constructor <clinit>()V
.locals 10
new-instance v0, Landroidx/loader/content/ModernAsyncTask$1;
invoke-direct {v0}, Landroidx/loader/content/ModernAsyncTask$1;-><init>()V
sput-object v0, Landroidx/loader/content/ModernAsyncTask;->sThreadFactory:Ljava/util/concurrent/ThreadFactory;
new-instance v0, Ljava/util/concurrent/LinkedBlockingQueue;
const/16 v1, 0xa
invoke-direct {v0, v1}, Ljava/util/concurrent/LinkedBlockingQueue;-><init>(I)V
sput-object v0, Landroidx/loader/content/ModernAsyncTask;->sPoolWorkQueue:Ljava/util/concurrent/BlockingQueue;
new-instance v0, Ljava/util/concurrent/ThreadPoolExecutor;
sget-object v7, Ljava/util/concurrent/TimeUnit;->SECONDS:Ljava/util/concurrent/TimeUnit;
sget-object v8, Landroidx/loader/content/ModernAsyncTask;->sPoolWorkQueue:Ljava/util/concurrent/BlockingQueue;
sget-object v9, Landroidx/loader/content/ModernAsyncTask;->sThreadFactory:Ljava/util/concurrent/ThreadFactory;
const/4 v3, 0x5
const/16 v4, 0x80
const-wide/16 v5, 0x1
move-object v2, v0
invoke-direct/range {v2 .. v9}, Ljava/util/concurrent/ThreadPoolExecutor;-><init>(IIJLjava/util/concurrent/TimeUnit;Ljava/util/concurrent/BlockingQueue;Ljava/util/concurrent/ThreadFactory;)V
sput-object v0, Landroidx/loader/content/ModernAsyncTask;->THREAD_POOL_EXECUTOR:Ljava/util/concurrent/Executor;
sput-object v0, Landroidx/loader/content/ModernAsyncTask;->sDefaultExecutor:Ljava/util/concurrent/Executor;
return-void
.end method
.method constructor <init>()V
.locals 2
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
sget-object v0, Landroidx/loader/content/ModernAsyncTask$Status;->PENDING:Landroidx/loader/content/ModernAsyncTask$Status;
iput-object v0, p0, Landroidx/loader/content/ModernAsyncTask;->mStatus:Landroidx/loader/content/ModernAsyncTask$Status;
new-instance v0, Ljava/util/concurrent/atomic/AtomicBoolean;
invoke-direct {v0}, Ljava/util/concurrent/atomic/AtomicBoolean;-><init>()V
iput-object v0, p0, Landroidx/loader/content/ModernAsyncTask;->mCancelled:Ljava/util/concurrent/atomic/AtomicBoolean;
new-instance v0, Ljava/util/concurrent/atomic/AtomicBoolean;
invoke-direct {v0}, Ljava/util/concurrent/atomic/AtomicBoolean;-><init>()V
iput-object v0, p0, Landroidx/loader/content/ModernAsyncTask;->mTaskInvoked:Ljava/util/concurrent/atomic/AtomicBoolean;
new-instance v0, Landroidx/loader/content/ModernAsyncTask$2;
invoke-direct {v0, p0}, Landroidx/loader/content/ModernAsyncTask$2;-><init>(Landroidx/loader/content/ModernAsyncTask;)V
iput-object v0, p0, Landroidx/loader/content/ModernAsyncTask;->mWorker:Landroidx/loader/content/ModernAsyncTask$WorkerRunnable;
new-instance v0, Landroidx/loader/content/ModernAsyncTask$3;
iget-object v1, p0, Landroidx/loader/content/ModernAsyncTask;->mWorker:Landroidx/loader/content/ModernAsyncTask$WorkerRunnable;
invoke-direct {v0, p0, v1}, Landroidx/loader/content/ModernAsyncTask$3;-><init>(Landroidx/loader/content/ModernAsyncTask;Ljava/util/concurrent/Callable;)V
iput-object v0, p0, Landroidx/loader/content/ModernAsyncTask;->mFuture:Ljava/util/concurrent/FutureTask;
return-void
.end method
.method public static execute(Ljava/lang/Runnable;)V
.locals 1
sget-object v0, Landroidx/loader/content/ModernAsyncTask;->sDefaultExecutor:Ljava/util/concurrent/Executor;
invoke-interface {v0, p0}, Ljava/util/concurrent/Executor;->execute(Ljava/lang/Runnable;)V
return-void
.end method
.method private static getHandler()Landroid/os/Handler;
.locals 2
const-class v0, Landroidx/loader/content/ModernAsyncTask;
monitor-enter v0
:try_start_0
sget-object v1, Landroidx/loader/content/ModernAsyncTask;->sHandler:Landroidx/loader/content/ModernAsyncTask$InternalHandler;
if-nez v1, :cond_0
new-instance v1, Landroidx/loader/content/ModernAsyncTask$InternalHandler;
invoke-direct {v1}, Landroidx/loader/content/ModernAsyncTask$InternalHandler;-><init>()V
sput-object v1, Landroidx/loader/content/ModernAsyncTask;->sHandler:Landroidx/loader/content/ModernAsyncTask$InternalHandler;
:cond_0
sget-object v1, Landroidx/loader/content/ModernAsyncTask;->sHandler:Landroidx/loader/content/ModernAsyncTask$InternalHandler;
monitor-exit v0
return-object v1
:catchall_0
move-exception v1
monitor-exit v0
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
throw v1
.end method
.method public static setDefaultExecutor(Ljava/util/concurrent/Executor;)V
.locals 0
.annotation build Landroidx/annotation/RestrictTo;
value = {
.enum Landroidx/annotation/RestrictTo$Scope;->LIBRARY_GROUP:Landroidx/annotation/RestrictTo$Scope;
}
.end annotation
sput-object p0, Landroidx/loader/content/ModernAsyncTask;->sDefaultExecutor:Ljava/util/concurrent/Executor;
return-void
.end method
# virtual methods
.method public final cancel(Z)Z
.locals 2
iget-object v0, p0, Landroidx/loader/content/ModernAsyncTask;->mCancelled:Ljava/util/concurrent/atomic/AtomicBoolean;
const/4 v1, 0x1
invoke-virtual {v0, v1}, Ljava/util/concurrent/atomic/AtomicBoolean;->set(Z)V
iget-object v0, p0, Landroidx/loader/content/ModernAsyncTask;->mFuture:Ljava/util/concurrent/FutureTask;
invoke-virtual {v0, p1}, Ljava/util/concurrent/FutureTask;->cancel(Z)Z
move-result p1
return p1
.end method
.method protected varargs abstract doInBackground([Ljava/lang/Object;)Ljava/lang/Object;
.annotation system Ldalvik/annotation/Signature;
value = {
"([TParams;)TResult;"
}
.end annotation
.end method
.method public final varargs execute([Ljava/lang/Object;)Landroidx/loader/content/ModernAsyncTask;
.locals 1
.annotation system Ldalvik/annotation/Signature;
value = {
"([TParams;)",
"Landroidx/loader/content/ModernAsyncTask<",
"TParams;TProgress;TResult;>;"
}
.end annotation
sget-object v0, Landroidx/loader/content/ModernAsyncTask;->sDefaultExecutor:Ljava/util/concurrent/Executor;
invoke-virtual {p0, v0, p1}, Landroidx/loader/content/ModernAsyncTask;->executeOnExecutor(Ljava/util/concurrent/Executor;[Ljava/lang/Object;)Landroidx/loader/content/ModernAsyncTask;
move-result-object p1
return-object p1
.end method
.method public final varargs executeOnExecutor(Ljava/util/concurrent/Executor;[Ljava/lang/Object;)Landroidx/loader/content/ModernAsyncTask;
.locals 2
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Ljava/util/concurrent/Executor;",
"[TParams;)",
"Landroidx/loader/content/ModernAsyncTask<",
"TParams;TProgress;TResult;>;"
}
.end annotation
iget-object v0, p0, Landroidx/loader/content/ModernAsyncTask;->mStatus:Landroidx/loader/content/ModernAsyncTask$Status;
sget-object v1, Landroidx/loader/content/ModernAsyncTask$Status;->PENDING:Landroidx/loader/content/ModernAsyncTask$Status;
if-eq v0, v1, :cond_0
sget-object p1, Landroidx/loader/content/ModernAsyncTask$4;->$SwitchMap$androidx$loader$content$ModernAsyncTask$Status:[I
iget-object p2, p0, Landroidx/loader/content/ModernAsyncTask;->mStatus:Landroidx/loader/content/ModernAsyncTask$Status;
invoke-virtual {p2}, Landroidx/loader/content/ModernAsyncTask$Status;->ordinal()I
move-result p2
aget p1, p1, p2
packed-switch p1, :pswitch_data_0
new-instance p1, Ljava/lang/IllegalStateException;
const-string p2, "We should never reach this state"
invoke-direct {p1, p2}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V
throw p1
:pswitch_0
new-instance p1, Ljava/lang/IllegalStateException;
const-string p2, "Cannot execute task: the task has already been executed (a task can be executed only once)"
invoke-direct {p1, p2}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V
throw p1
:pswitch_1
new-instance p1, Ljava/lang/IllegalStateException;
const-string p2, "Cannot execute task: the task is already running."
invoke-direct {p1, p2}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V
throw p1
:cond_0
sget-object v0, Landroidx/loader/content/ModernAsyncTask$Status;->RUNNING:Landroidx/loader/content/ModernAsyncTask$Status;
iput-object v0, p0, Landroidx/loader/content/ModernAsyncTask;->mStatus:Landroidx/loader/content/ModernAsyncTask$Status;
invoke-virtual {p0}, Landroidx/loader/content/ModernAsyncTask;->onPreExecute()V
iget-object v0, p0, Landroidx/loader/content/ModernAsyncTask;->mWorker:Landroidx/loader/content/ModernAsyncTask$WorkerRunnable;
iput-object p2, v0, Landroidx/loader/content/ModernAsyncTask$WorkerRunnable;->mParams:[Ljava/lang/Object;
iget-object p2, p0, Landroidx/loader/content/ModernAsyncTask;->mFuture:Ljava/util/concurrent/FutureTask;
invoke-interface {p1, p2}, Ljava/util/concurrent/Executor;->execute(Ljava/lang/Runnable;)V
return-object p0
:pswitch_data_0
.packed-switch 0x1
:pswitch_1
:pswitch_0
.end packed-switch
.end method
.method finish(Ljava/lang/Object;)V
.locals 1
.annotation system Ldalvik/annotation/Signature;
value = {
"(TResult;)V"
}
.end annotation
invoke-virtual {p0}, Landroidx/loader/content/ModernAsyncTask;->isCancelled()Z
move-result v0
if-eqz v0, :cond_0
invoke-virtual {p0, p1}, Landroidx/loader/content/ModernAsyncTask;->onCancelled(Ljava/lang/Object;)V
goto :goto_0
:cond_0
invoke-virtual {p0, p1}, Landroidx/loader/content/ModernAsyncTask;->onPostExecute(Ljava/lang/Object;)V
:goto_0
sget-object p1, Landroidx/loader/content/ModernAsyncTask$Status;->FINISHED:Landroidx/loader/content/ModernAsyncTask$Status;
iput-object p1, p0, Landroidx/loader/content/ModernAsyncTask;->mStatus:Landroidx/loader/content/ModernAsyncTask$Status;
return-void
.end method
.method public final get()Ljava/lang/Object;
.locals 1
.annotation system Ldalvik/annotation/Signature;
value = {
"()TResult;"
}
.end annotation
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/lang/InterruptedException;,
Ljava/util/concurrent/ExecutionException;
}
.end annotation
iget-object v0, p0, Landroidx/loader/content/ModernAsyncTask;->mFuture:Ljava/util/concurrent/FutureTask;
invoke-virtual {v0}, Ljava/util/concurrent/FutureTask;->get()Ljava/lang/Object;
move-result-object v0
return-object v0
.end method
.method public final get(JLjava/util/concurrent/TimeUnit;)Ljava/lang/Object;
.locals 1
.annotation system Ldalvik/annotation/Signature;
value = {
"(J",
"Ljava/util/concurrent/TimeUnit;",
")TResult;"
}
.end annotation
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/lang/InterruptedException;,
Ljava/util/concurrent/ExecutionException;,
Ljava/util/concurrent/TimeoutException;
}
.end annotation
iget-object v0, p0, Landroidx/loader/content/ModernAsyncTask;->mFuture:Ljava/util/concurrent/FutureTask;
invoke-virtual {v0, p1, p2, p3}, Ljava/util/concurrent/FutureTask;->get(JLjava/util/concurrent/TimeUnit;)Ljava/lang/Object;
move-result-object p1
return-object p1
.end method
.method public final getStatus()Landroidx/loader/content/ModernAsyncTask$Status;
.locals 1
iget-object v0, p0, Landroidx/loader/content/ModernAsyncTask;->mStatus:Landroidx/loader/content/ModernAsyncTask$Status;
return-object v0
.end method
.method public final isCancelled()Z
.locals 1
iget-object v0, p0, Landroidx/loader/content/ModernAsyncTask;->mCancelled:Ljava/util/concurrent/atomic/AtomicBoolean;
invoke-virtual {v0}, Ljava/util/concurrent/atomic/AtomicBoolean;->get()Z
move-result v0
return v0
.end method
.method protected onCancelled()V
.locals 0
return-void
.end method
.method protected onCancelled(Ljava/lang/Object;)V
.locals 0
.annotation system Ldalvik/annotation/Signature;
value = {
"(TResult;)V"
}
.end annotation
invoke-virtual {p0}, Landroidx/loader/content/ModernAsyncTask;->onCancelled()V
return-void
.end method
.method protected onPostExecute(Ljava/lang/Object;)V
.locals 0
.annotation system Ldalvik/annotation/Signature;
value = {
"(TResult;)V"
}
.end annotation
return-void
.end method
.method protected onPreExecute()V
.locals 0
return-void
.end method
.method protected varargs onProgressUpdate([Ljava/lang/Object;)V
.locals 0
.annotation system Ldalvik/annotation/Signature;
value = {
"([TProgress;)V"
}
.end annotation
return-void
.end method
.method postResult(Ljava/lang/Object;)Ljava/lang/Object;
.locals 5
.annotation system Ldalvik/annotation/Signature;
value = {
"(TResult;)TResult;"
}
.end annotation
invoke-static {}, Landroidx/loader/content/ModernAsyncTask;->getHandler()Landroid/os/Handler;
move-result-object v0
new-instance v1, Landroidx/loader/content/ModernAsyncTask$AsyncTaskResult;
const/4 v2, 0x1
new-array v3, v2, [Ljava/lang/Object;
const/4 v4, 0x0
aput-object p1, v3, v4
invoke-direct {v1, p0, v3}, Landroidx/loader/content/ModernAsyncTask$AsyncTaskResult;-><init>(Landroidx/loader/content/ModernAsyncTask;[Ljava/lang/Object;)V
invoke-virtual {v0, v2, v1}, Landroid/os/Handler;->obtainMessage(ILjava/lang/Object;)Landroid/os/Message;
move-result-object v0
invoke-virtual {v0}, Landroid/os/Message;->sendToTarget()V
return-object p1
.end method
.method postResultIfNotInvoked(Ljava/lang/Object;)V
.locals 1
.annotation system Ldalvik/annotation/Signature;
value = {
"(TResult;)V"
}
.end annotation
iget-object v0, p0, Landroidx/loader/content/ModernAsyncTask;->mTaskInvoked:Ljava/util/concurrent/atomic/AtomicBoolean;
invoke-virtual {v0}, Ljava/util/concurrent/atomic/AtomicBoolean;->get()Z
move-result v0
if-nez v0, :cond_0
invoke-virtual {p0, p1}, Landroidx/loader/content/ModernAsyncTask;->postResult(Ljava/lang/Object;)Ljava/lang/Object;
:cond_0
return-void
.end method
.method protected final varargs publishProgress([Ljava/lang/Object;)V
.locals 3
.annotation system Ldalvik/annotation/Signature;
value = {
"([TProgress;)V"
}
.end annotation
invoke-virtual {p0}, Landroidx/loader/content/ModernAsyncTask;->isCancelled()Z
move-result v0
if-nez v0, :cond_0
invoke-static {}, Landroidx/loader/content/ModernAsyncTask;->getHandler()Landroid/os/Handler;
move-result-object v0
const/4 v1, 0x2
new-instance v2, Landroidx/loader/content/ModernAsyncTask$AsyncTaskResult;
invoke-direct {v2, p0, p1}, Landroidx/loader/content/ModernAsyncTask$AsyncTaskResult;-><init>(Landroidx/loader/content/ModernAsyncTask;[Ljava/lang/Object;)V
invoke-virtual {v0, v1, v2}, Landroid/os/Handler;->obtainMessage(ILjava/lang/Object;)Landroid/os/Message;
move-result-object p1
invoke-virtual {p1}, Landroid/os/Message;->sendToTarget()V
:cond_0
return-void
.end method