Files
rr3-apk/decompiled/sources/kotlinx/coroutines/android/HandlerDispatcherKt.java
Daniel Elliott f9d20bb3fc 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>
2026-02-18 14:52:23 -08:00

44 lines
1.7 KiB
Java

package kotlinx.coroutines.android;
import android.os.Build;
import android.os.Handler;
import android.os.Looper;
import android.view.Choreographer;
import kotlin.Result;
import kotlin.ResultKt;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes5.dex */
public abstract class HandlerDispatcherKt {
public static final HandlerDispatcher Main;
private static volatile Choreographer choreographer;
public static final Handler asHandler(Looper looper, boolean z) {
if (!z) {
return new Handler(looper);
}
if (Build.VERSION.SDK_INT >= 28) {
Object invoke = Handler.class.getDeclaredMethod("createAsync", Looper.class).invoke(null, looper);
Intrinsics.checkNotNull(invoke, "null cannot be cast to non-null type android.os.Handler");
return (Handler) invoke;
}
try {
return (Handler) Handler.class.getDeclaredConstructor(Looper.class, Handler.Callback.class, Boolean.TYPE).newInstance(looper, null, Boolean.TRUE);
} catch (NoSuchMethodException unused) {
return new Handler(looper);
}
}
static {
Object m4060constructorimpl;
try {
Result.Companion companion = Result.Companion;
m4060constructorimpl = Result.m4060constructorimpl(new HandlerContext(asHandler(Looper.getMainLooper(), true), null, 2, null));
} catch (Throwable th) {
Result.Companion companion2 = Result.Companion;
m4060constructorimpl = Result.m4060constructorimpl(ResultKt.createFailure(th));
}
Main = (HandlerDispatcher) (Result.m4064isFailureimpl(m4060constructorimpl) ? null : m4060constructorimpl);
}
}