APKPure.apk(点击下载) / f.java


package e.g.c.e;

import android.app.Activity;
import android.content.Context;
import android.content.ContextWrapper;
import android.content.pm.PackageManager;
import android.content.res.XmlResourceParser;
import android.os.Build;
import android.os.Bundle;
import androidx.recyclerview.widget.RecyclerView;
import com.google.android.gms.common.api.Api;
import e.g.c.e.h.a;
import e.g.c.e.h.b;
import java.io.IOException;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Objects;
import o.s.c.j;
import o.s.c.y;
import org.xmlpull.v1.XmlPullParserException;

public final class f {

    /* renamed from: f  reason: collision with root package name */
    public static a f8006f;

    /* renamed from: g  reason: collision with root package name */
    public static Boolean f8007g;

    /* renamed from: a  reason: collision with root package name */
    public final Context f8008a;
    public List<String> b;
    public a c;
    public Boolean d;

    /* renamed from: e  reason: collision with root package name */
    public b f8009e;

    public f(Context context, o.s.c.f fVar) {
        this.f8008a = context;
        if (f8006f == null) {
            f8006f = new e();
        }
        this.c = f8006f;
    }

    public final f a(List<String> list) {
        j.e(list, "permissions");
        if (list.isEmpty()) {
            return this;
        }
        if (this.b == null) {
            this.b = new ArrayList(list);
            return this;
        }
        for (String str : list) {
            List<String> list2 = this.b;
            j.c(list2);
            if (!list2.contains(str)) {
                List<String> list3 = this.b;
                j.c(list3);
                list3.add(str);
            }
        }
        return this;
    }

