- 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
51 lines
1.9 KiB
Java
51 lines
1.9 KiB
Java
package kotlinx.coroutines.android;
|
|
|
|
import android.os.Build;
|
|
import java.lang.Thread;
|
|
import java.lang.reflect.Method;
|
|
import java.lang.reflect.Modifier;
|
|
import kotlin.coroutines.AbstractCoroutineContextElement;
|
|
import kotlin.coroutines.CoroutineContext;
|
|
import kotlinx.coroutines.CoroutineExceptionHandler;
|
|
|
|
/* loaded from: classes5.dex */
|
|
public final class AndroidExceptionPreHandler extends AbstractCoroutineContextElement implements CoroutineExceptionHandler {
|
|
private volatile Object _preHandler;
|
|
|
|
public AndroidExceptionPreHandler() {
|
|
super(CoroutineExceptionHandler.Key);
|
|
this._preHandler = this;
|
|
}
|
|
|
|
public final Method preHandler() {
|
|
Object obj = this._preHandler;
|
|
if (obj != this) {
|
|
return (Method) obj;
|
|
}
|
|
Method method = null;
|
|
try {
|
|
Method declaredMethod = Thread.class.getDeclaredMethod("getUncaughtExceptionPreHandler", new Class[0]);
|
|
if (Modifier.isPublic(declaredMethod.getModifiers())) {
|
|
if (Modifier.isStatic(declaredMethod.getModifiers())) {
|
|
method = declaredMethod;
|
|
}
|
|
}
|
|
} catch (Throwable unused) {
|
|
}
|
|
this._preHandler = method;
|
|
return method;
|
|
}
|
|
|
|
@Override // kotlinx.coroutines.CoroutineExceptionHandler
|
|
public void handleException(CoroutineContext coroutineContext, Throwable th) {
|
|
if (Build.VERSION.SDK_INT < 28) {
|
|
Method preHandler = preHandler();
|
|
Object invoke = preHandler != null ? preHandler.invoke(null, new Object[0]) : null;
|
|
Thread.UncaughtExceptionHandler uncaughtExceptionHandler = invoke instanceof Thread.UncaughtExceptionHandler ? (Thread.UncaughtExceptionHandler) invoke : null;
|
|
if (uncaughtExceptionHandler != null) {
|
|
uncaughtExceptionHandler.uncaughtException(Thread.currentThread(), th);
|
|
}
|
|
}
|
|
}
|
|
}
|