apkfuckery/com.discord/smali/androidx/loader/content/ModernAsyncTask.smali

587 lines
18 KiB
Smali
Raw Normal View History

2019-12-06 03:29:40 +00:00
.class public abstract Landroidx/loader/content/ModernAsyncTask;
2019-07-24 11:27:29 +00:00
.super Ljava/lang/Object;
.source "ModernAsyncTask.java"
# 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
2019-12-06 03:29:40 +00:00
.field public static final CORE_POOL_SIZE:I = 0x5
2019-07-24 11:27:29 +00:00
2019-12-06 03:29:40 +00:00
.field public static final KEEP_ALIVE:I = 0x1
2019-07-24 11:27:29 +00:00
2019-12-06 03:29:40 +00:00
.field public static final LOG_TAG:Ljava/lang/String; = "AsyncTask"
2019-07-24 11:27:29 +00:00
2019-12-06 03:29:40 +00:00
.field public static final MAXIMUM_POOL_SIZE:I = 0x80
2019-07-24 11:27:29 +00:00
2019-12-06 03:29:40 +00:00
.field public static final MESSAGE_POST_PROGRESS:I = 0x2
2019-07-24 11:27:29 +00:00
2019-12-06 03:29:40 +00:00
.field public static final MESSAGE_POST_RESULT:I = 0x1
2019-07-24 11:27:29 +00:00
.field public static final THREAD_POOL_EXECUTOR:Ljava/util/concurrent/Executor;
2019-12-06 03:29:40 +00:00
.field public static volatile sDefaultExecutor:Ljava/util/concurrent/Executor;
2019-07-24 11:27:29 +00:00
2019-12-06 03:29:40 +00:00
.field public static sHandler:Landroidx/loader/content/ModernAsyncTask$InternalHandler;
2019-07-24 11:27:29 +00:00
2019-12-06 03:29:40 +00:00
.field public static final sPoolWorkQueue:Ljava/util/concurrent/BlockingQueue;
2019-07-24 11:27:29 +00:00
.annotation system Ldalvik/annotation/Signature;
value = {
"Ljava/util/concurrent/BlockingQueue<",
"Ljava/lang/Runnable;",
">;"
}
.end annotation
.end field
2019-12-06 03:29:40 +00:00
.field public static final sThreadFactory:Ljava/util/concurrent/ThreadFactory;
2019-07-24 11:27:29 +00:00
# instance fields
2019-12-06 03:29:40 +00:00
.field public final mCancelled:Ljava/util/concurrent/atomic/AtomicBoolean;
2019-07-24 11:27:29 +00:00
2019-12-06 03:29:40 +00:00
.field public final mFuture:Ljava/util/concurrent/FutureTask;
2019-07-24 11:27:29 +00:00
.annotation system Ldalvik/annotation/Signature;
value = {
"Ljava/util/concurrent/FutureTask<",
"TResult;>;"
}
.end annotation
.end field
2019-12-06 03:29:40 +00:00
.field public volatile mStatus:Landroidx/loader/content/ModernAsyncTask$Status;
2019-07-24 11:27:29 +00:00
2019-12-06 03:29:40 +00:00
.field public final mTaskInvoked:Ljava/util/concurrent/atomic/AtomicBoolean;
2019-07-24 11:27:29 +00:00
2019-12-06 03:29:40 +00:00
.field public final mWorker:Landroidx/loader/content/ModernAsyncTask$WorkerRunnable;
2019-07-24 11:27:29 +00:00
.annotation system Ldalvik/annotation/Signature;
value = {
"Landroidx/loader/content/ModernAsyncTask$WorkerRunnable<",
"TParams;TResult;>;"
}
.end annotation
.end field
# direct methods
2019-12-06 03:29:40 +00:00
.method public static constructor <clinit>()V
2019-07-24 11:27:29 +00:00
.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;
2019-12-06 03:29:40 +00:00
sget-object v0, Landroidx/loader/content/ModernAsyncTask;->THREAD_POOL_EXECUTOR:Ljava/util/concurrent/Executor;
2019-07-24 11:27:29 +00:00
sput-object v0, Landroidx/loader/content/ModernAsyncTask;->sDefaultExecutor:Ljava/util/concurrent/Executor;
return-void
.end method
2019-12-06 03:29:40 +00:00
.method public constructor <init>()V
2019-07-24 11:27:29 +00:00
.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
2019-12-06 03:29:40 +00:00
.method public static getHandler()Landroid/os/Handler;
2019-07-24 11:27:29 +00:00
.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
2019-12-06 03:29:40 +00:00
.annotation build Landroidx/annotation/RestrictTo;
value = {
.enum Landroidx/annotation/RestrictTo$Scope;->LIBRARY_GROUP:Landroidx/annotation/RestrictTo$Scope;
}
.end annotation
2019-07-24 11:27:29 +00:00
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
2019-12-06 03:29:40 +00:00
.method public varargs abstract doInBackground([Ljava/lang/Object;)Ljava/lang/Object;
2019-07-24 11:27:29 +00:00
.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_2
2019-12-06 03:29:40 +00:00
iget-object p1, p0, Landroidx/loader/content/ModernAsyncTask;->mStatus:Landroidx/loader/content/ModernAsyncTask$Status;
2019-07-24 11:27:29 +00:00
2019-12-06 03:29:40 +00:00
invoke-virtual {p1}, Ljava/lang/Enum;->ordinal()I
2019-07-24 11:27:29 +00:00
2019-12-06 03:29:40 +00:00
move-result p1
2019-07-24 11:27:29 +00:00
const/4 p2, 0x1
if-eq p1, p2, :cond_1
const/4 p2, 0x2
if-eq p1, p2, :cond_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
:cond_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
:cond_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_2
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
.end method
2019-12-06 03:29:40 +00:00
.method public finish(Ljava/lang/Object;)V
2019-07-24 11:27:29 +00:00
.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
2019-12-06 03:29:40 +00:00
.method public onCancelled()V
2019-07-24 11:27:29 +00:00
.locals 0
return-void
.end method
2019-12-06 03:29:40 +00:00
.method public onCancelled(Ljava/lang/Object;)V
2019-07-24 11:27:29 +00:00
.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
2019-12-06 03:29:40 +00:00
.method public onPostExecute(Ljava/lang/Object;)V
2019-07-24 11:27:29 +00:00
.locals 0
.annotation system Ldalvik/annotation/Signature;
value = {
"(TResult;)V"
}
.end annotation
return-void
.end method
2019-12-06 03:29:40 +00:00
.method public onPreExecute()V
2019-07-24 11:27:29 +00:00
.locals 0
return-void
.end method
2019-12-06 03:29:40 +00:00
.method public varargs onProgressUpdate([Ljava/lang/Object;)V
2019-07-24 11:27:29 +00:00
.locals 0
.annotation system Ldalvik/annotation/Signature;
value = {
"([TProgress;)V"
}
.end annotation
return-void
.end method
2019-12-06 03:29:40 +00:00
.method public postResult(Ljava/lang/Object;)Ljava/lang/Object;
2019-07-24 11:27:29 +00:00
.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
2019-12-06 03:29:40 +00:00
.method public postResultIfNotInvoked(Ljava/lang/Object;)V
2019-07-24 11:27:29 +00:00
.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
2019-12-06 03:29:40 +00:00
.method public final varargs publishProgress([Ljava/lang/Object;)V
2019-07-24 11:27:29 +00:00
.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