    /* JADX WARNING: Removed duplicated region for block: B:137:0x0229 A[LOOP:4: B:137:0x0229->B:144:0x0242, LOOP_START, SYNTHETIC, Splitter:B:137:0x0229] */
    /* JADX WARNING: Removed duplicated region for block: B:172:0x02a3  */
    /* JADX WARNING: Removed duplicated region for block: B:180:0x02c1  */
    /* JADX WARNING: Removed duplicated region for block: B:199:0x0313  */
    /* JADX WARNING: Removed duplicated region for block: B:20:0x0053  */
    /* JADX WARNING: Removed duplicated region for block: B:229:0x0379  */
    /* JADX WARNING: Removed duplicated region for block: B:261:0x03f3 A[SYNTHETIC, Splitter:B:261:0x03f3] */
    /* JADX WARNING: Removed duplicated region for block: B:271:0x0427  */
    /* JADX WARNING: Removed duplicated region for block: B:317:0x050b  */
    /* JADX WARNING: Removed duplicated region for block: B:319:0x0513  */
    /* JADX WARNING: Removed duplicated region for block: B:391:0x004f A[SYNTHETIC] */
    /* JADX WARNING: Removed duplicated region for block: B:44:0x00a2 A[RETURN] */
    /* JADX WARNING: Removed duplicated region for block: B:45:0x00a3  */
    public final void b() {
        Activity activity;
        boolean z;
        boolean z2;
        String str;
        Activity activity2;
        String str2;
        String str3;
        String str4;
        String str5;
        int i2;
        boolean z3;
        int i3;
        String str6;
        String str7;
        Context context;
        Context context2;
        int i4;
        Iterator it;
        String str8;
        String str9;
        String str10;
        String str11;
        String str12;
        String str13;
        int i5;
        int i6;
        int i7;
        IOException e2;
        XmlPullParserException e3;
        boolean z4;
        XmlResourceParser e4;
        PackageManager.NameNotFoundException e5;
        int i8 = Build.VERSION.SDK_INT;
        if (this.c == null) {
            if (f8006f == null) {
                f8006f = new e();
            }
            this.c = f8006f;
        }
        ArrayList arrayList = new ArrayList(this.b);
        String str14 = "context";
        if (this.d == null) {
            if (f8007g == null) {
                d dVar = d.f8005a;
                Context context3 = this.f8008a;
                j.e(context3, str14);
                f8007g = Boolean.valueOf((context3.getApplicationInfo().flags & 2) != 0);
            }
            this.d = f8007g;
        }
        Context context4 = this.f8008a;
        d dVar2 = d.f8005a;
        while (true) {
            if (!(context4 instanceof Activity)) {
                activity = (Activity) context4;
                break;
            }
            if (!(context4 instanceof ContextWrapper) || (context4 = ((ContextWrapper) context4).getBaseContext()) == null) {
                activity = null;
            }
            if (!(context4 instanceof Activity)) {
            }
        }
        Boolean bool = this.d;
        j.c(bool);
        boolean booleanValue = bool.booleanValue();
        if (activity == null) {
            if (!(!booleanValue)) {
                throw new IllegalArgumentException("The instance of the context must be an activity object".toString());
            }
        } else if (activity.isFinishing()) {
            if (booleanValue) {
                throw new IllegalStateException("The activity has been finishing, please manually determine the status of the activity");
            }
        } else if (!activity.isDestroyed()) {
            z = true;
            if (!z) {
                Boolean bool2 = this.d;
                j.c(bool2);
                boolean booleanValue2 = bool2.booleanValue();
                if (!arrayList.isEmpty()) {
                    if (i8 <= 32 && booleanValue2) {
                        ArrayList arrayList2 = new ArrayList();
                        Field[] declaredFields = a.class.getDeclaredFields();
                        j.d(declaredFields, "Permission::class.java.getDeclaredFields()");
                        if (!(declaredFields.length == 0)) {
                            int length = declaredFields.length;
                            int i9 = 0;
                            while (i9 < length) {
                                Field field = declaredFields[i9];
                                int i10 = i9 + 1;
                                if (j.a(String.class, field.getType())) {
                                    try {
                                        Object obj = field.get(null);
                                        if (obj != null) {
                                            arrayList2.add((String) obj);
                                        } else {
                                            throw new NullPointerException("null cannot be cast to non-null type kotlin.String");
                                        }
                                    } catch (IllegalAccessException e6) {
                                        e6.printStackTrace();
                                    }
                                }
                                i9 = i10;
                            }
                            Iterator it2 = arrayList.iterator();
                            while (it2.hasNext()) {
                                String str15 = (String) it2.next();
                                if (!arrayList2.contains(str15)) {
                                    throw new IllegalArgumentException(e.d.a.a.a.J("The ", str15, " is not a dangerous permission or special permission, please do not apply dynamically"));
                                }
                            }
                        }
                    }
                    z2 = true;
                } else if (!booleanValue2) {
                    z2 = false;
                } else {
                    throw new IllegalArgumentException("The requested permission cannot be empty");
                }
                if (z2) {
                    Boolean bool3 = this.d;
                    j.c(bool3);
                    if (bool3.booleanValue()) {
                        j.e(arrayList, "requestPermissions");
                        activity2 = activity;
                        if (arrayList.contains("android.permission.ACCESS_MEDIA_LOCATION") && !arrayList.contains("android.permission.READ_EXTERNAL_STORAGE") && !arrayList.contains("android.permission.MANAGE_EXTERNAL_STORAGE")) {
                            Iterator it3 = arrayList.iterator();
                            while (it3.hasNext()) {
                                String str16 = (String) it3.next();
                                if (!"android.permission.ACCESS_MEDIA_LOCATION".equals(str16) && !"android.permission.READ_EXTERNAL_STORAGE".equals(str16) && !"android.permission.WRITE_EXTERNAL_STORAGE".equals(str16) && !"android.permission.MANAGE_EXTERNAL_STORAGE".equals(str16)) {
                                    throw new IllegalArgumentException("Because it includes access media location permissions, do not apply for permissions unrelated to access media location");
                                }
                            }
                            throw new IllegalArgumentException("You must add android.permission.READ_EXTERNAL_STORAGE or android.permission.MANAGE_EXTERNAL_STORAGE rights to apply for android.permission.ACCESS_MEDIA_LOCATION rights");
                        }
                        String str17 = "android.permission.READ_PHONE_STATE";
                        Context context5 = this.f8008a;
                        j.e(context5, str14);
                        j.e(arrayList, "requestPermissions");
                        String str18 = "android.permission.BODY_SENSORS";
                        if ((arrayList.contains("android.permission.MANAGE_EXTERNAL_STORAGE") || arrayList.contains("android.permission.READ_EXTERNAL_STORAGE") || arrayList.contains("android.permission.WRITE_EXTERNAL_STORAGE")) && !arrayList.contains("android.permission.ACCESS_MEDIA_LOCATION")) {
                            d dVar3 = d.f8005a;
                            j.e(context5, str14);
                            str7 = "android.permission.WRITE_EXTERNAL_STORAGE";
                            try {
                                str6 = "android.permission.READ_EXTERNAL_STORAGE";
                                try {
                                    i3 = i8;
                                } catch (PackageManager.NameNotFoundException e7) {
                                    e5 = e7;
                                    i3 = i8;
                                    e5.printStackTrace();
                                    z4 = false;
                                    e4 = d.e(context5);
                                    if (e4 != null) {
                                    }
                                    context = this.f8008a;
                                    j.e(context, str14);
                                    j.e(arrayList, "requestPermissions");
                                    if (context.getApplicationInfo().targetSdkVersion >= 31) {
                                    }
                                    if (arrayList.contains("android.permission.ACCESS_BACKGROUND_LOCATION")) {
                                    }
                                    context2 = this.f8008a;
                                    j.e(context2, str14);
                                    j.e(arrayList, "requestPermissions");
                                    String str19 = "android.permission.BLUETOOTH_ADVERTISE";
                                    String str20 = "android.permission.BLUETOOTH_CONNECT";
                                    if (!arrayList.contains("android.permission.BLUETOOTH_SCAN")) {
                                    }
                                    if (context2.getApplicationInfo().targetSdkVersion < i4) {
                                    }
                                }
                                try {
                                    Bundle bundle = context5.getPackageManager().getApplicationInfo(context5.getPackageName(), RecyclerView.a0.FLAG_IGNORE).metaData;
                                    if (bundle != null && bundle.containsKey("ScopedStorage")) {
                                        z4 = Boolean.parseBoolean(String.valueOf(bundle.get("ScopedStorage")));
                                        e4 = d.e(context5);
                                        if (e4 != null) {
                                            while (true) {
                                                try {
                                                    if (e4.getEventType() == 2) {
                                                        if (j.a("application", e4.getName())) {
                                                            int i11 = context5.getApplicationInfo().targetSdkVersion;
                                                            d dVar4 = d.f8005a;
                                                            boolean attributeBooleanValue = e4.getAttributeBooleanValue("http://schemas.android.com/apk/res/android", "requestLegacyExternalStorage", false);
                                                            if (i11 >= 29 && !attributeBooleanValue) {
                                                                if (arrayList.contains("android.permission.MANAGE_EXTERNAL_STORAGE") || !z4) {
                                                                    throw new IllegalStateException("Please register the android:requestLegacyExternalStorage=\"true\" attribute in the AndroidManifest.xml file, otherwise it will cause incompatibility with the old version");
                                                                }
                                                            }
                                                            if (i11 >= 30 && !arrayList.contains("android.permission.MANAGE_EXTERNAL_STORAGE")) {
                                                                if (!z4) {
                                                                    throw new IllegalArgumentException("The storage permission application is abnormal. If you have adapted the scope storage, please register the <meta-data android:name=\"ScopedStorage\" android:value=\"true\" /> attribute in the AndroidManifest.xml file. If there is no adaptation scope storage, please use android.permission.MANAGE_EXTERNAL_STORAGE to apply for permission");
                                                                }
                                                            }
                                                        }
                                                    }
                                                    if (e4.next() == 1) {
                                                        break;
                                                    }
                                                } catch (IOException e8) {
                                                    e8.printStackTrace();
                                                } catch (XmlPullParserException e9) {
                                                    e9.printStackTrace();
                                                } catch (Throwable th) {
                                                    e4.close();
                                                    throw th;
                                                }
                                            }
                                            e4.close();
                                        }
                                    }
                                } catch (PackageManager.NameNotFoundException e10) {
                                    e5 = e10;
                                    e5.printStackTrace();
                                    z4 = false;
                                    e4 = d.e(context5);
                                    if (e4 != null) {
                                    }
                                    context = this.f8008a;
                                    j.e(context, str14);
                                    j.e(arrayList, "requestPermissions");
                                    if (context.getApplicationInfo().targetSdkVersion >= 31) {
                                    }
                                    if (arrayList.contains("android.permission.ACCESS_BACKGROUND_LOCATION")) {
                                    }
                                    context2 = this.f8008a;
                                    j.e(context2, str14);
                                    j.e(arrayList, "requestPermissions");
                                    String str192 = "android.permission.BLUETOOTH_ADVERTISE";
                                    String str202 = "android.permission.BLUETOOTH_CONNECT";
                                    if (!arrayList.contains("android.permission.BLUETOOTH_SCAN")) {
                                    }
                                    if (context2.getApplicationInfo().targetSdkVersion < i4) {
                                    }
                                }
                            } catch (PackageManager.NameNotFoundException e11) {
                                e5 = e11;
                                i3 = i8;
                                str6 = "android.permission.READ_EXTERNAL_STORAGE";
                                e5.printStackTrace();
                                z4 = false;
                                e4 = d.e(context5);
                                if (e4 != null) {
                                }
                                context = this.f8008a;
                                j.e(context, str14);
                                j.e(arrayList, "requestPermissions");
                                if (context.getApplicationInfo().targetSdkVersion >= 31) {
                                }
                                if (arrayList.contains("android.permission.ACCESS_BACKGROUND_LOCATION")) {
                                }
                                context2 = this.f8008a;
                                j.e(context2, str14);
                                j.e(arrayList, "requestPermissions");
                                String str1922 = "android.permission.BLUETOOTH_ADVERTISE";
                                String str2022 = "android.permission.BLUETOOTH_CONNECT";
                                if (!arrayList.contains("android.permission.BLUETOOTH_SCAN")) {
                                }
                                if (context2.getApplicationInfo().targetSdkVersion < i4) {
                                }
                            }
                            z4 = false;
                            e4 = d.e(context5);
                            if (e4 != null) {
                            }
                        } else {
                            i3 = i8;
                            str7 = "android.permission.WRITE_EXTERNAL_STORAGE";
                            str6 = "android.permission.READ_EXTERNAL_STORAGE";
                        }
                        context = this.f8008a;
                        j.e(context, str14);
                        j.e(arrayList, "requestPermissions");
                        if (context.getApplicationInfo().targetSdkVersion >= 31 || !arrayList.contains("android.permission.ACCESS_FINE_LOCATION") || arrayList.contains("android.permission.ACCESS_COARSE_LOCATION")) {
                            if (arrayList.contains("android.permission.ACCESS_BACKGROUND_LOCATION")) {
                                if (!arrayList.contains("android.permission.ACCESS_COARSE_LOCATION") || arrayList.contains("android.permission.ACCESS_FINE_LOCATION")) {
                                    Iterator it4 = arrayList.iterator();
                                    while (it4.hasNext()) {
                                        String str21 = (String) it4.next();
                                        if (!"android.permission.ACCESS_FINE_LOCATION".equals(str21) && !"android.permission.ACCESS_COARSE_LOCATION".equals(str21) && !"android.permission.ACCESS_BACKGROUND_LOCATION".equals(str21)) {
                                            throw new IllegalArgumentException("Because it includes background location permissions, do not apply for permissions unrelated to location");
                                        }
                                    }
                                } else {
                                    throw new IllegalArgumentException("The application for background location permissions must include precise location permissions");
                                }
                            }
                            context2 = this.f8008a;
                            j.e(context2, str14);
                            j.e(arrayList, "requestPermissions");
                            String str19222 = "android.permission.BLUETOOTH_ADVERTISE";
                            String str20222 = "android.permission.BLUETOOTH_CONNECT";
                            i4 = (!arrayList.contains("android.permission.BLUETOOTH_SCAN") || arrayList.contains(str20222) || arrayList.contains(str19222) || arrayList.contains("android.permission.SCHEDULE_EXACT_ALARM")) ? 31 : arrayList.contains("android.permission.MANAGE_EXTERNAL_STORAGE") ? 30 : (arrayList.contains("android.permission.ACCESS_BACKGROUND_LOCATION") || arrayList.contains("android.permission.ACTIVITY_RECOGNITION") || arrayList.contains("android.permission.ACCESS_MEDIA_LOCATION")) ? 29 : arrayList.contains("android.permission.ACCEPT_HANDOVER") ? 28 : (arrayList.contains("android.permission.REQUEST_INSTALL_PACKAGES") || arrayList.contains("android.permission.ANSWER_PHONE_CALLS") || arrayList.contains("android.permission.READ_PHONE_NUMBERS")) ? 26 : 23;
                            if (context2.getApplicationInfo().targetSdkVersion < i4) {
                                Context context6 = this.f8008a;
                                j.e(context6, str14);
                                j.e(arrayList, "requestPermissions");
                                d dVar5 = d.f8005a;
                                j.e(context6, str14);
                                HashMap hashMap = new HashMap();
                                XmlResourceParser e12 = d.e(context6);
                                if (e12 != null) {
                                    while (true) {
                                        try {
                                            str = str14;
                                            if (e12.getEventType() == 2) {
                                                try {
                                                    if (j.a("uses-permission", e12.getName())) {
                                                        String attributeValue = e12.getAttributeValue("http://schemas.android.com/apk/res/android", "name");
                                                        j.d(attributeValue, "parser.getAttributeValue(androidNamespace, \"name\")");
                                                        hashMap.put(attributeValue, Integer.valueOf(e12.getAttributeIntValue("http://schemas.android.com/apk/res/android", "maxSdkVersion", Api.BaseClientBuilder.API_PRIORITY_OTHER)));
                                                    }
                                                } catch (IOException e13) {
                                                    e2 = e13;
                                                    e2.printStackTrace();
                                                    e12.close();
                                                    if (hashMap.isEmpty()) {
                                                    }
                                                    if (!hashMap.isEmpty()) {
                                                    }
                                                } catch (XmlPullParserException e14) {
                                                    e3 = e14;
                                                    e3.printStackTrace();
                                                    e12.close();
                                                    if (hashMap.isEmpty()) {
                                                    }
                                                    if (!hashMap.isEmpty()) {
                                                    }
                                                }
                                            }
                                            if (e12.next() == 1) {
                                                break;
                                            }
                                            str14 = str;
                                        } catch (IOException e15) {
                                            e2 = e15;
                                            str = str14;
                                            e2.printStackTrace();
                                            e12.close();
                                            if (hashMap.isEmpty()) {
                                            }
                                            if (!hashMap.isEmpty()) {
                                            }
                                        } catch (XmlPullParserException e16) {
                                            e3 = e16;
                                            str = str14;
                                            e3.printStackTrace();
                                            e12.close();
                                            if (hashMap.isEmpty()) {
                                            }
                                            if (!hashMap.isEmpty()) {
                                            }
                                        } catch (Throwable th2) {
                                            e12.close();
                                            throw th2;
                                        }
                                    }
                                    e12.close();
                                } else {
                                    str = str14;
                                }
                                if (hashMap.isEmpty()) {
                                    try {
                                        String[] strArr = context6.getPackageManager().getPackageInfo(context6.getPackageName(), RecyclerView.a0.FLAG_APPEARED_IN_PRE_LAYOUT).requestedPermissions;
                                        if (strArr != null) {
                                            int length2 = strArr.length;
                                            int i12 = 0;
                                            while (i12 < length2) {
                                                String str22 = strArr[i12];
                                                i12++;
                                                j.d(str22, "permission");
                                                hashMap.put(str22, Integer.valueOf((int) Api.BaseClientBuilder.API_PRIORITY_OTHER));
                                            }
                                        }
                                    } catch (PackageManager.NameNotFoundException e17) {
                                        e17.printStackTrace();
                                    }
                                }
                                if (!hashMap.isEmpty()) {
                                    i2 = i3;
                                    int i13 = i2 >= 24 ? context6.getApplicationInfo().minSdkVersion : 23;
                                    Iterator it5 = arrayList.iterator();
                                    while (it5.hasNext()) {
                                        String str23 = (String) it5.next();
                                        if ("android.permission.NOTIFICATION_SERVICE".equals(str23) || "android.permission.BIND_NOTIFICATION_LISTENER_SERVICE".equals(str23)) {
                                            it = it5;
                                            str12 = str7;
                                            str13 = str6;
                                            str8 = str19222;
                                            str11 = str18;
                                            str9 = str20222;
                                            str10 = str17;
                                        } else if (!"android.permission.BIND_VPN_SERVICE".equals(str23)) {
                                            if (i13 < 31) {
                                                if ("android.permission.BLUETOOTH_SCAN".equals(str23)) {
                                                    i5 = 30;
                                                    c.a(hashMap, "android.permission.BLUETOOTH_ADMIN", 30);
                                                    c.a(hashMap, "android.permission.ACCESS_FINE_LOCATION", 30);
                                                } else {
                                                    i5 = 30;
                                                }
                                                if (str20222.equals(str23)) {
                                                    it = it5;
                                                    c.a(hashMap, "android.permission.BLUETOOTH", i5);
                                                } else {
                                                    it = it5;
                                                }
                                                if (str19222.equals(str23)) {
                                                    c.a(hashMap, "android.permission.BLUETOOTH_ADMIN", i5);
                                                }
                                            } else {
                                                it = it5;
                                                i5 = 30;
                                            }
                                            if (i13 >= i5 || !"android.permission.MANAGE_EXTERNAL_STORAGE".equals(str23)) {
                                                str12 = str7;
                                                str13 = str6;
                                                i6 = 29;
                                            } else {
                                                i6 = 29;
                                                str13 = str6;
                                                c.a(hashMap, str13, 29);
                                                str12 = str7;
                                                c.a(hashMap, str12, 29);
                                            }
                                            if (i13 >= i6 || !"android.permission.ACTIVITY_RECOGNITION".equals(str23)) {
                                                str8 = str19222;
                                                str11 = str18;
                                                i7 = 26;
                                            } else {
                                                i7 = 26;
                                                str8 = str19222;
                                                str11 = str18;
                                                c.a(hashMap, str11, 26);
                                            }
                                            if (i13 >= i7 || !"android.permission.READ_PHONE_NUMBERS".equals(str23)) {
                                                str9 = str20222;
                                                str10 = str17;
                                            } else {
                                                str9 = str20222;
                                                str10 = str17;
                                                c.a(hashMap, str10, 25);
                                            }
                                            c.a(hashMap, str23, Api.BaseClientBuilder.API_PRIORITY_OTHER);
                                        }
                                        str6 = str13;
                                        str17 = str10;
                                        str20222 = str9;
                                        it5 = it;
                                        str18 = str11;
                                        str19222 = str8;
                                        str7 = str12;
                                    }
                                    str2 = str17;
                                    str3 = str18;
                                    str4 = str7;
                                    str5 = str6;
                                } else {
                                    throw new IllegalStateException("No permissions are registered in the AndroidManifest.xml file");
                                }
                            } else {
                                throw new RuntimeException(e.d.a.a.a.w("The targetSdkVersion SDK must be ", i4, " or more, if you do not want to upgrade targetSdkVersion, please apply with the old permissions"));
                            }
                        } else {
                            throw new IllegalArgumentException("If your app targets Android 12 or higher and requests the ACCESS_FINE_LOCATION runtime permission, you must also request the ACCESS_COARSE_LOCATION permission. You must include both permissions in a single runtime request.");
                        }
                    } else {
                        i2 = i8;
                        str = str14;
                        activity2 = activity;
                        str3 = "android.permission.BODY_SENSORS";
                        str5 = "android.permission.READ_EXTERNAL_STORAGE";
                        str2 = "android.permission.READ_PHONE_STATE";
                        str4 = "android.permission.WRITE_EXTERNAL_STORAGE";
                    }
                    if (!(arrayList instanceof o.s.c.z.a) || (arrayList instanceof o.s.c.z.b)) {
                        j.e(arrayList, "requestPermissions");
                        if (!(i2 >= 31) && arrayList.contains("android.permission.BLUETOOTH_SCAN") && !arrayList.contains("android.permission.ACCESS_FINE_LOCATION")) {
                            arrayList.add("android.permission.ACCESS_FINE_LOCATION");
                        }
                        if (arrayList.contains("android.permission.MANAGE_EXTERNAL_STORAGE")) {
                            if (arrayList.contains(str5) || arrayList.contains(str4)) {
                                throw new IllegalArgumentException("If you have applied for MANAGE_EXTERNAL_STORAGE permissions, do not apply for the READ_EXTERNAL_STORAGE and WRITE_EXTERNAL_STORAGE permissions");
                            }
                            if (!(i2 >= 30)) {
                                arrayList.add(str5);
                                arrayList.add(str4);
                            }
                        }
                        if (!(i2 >= 26) && arrayList.contains("android.permission.READ_PHONE_NUMBERS") && !arrayList.contains(str2)) {
                            arrayList.add(str2);
                        }
                        if (!(i2 >= 29) && arrayList.contains("android.permission.ACTIVITY_RECOGNITION") && !arrayList.contains(str3)) {
                            arrayList.add(str3);
                        }
                        b bVar = b.f8004a;
                        Context context7 = this.f8008a;
                        Objects.requireNonNull(bVar);
                        j.e(context7, str);
                        j.e(arrayList, "permissions");
                        if (!arrayList.isEmpty()) {
                            Iterator it6 = arrayList.iterator();
                            while (true) {
                                if (it6.hasNext()) {
                                    if (!b.a(context7, (String) it6.next())) {
                                        break;
                                    }
                                } else {
                                    z3 = true;
                                    break;
                                }
                            }
                        } else {
                            z3 = false;
                        }
                        if (!z3) {
                            a aVar = this.c;
                            j.c(aVar);
                            j.c(activity2);
                            aVar.a(activity2, this.f8009e, arrayList);
                            return;
                        } else if (this.f8009e != null) {
                            a aVar2 = this.c;
                            j.c(aVar2);
                            aVar2.b(activity2, arrayList, arrayList, true, this.f8009e);
                            return;
                        } else {
                            return;
                        }
                    } else {
                        y.d(arrayList, "kotlin.collections.MutableList");
                        throw null;
                    }
                } else {
                    return;
                }
            } else {
                return;
            }
        } else if (booleanValue) {
            throw new IllegalStateException("The activity has been destroyed, please manually determine the status of the activity");
        }
        z = false;
        if (!z) {
        }
    }
}