package or;

import android.os.Handler;
import android.os.Looper;
import java.lang.invoke.MethodHandles;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.Executor;

/* loaded from: classes5.dex */
class q {

    /* renamed from: c, reason: collision with root package name */
    private static final q f31757c = e();

    /* renamed from: a, reason: collision with root package name */
    private final boolean f31758a;

    /* renamed from: b, reason: collision with root package name */
    private final Constructor f31759b;

    /* JADX INFO: Access modifiers changed from: package-private */
    /* loaded from: classes5.dex */
    public static final class a extends q {

        /* renamed from: or.q$a$a, reason: collision with other inner class name */
        /* loaded from: classes5.dex */
        static final class ExecutorC0732a implements Executor {

            /* renamed from: p, reason: collision with root package name */
            private final Handler f31760p = new Handler(Looper.getMainLooper());

            ExecutorC0732a() {
            }

            @Override // java.util.concurrent.Executor
            public void execute(Runnable runnable) {
                this.f31760p.post(runnable);
            }
        }

        a() {
            super(true);
        }

        @Override // or.q
        public Executor b() {
            return new ExecutorC0732a();
        }

        @Override // or.q
        Object g(Method method, Class cls, Object obj, Object... objArr) {
            return super.g(method, cls, obj, objArr);
        }
    }

    q(boolean z10) {
        this.f31758a = z10;
        Constructor constructor = null;
        if (z10) {
            try {
                constructor = MethodHandles.Lookup.class.getDeclaredConstructor(Class.class, Integer.TYPE);
                constructor.setAccessible(true);
            } catch (NoClassDefFoundError | NoSuchMethodException unused) {
            }
        }
        this.f31759b = constructor;
    }

    private static q e() {
        return "Dalvik".equals(System.getProperty("java.vm.name")) ? new a() : new q(true);
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    public static q f() {
        return f31757c;
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    public List a(Executor executor) {
        g gVar = new g(executor);
        return this.f31758a ? Arrays.asList(e.f31649a, gVar) : Collections.singletonList(gVar);
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    public Executor b() {
        return null;
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    public List c() {
        return this.f31758a ? Collections.singletonList(o.f31710a) : Collections.emptyList();
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    public int d() {
        return this.f31758a ? 1 : 0;
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    public Object g(Method method, Class cls, Object obj, Object... objArr) {
        Constructor constructor = this.f31759b;
        return (constructor != null ? (MethodHandles.Lookup) constructor.newInstance(cls, -1) : MethodHandles.lookup()).unreflectSpecial(method, cls).bindTo(obj).invokeWithArguments(objArr);
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    public boolean h(Method method) {
        return this.f31758a && method.isDefault();
    }
}
