package KNBe_11.KQgRr5e_0.KQgRr5e_0;

import KNBe_11.KQgRr5e_0.KQgRr5e_0.Mqv2r_3.X6FRs_4;
import X6FRs_4.IMuAHx_6.Mqv2r_3.KQgRr5e_0;
import android.app.Activity;
import android.util.Log;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
/* compiled from: EasyPermissions.java */
/* loaded from: classes.dex */
public class QxJ9d_1 {

    /* compiled from: EasyPermissions.java */
    /* loaded from: classes.dex */
    public interface KQgRr5e_0 extends KQgRr5e_0.QxJ9d_1 {
        void onPermissionsDenied(int i, List<String> list);

        void onPermissionsGranted(int i, List<String> list);
    }

    public static void KQgRr5e_0(int i, String[] strArr, int[] iArr, Object... objArr) {
        ArrayList arrayList = new ArrayList();
        ArrayList arrayList2 = new ArrayList();
        for (int i2 = 0; i2 < strArr.length; i2++) {
            String str = strArr[i2];
            if (iArr[i2] == 0) {
                arrayList.add(str);
            } else {
                arrayList2.add(str);
            }
        }
        for (Object obj : objArr) {
            if (!arrayList.isEmpty() && (obj instanceof KQgRr5e_0)) {
                ((KQgRr5e_0) obj).onPermissionsGranted(i, arrayList);
            }
            if (!arrayList2.isEmpty() && (obj instanceof KQgRr5e_0)) {
                ((KQgRr5e_0) obj).onPermissionsDenied(i, arrayList2);
            }
            if (!arrayList.isEmpty() && arrayList2.isEmpty()) {
                KQgRr5e_0(obj, i);
            }
        }
    }

    public static boolean KQgRr5e_0(Activity activity, List<String> list) {
        return X6FRs_4.KQgRr5e_0(activity).KQgRr5e_0(list);
    }

    public static void KQgRr5e_0(Object obj, int i) {
        Method[] declaredMethods;
        Class<?> cls = obj.getClass();
        if (KQgRr5e_0(obj)) {
            cls = cls.getSuperclass();
        }
        while (cls != null) {
            for (Method method : cls.getDeclaredMethods()) {
                KNBe_11.KQgRr5e_0.KQgRr5e_0.KQgRr5e_0 kQgRr5e_0 = (KNBe_11.KQgRr5e_0.KQgRr5e_0.KQgRr5e_0) method.getAnnotation(KNBe_11.KQgRr5e_0.KQgRr5e_0.KQgRr5e_0.class);
                if (kQgRr5e_0 != null && kQgRr5e_0.value() == i) {
                    if (method.getParameterTypes().length <= 0) {
                        try {
                            if (!method.isAccessible()) {
                                method.setAccessible(true);
                            }
                            method.invoke(obj, new Object[0]);
                        } catch (IllegalAccessException e) {
                            Log.e("EasyPermissions", "runDefaultMethod:IllegalAccessException", e);
                        } catch (InvocationTargetException e2) {
                            Log.e("EasyPermissions", "runDefaultMethod:InvocationTargetException", e2);
                        }
                    } else {
                        throw new RuntimeException("Cannot execute method " + method.getName() + " because it is non-void method and/or has input parameters.");
                    }
                }
            }
            cls = cls.getSuperclass();
        }
    }

    public static boolean KQgRr5e_0(Object obj) {
        if (obj.getClass().getSimpleName().endsWith("_")) {
            try {
                return Class.forName("org.androidannotations.api.view.HasViews").isInstance(obj);
            } catch (ClassNotFoundException unused) {
                return false;
            }
        }
        return false;
    }
}
