Add decompiled APK source code (JADX)

- 28,932 files
- Full Java source code
- Smali files
- Resources

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
2026-02-18 14:52:23 -08:00
parent cc210a65ea
commit f9d20bb3fc
26991 changed files with 2541449 additions and 0 deletions

View File

@@ -0,0 +1,184 @@
package androidx.core.provider;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.Message;
import androidx.annotation.GuardedBy;
import androidx.annotation.RestrictTo;
import androidx.annotation.VisibleForTesting;
import java.util.concurrent.Callable;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicReference;
import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.ReentrantLock;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
@Deprecated
/* loaded from: classes.dex */
public class SelfDestructiveThread {
private static final int MSG_DESTRUCTION = 0;
private static final int MSG_INVOKE_RUNNABLE = 1;
private final int mDestructAfterMillisec;
@GuardedBy("mLock")
private Handler mHandler;
private final int mPriority;
@GuardedBy("mLock")
private HandlerThread mThread;
private final String mThreadName;
private final Object mLock = new Object();
private Handler.Callback mCallback = new Handler.Callback() { // from class: androidx.core.provider.SelfDestructiveThread.1
@Override // android.os.Handler.Callback
public boolean handleMessage(Message message) {
int i = message.what;
if (i == 0) {
SelfDestructiveThread.this.onDestruction();
return true;
}
if (i != 1) {
return true;
}
SelfDestructiveThread.this.onInvokeRunnable((Runnable) message.obj);
return true;
}
};
@GuardedBy("mLock")
private int mGeneration = 0;
public interface ReplyCallback<T> {
void onReply(T t);
}
public SelfDestructiveThread(String str, int i, int i2) {
this.mThreadName = str;
this.mPriority = i;
this.mDestructAfterMillisec = i2;
}
@VisibleForTesting
public boolean isRunning() {
boolean z;
synchronized (this.mLock) {
z = this.mThread != null;
}
return z;
}
@VisibleForTesting
public int getGeneration() {
int i;
synchronized (this.mLock) {
i = this.mGeneration;
}
return i;
}
private void post(Runnable runnable) {
synchronized (this.mLock) {
try {
if (this.mThread == null) {
HandlerThread handlerThread = new HandlerThread(this.mThreadName, this.mPriority);
this.mThread = handlerThread;
handlerThread.start();
this.mHandler = new Handler(this.mThread.getLooper(), this.mCallback);
this.mGeneration++;
}
this.mHandler.removeMessages(0);
Handler handler = this.mHandler;
handler.sendMessage(handler.obtainMessage(1, runnable));
} catch (Throwable th) {
throw th;
}
}
}
public <T> void postAndReply(final Callable<T> callable, final ReplyCallback<T> replyCallback) {
final Handler create = CalleeHandler.create();
post(new Runnable() { // from class: androidx.core.provider.SelfDestructiveThread.2
@Override // java.lang.Runnable
public void run() {
final Object obj;
try {
obj = callable.call();
} catch (Exception unused) {
obj = null;
}
create.post(new Runnable() { // from class: androidx.core.provider.SelfDestructiveThread.2.1
@Override // java.lang.Runnable
public void run() {
replyCallback.onReply(obj);
}
});
}
});
}
public <T> T postAndWait(final Callable<T> callable, int i) throws InterruptedException {
final ReentrantLock reentrantLock = new ReentrantLock();
final Condition newCondition = reentrantLock.newCondition();
final AtomicReference atomicReference = new AtomicReference();
final AtomicBoolean atomicBoolean = new AtomicBoolean(true);
post(new Runnable() { // from class: androidx.core.provider.SelfDestructiveThread.3
@Override // java.lang.Runnable
public void run() {
try {
atomicReference.set(callable.call());
} catch (Exception unused) {
}
reentrantLock.lock();
try {
atomicBoolean.set(false);
newCondition.signal();
} finally {
reentrantLock.unlock();
}
}
});
reentrantLock.lock();
try {
if (!atomicBoolean.get()) {
return (T) atomicReference.get();
}
long nanos = TimeUnit.MILLISECONDS.toNanos(i);
do {
try {
nanos = newCondition.awaitNanos(nanos);
} catch (InterruptedException unused) {
}
if (!atomicBoolean.get()) {
return (T) atomicReference.get();
}
} while (nanos > 0);
throw new InterruptedException("timeout");
} finally {
reentrantLock.unlock();
}
}
public void onInvokeRunnable(Runnable runnable) {
runnable.run();
synchronized (this.mLock) {
this.mHandler.removeMessages(0);
Handler handler = this.mHandler;
handler.sendMessageDelayed(handler.obtainMessage(0), this.mDestructAfterMillisec);
}
}
public void onDestruction() {
synchronized (this.mLock) {
try {
if (this.mHandler.hasMessages(1)) {
return;
}
this.mThread.quit();
this.mThread = null;
this.mHandler = null;
} catch (Throwable th) {
throw th;
}
}
}
}