package p025.p026.p028;

import android.os.Build;
import android.os.Handler;
import android.os.Looper;
import java.lang.reflect.InvocationTargetException;
import kotlin.TypeCastException;
import p138.p176.p177.p242.p246.p251.C4303;
import p402.C6542;

/* JADX INFO: renamed from: އ.֏.ၶ.ހ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes.dex */
public final class C1397 {
    static {
        Object objM7010;
        try {
            C6542.C6543 c6543 = C6542.f19318;
            objM7010 = new C1392(m2729(Looper.getMainLooper(), true), "Main", false);
        } catch (Throwable th) {
            C6542.C6543 c65432 = C6542.f19318;
            objM7010 = C4303.m7010(th);
        }
        if (C6542.m9769(objM7010)) {
            objM7010 = null;
        }
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public static final Handler m2729(Looper looper, boolean z) throws IllegalAccessException, InvocationTargetException {
        if (!z) {
            return new Handler(looper);
        }
        if (Build.VERSION.SDK_INT < 28) {
            try {
                return (Handler) Handler.class.getDeclaredConstructor(Looper.class, Handler.Callback.class, Boolean.TYPE).newInstance(looper, null, true);
            } catch (NoSuchMethodException unused) {
                return new Handler(looper);
            }
        }
        Object objInvoke = Handler.class.getDeclaredMethod("createAsync", Looper.class).invoke(null, looper);
        if (objInvoke != null) {
            return (Handler) objInvoke;
        }
        throw new TypeCastException("null cannot be cast to non-null type android.os.Handler");
    }
}
