- Added realracing3-community.apk (71.57 MB) - Removed 32-bit support (armeabi-v7a) - Only includes arm64-v8a libraries - Decompiled source code included - Added README-community.md with analysis
216 lines
6.7 KiB
Java
216 lines
6.7 KiB
Java
package androidx.loader.content;
|
|
|
|
import android.content.Context;
|
|
import android.os.AsyncTask;
|
|
import android.os.Handler;
|
|
import android.os.SystemClock;
|
|
import android.text.format.DateUtils;
|
|
import androidx.annotation.NonNull;
|
|
import androidx.annotation.Nullable;
|
|
import androidx.core.os.OperationCanceledException;
|
|
import java.io.FileDescriptor;
|
|
import java.io.PrintWriter;
|
|
import java.util.concurrent.Executor;
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
/* loaded from: classes.dex */
|
|
public abstract class AsyncTaskLoader<D> extends Loader<D> {
|
|
private static final boolean DEBUG = false;
|
|
private static final String TAG = "AsyncTaskLoader";
|
|
private volatile AsyncTaskLoader<D>.LoadTask mCancellingTask;
|
|
private Executor mExecutor;
|
|
private Handler mHandler;
|
|
private long mLastLoadCompleteTime;
|
|
private volatile AsyncTaskLoader<D>.LoadTask mTask;
|
|
private long mUpdateThrottle;
|
|
|
|
public void cancelLoadInBackground() {
|
|
}
|
|
|
|
public boolean isLoadInBackgroundCanceled() {
|
|
return this.mCancellingTask != null;
|
|
}
|
|
|
|
@Nullable
|
|
public abstract D loadInBackground();
|
|
|
|
public void onCanceled(@Nullable D d) {
|
|
}
|
|
|
|
public final class LoadTask extends ModernAsyncTask<D> implements Runnable {
|
|
boolean waiting;
|
|
|
|
public LoadTask() {
|
|
}
|
|
|
|
@Override // androidx.loader.content.ModernAsyncTask
|
|
public D doInBackground() {
|
|
try {
|
|
return (D) AsyncTaskLoader.this.onLoadInBackground();
|
|
} catch (OperationCanceledException e) {
|
|
if (isCancelled()) {
|
|
return null;
|
|
}
|
|
throw e;
|
|
}
|
|
}
|
|
|
|
@Override // androidx.loader.content.ModernAsyncTask
|
|
public void onPostExecute(D d) {
|
|
AsyncTaskLoader.this.dispatchOnLoadComplete(this, d);
|
|
}
|
|
|
|
@Override // androidx.loader.content.ModernAsyncTask
|
|
public void onCancelled(D d) {
|
|
AsyncTaskLoader.this.dispatchOnCancelled(this, d);
|
|
}
|
|
|
|
@Override // java.lang.Runnable
|
|
public void run() {
|
|
this.waiting = false;
|
|
AsyncTaskLoader.this.executePendingTask();
|
|
}
|
|
}
|
|
|
|
public AsyncTaskLoader(@NonNull Context context) {
|
|
super(context);
|
|
this.mLastLoadCompleteTime = -10000L;
|
|
}
|
|
|
|
public void setUpdateThrottle(long j) {
|
|
this.mUpdateThrottle = j;
|
|
if (j != 0) {
|
|
this.mHandler = new Handler();
|
|
}
|
|
}
|
|
|
|
@Override // androidx.loader.content.Loader
|
|
public void onForceLoad() {
|
|
super.onForceLoad();
|
|
cancelLoad();
|
|
this.mTask = new LoadTask();
|
|
executePendingTask();
|
|
}
|
|
|
|
@Override // androidx.loader.content.Loader
|
|
public boolean onCancelLoad() {
|
|
if (this.mTask == null) {
|
|
return false;
|
|
}
|
|
if (!isStarted()) {
|
|
onContentChanged();
|
|
}
|
|
if (this.mCancellingTask != null) {
|
|
if (this.mTask.waiting) {
|
|
this.mTask.waiting = false;
|
|
this.mHandler.removeCallbacks(this.mTask);
|
|
}
|
|
this.mTask = null;
|
|
return false;
|
|
}
|
|
if (this.mTask.waiting) {
|
|
this.mTask.waiting = false;
|
|
this.mHandler.removeCallbacks(this.mTask);
|
|
this.mTask = null;
|
|
return false;
|
|
}
|
|
boolean cancel = this.mTask.cancel(false);
|
|
if (cancel) {
|
|
this.mCancellingTask = this.mTask;
|
|
cancelLoadInBackground();
|
|
}
|
|
this.mTask = null;
|
|
return cancel;
|
|
}
|
|
|
|
public void executePendingTask() {
|
|
if (this.mCancellingTask != null || this.mTask == null) {
|
|
return;
|
|
}
|
|
if (this.mTask.waiting) {
|
|
this.mTask.waiting = false;
|
|
this.mHandler.removeCallbacks(this.mTask);
|
|
}
|
|
if (this.mUpdateThrottle > 0 && SystemClock.uptimeMillis() < this.mLastLoadCompleteTime + this.mUpdateThrottle) {
|
|
this.mTask.waiting = true;
|
|
this.mHandler.postAtTime(this.mTask, this.mLastLoadCompleteTime + this.mUpdateThrottle);
|
|
} else {
|
|
if (this.mExecutor == null) {
|
|
this.mExecutor = getExecutor();
|
|
}
|
|
this.mTask.executeOnExecutor(this.mExecutor);
|
|
}
|
|
}
|
|
|
|
public void dispatchOnCancelled(AsyncTaskLoader<D>.LoadTask loadTask, D d) {
|
|
onCanceled(d);
|
|
if (this.mCancellingTask == loadTask) {
|
|
rollbackContentChanged();
|
|
this.mLastLoadCompleteTime = SystemClock.uptimeMillis();
|
|
this.mCancellingTask = null;
|
|
deliverCancellation();
|
|
executePendingTask();
|
|
}
|
|
}
|
|
|
|
public void dispatchOnLoadComplete(AsyncTaskLoader<D>.LoadTask loadTask, D d) {
|
|
if (this.mTask != loadTask) {
|
|
dispatchOnCancelled(loadTask, d);
|
|
return;
|
|
}
|
|
if (isAbandoned()) {
|
|
onCanceled(d);
|
|
return;
|
|
}
|
|
commitContentChanged();
|
|
this.mLastLoadCompleteTime = SystemClock.uptimeMillis();
|
|
this.mTask = null;
|
|
deliverResult(d);
|
|
}
|
|
|
|
@Nullable
|
|
public D onLoadInBackground() {
|
|
return loadInBackground();
|
|
}
|
|
|
|
@NonNull
|
|
public Executor getExecutor() {
|
|
return AsyncTask.THREAD_POOL_EXECUTOR;
|
|
}
|
|
|
|
@Override // androidx.loader.content.Loader
|
|
@Deprecated
|
|
public void dump(String str, FileDescriptor fileDescriptor, PrintWriter printWriter, String[] strArr) {
|
|
String str2;
|
|
super.dump(str, fileDescriptor, printWriter, strArr);
|
|
if (this.mTask != null) {
|
|
printWriter.print(str);
|
|
printWriter.print("mTask=");
|
|
printWriter.print(this.mTask);
|
|
printWriter.print(" waiting=");
|
|
printWriter.println(this.mTask.waiting);
|
|
}
|
|
if (this.mCancellingTask != null) {
|
|
printWriter.print(str);
|
|
printWriter.print("mCancellingTask=");
|
|
printWriter.print(this.mCancellingTask);
|
|
printWriter.print(" waiting=");
|
|
printWriter.println(this.mCancellingTask.waiting);
|
|
}
|
|
if (this.mUpdateThrottle != 0) {
|
|
printWriter.print(str);
|
|
printWriter.print("mUpdateThrottle=");
|
|
TimeUnit timeUnit = TimeUnit.MILLISECONDS;
|
|
printWriter.print(DateUtils.formatElapsedTime(timeUnit.toSeconds(this.mUpdateThrottle)));
|
|
printWriter.print(" mLastLoadCompleteTime=");
|
|
if (this.mLastLoadCompleteTime == -10000) {
|
|
str2 = "--";
|
|
} else {
|
|
str2 = "-" + DateUtils.formatElapsedTime(timeUnit.toSeconds(SystemClock.uptimeMillis() - this.mLastLoadCompleteTime));
|
|
}
|
|
printWriter.print(str2);
|
|
printWriter.println();
|
|
}
|
|
}
|
|
}
|