package B2;

import android.app.Activity;
import android.graphics.Rect;
import e4.C;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.util.List;
import kotlin.jvm.internal.D;
import y2.C3263a;

/* JADX INFO: loaded from: classes.dex */
public final /* synthetic */ class d implements J4.a {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final /* synthetic */ int f465a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final /* synthetic */ e f466b;

    public /* synthetic */ d(e eVar, int i6) {
        this.f465a = i6;
        this.f466b = eVar;
    }

    @Override // J4.a
    public final Object invoke() throws NoSuchMethodException, ClassNotFoundException {
        Class clsB;
        switch (this.f465a) {
            case 0:
                e eVar = this.f466b;
                Class<?> clsLoadClass = eVar.f469c.f26178a.loadClass("androidx.window.extensions.WindowExtensions");
                kotlin.jvm.internal.o.g(clsLoadClass, "loadClass(...)");
                boolean z6 = false;
                Method method = clsLoadClass.getMethod("getWindowLayoutComponent", new Class[0]);
                Class clsB2 = eVar.b();
                kotlin.jvm.internal.o.e(method);
                if (Modifier.isPublic(method.getModifiers()) && method.getReturnType().equals(clsB2)) {
                    z6 = true;
                }
                return Boolean.valueOf(z6);
            case 1:
                Class<?> clsLoadClass2 = this.f466b.f467a.loadClass("androidx.window.extensions.layout.FoldingFeature");
                kotlin.jvm.internal.o.g(clsLoadClass2, "loadClass(...)");
                boolean z7 = false;
                Method method2 = clsLoadClass2.getMethod("getBounds", new Class[0]);
                Method method3 = clsLoadClass2.getMethod("getType", new Class[0]);
                Method method4 = clsLoadClass2.getMethod("getState", new Class[0]);
                kotlin.jvm.internal.o.e(method2);
                if (L4.a.B(method2, C.D(D.a(Rect.class))) && Modifier.isPublic(method2.getModifiers())) {
                    kotlin.jvm.internal.o.e(method3);
                    Class cls = Integer.TYPE;
                    if (L4.a.B(method3, C.D(D.a(cls))) && Modifier.isPublic(method3.getModifiers())) {
                        kotlin.jvm.internal.o.e(method4);
                        if (L4.a.B(method4, C.D(D.a(cls))) && Modifier.isPublic(method4.getModifiers())) {
                            z7 = true;
                        }
                    }
                }
                return Boolean.valueOf(z7);
            case 2:
                e eVar2 = this.f466b;
                Class<?> clsLoadClass3 = eVar2.f467a.loadClass("androidx.window.extensions.layout.SupportedWindowFeatures");
                kotlin.jvm.internal.o.g(clsLoadClass3, "loadClass(...)");
                boolean z8 = false;
                Method method5 = clsLoadClass3.getMethod("getDisplayFoldFeatures", new Class[0]);
                Type genericReturnType = method5.getGenericReturnType();
                kotlin.jvm.internal.o.f(genericReturnType, "null cannot be cast to non-null type java.lang.reflect.ParameterizedType");
                Type type = ((ParameterizedType) genericReturnType).getActualTypeArguments()[0];
                kotlin.jvm.internal.o.f(type, "null cannot be cast to non-null type java.lang.Class<*>");
                Class cls2 = (Class) type;
                if (Modifier.isPublic(method5.getModifiers()) && method5.getReturnType().equals(List.class)) {
                    Class<?> clsLoadClass4 = eVar2.f467a.loadClass("androidx.window.extensions.layout.DisplayFoldFeature");
                    kotlin.jvm.internal.o.g(clsLoadClass4, "loadClass(...)");
                    if (cls2.equals(clsLoadClass4)) {
                        z8 = true;
                    }
                }
                return Boolean.valueOf(z8);
            case 3:
                Class<?> clsLoadClass5 = this.f466b.f467a.loadClass("androidx.window.extensions.layout.DisplayFoldFeature");
                kotlin.jvm.internal.o.g(clsLoadClass5, "loadClass(...)");
                boolean z9 = false;
                Method method6 = clsLoadClass5.getMethod("getType", new Class[0]);
                Class cls3 = Integer.TYPE;
                Method method7 = clsLoadClass5.getMethod("hasProperty", cls3);
                Method method8 = clsLoadClass5.getMethod("hasProperties", int[].class);
                kotlin.jvm.internal.o.e(method6);
                if (Modifier.isPublic(method6.getModifiers()) && L4.a.B(method6, cls3)) {
                    kotlin.jvm.internal.o.e(method7);
                    if (Modifier.isPublic(method7.getModifiers())) {
                        Class cls4 = Boolean.TYPE;
                        if (L4.a.B(method7, cls4)) {
                            kotlin.jvm.internal.o.e(method8);
                            if (Modifier.isPublic(method8.getModifiers()) && L4.a.B(method8, cls4)) {
                                z9 = true;
                            }
                        }
                    }
                }
                return Boolean.valueOf(z9);
            case 4:
                e eVar3 = this.f466b;
                boolean z10 = false;
                Method method9 = eVar3.b().getMethod("getSupportedWindowFeatures", new Class[0]);
                kotlin.jvm.internal.o.e(method9);
                if (Modifier.isPublic(method9.getModifiers())) {
                    Class<?> clsLoadClass6 = eVar3.f467a.loadClass("androidx.window.extensions.layout.SupportedWindowFeatures");
                    kotlin.jvm.internal.o.g(clsLoadClass6, "loadClass(...)");
                    if (method9.getReturnType().equals(clsLoadClass6)) {
                        z10 = true;
                    }
                }
                return Boolean.valueOf(z10);
            case 5:
                e eVar4 = this.f466b;
                C3263a c3263a = eVar4.f468b;
                c3263a.getClass();
                try {
                    clsB = c3263a.b();
                    break;
                } catch (ClassNotFoundException unused) {
                    clsB = null;
                }
                boolean z11 = false;
                if (clsB != null) {
                    Class clsB3 = eVar4.b();
                    Method method10 = clsB3.getMethod("addWindowLayoutInfoListener", Activity.class, clsB);
                    Method method11 = clsB3.getMethod("removeWindowLayoutInfoListener", clsB);
                    kotlin.jvm.internal.o.e(method10);
                    if (Modifier.isPublic(method10.getModifiers())) {
                        kotlin.jvm.internal.o.e(method11);
                        if (Modifier.isPublic(method11.getModifiers())) {
                            z11 = true;
                        }
                    }
                }
                return Boolean.valueOf(z11);
            default:
                return Boolean.valueOf(e.e(this.f466b));
        }
    }
}
