导航菜单

页面标题

页面副标题

凤凰之城 v1.0.3 - r.java 源代码

正在查看: 凤凰之城 v1.0.3 应用的 r.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package x;

import android.app.Activity;
import android.app.AlarmManager;
import android.app.NotificationManager;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Build;
import android.os.Environment;
import android.os.PowerManager;
import android.provider.Settings;
import android.util.Log;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.app.ActivityCompat;
import androidx.core.app.NotificationCompat;
import androidx.core.app.NotificationManagerCompat;
import androidx.core.content.ContextCompat;
import com.bykv.vk.component.ttvideo.player.TTPlayerKeys;
import io.flutter.plugin.common.PluginRegistry;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;

public final class r implements PluginRegistry.ActivityResultListener, PluginRegistry.RequestPermissionsResultListener {

    @NonNull
    public final Context f4970a;

    @Nullable
    public b f4971b;

    @Nullable
    public Activity f4972c;

    public int f4973d;

    public Map<Integer, Integer> f4974e;

    @FunctionalInterface
    public interface a {
        void onSuccess(int i2);
    }

    @FunctionalInterface
    public interface b {
        void a(Map<Integer, Integer> map);
    }

    @FunctionalInterface
    public interface c {
        void onSuccess(boolean z2);
    }

    public r(@NonNull Context context) {
        this.f4970a = context;
    }

    public final int a() {
        List<String> c2 = t.c(this.f4970a, 21);
        if (!(c2 == null || c2.isEmpty())) {
            return 1;
        }
        Log.d("permissions_handler", "Bluetooth permission missing in manifest");
        return 0;
    }

    public final int b() {
        int checkSelfPermission;
        if (Build.VERSION.SDK_INT < 33) {
            return NotificationManagerCompat.from(this.f4970a).areNotificationsEnabled() ? 1 : 0;
        }
        checkSelfPermission = this.f4970a.checkSelfPermission("android.permission.POST_NOTIFICATIONS");
        if (checkSelfPermission == 0) {
            return 1;
        }
        return t.b(this.f4972c, "android.permission.POST_NOTIFICATIONS");
    }

    public void c(int i2, a aVar) {
        aVar.onSuccess(d(i2));
    }

    public final int d(int i2) {
        boolean isIgnoringBatteryOptimizations;
        boolean isExternalStorageManager;
        boolean canDrawOverlays;
        boolean canRequestPackageInstalls;
        boolean isNotificationPolicyAccessGranted;
        boolean canScheduleExactAlarms;
        if (i2 == 17) {
            return b();
        }
        if (i2 == 21) {
            return a();
        }
        if ((i2 == 30 || i2 == 28 || i2 == 29) && Build.VERSION.SDK_INT < 31) {
            return a();
        }
        if ((i2 == 37 || i2 == 0) && !e()) {
            return 0;
        }
        List<String> c2 = t.c(this.f4970a, i2);
        if (c2 == null) {
            Log.d("permissions_handler", "No android specific permissions needed for: " + i2);
            return 1;
        }
        if (c2.size() == 0) {
            Log.d("permissions_handler", "No permissions found in manifest for: " + c2 + i2);
            if (i2 == 16 && Build.VERSION.SDK_INT < 23) {
                return 2;
            }
            if (i2 != 22 || Build.VERSION.SDK_INT >= 30) {
                return Build.VERSION.SDK_INT < 23 ? 1 : 0;
            }
            return 2;
        }
        if (this.f4970a.getApplicationInfo().targetSdkVersion >= 23) {
            HashSet hashSet = new HashSet();
            for (String str : c2) {
                if (i2 == 16) {
                    String packageName = this.f4970a.getPackageName();
                    PowerManager powerManager = (PowerManager) this.f4970a.getSystemService("power");
                    if (powerManager != null) {
                        isIgnoringBatteryOptimizations = powerManager.isIgnoringBatteryOptimizations(packageName);
                        if (isIgnoringBatteryOptimizations) {
                            hashSet.add(1);
                        }
                    }
                    hashSet.add(0);
                } else if (i2 == 22) {
                    if (Build.VERSION.SDK_INT < 30) {
                        hashSet.add(2);
                    }
                    isExternalStorageManager = Environment.isExternalStorageManager();
                    hashSet.add(Integer.valueOf(isExternalStorageManager ? 1 : 0));
                } else if (i2 == 23) {
                    canDrawOverlays = Settings.canDrawOverlays(this.f4970a);
                    hashSet.add(Integer.valueOf(canDrawOverlays ? 1 : 0));
                } else if (i2 == 24) {
                    if (Build.VERSION.SDK_INT >= 26) {
                        canRequestPackageInstalls = this.f4970a.getPackageManager().canRequestPackageInstalls();
                        hashSet.add(Integer.valueOf(canRequestPackageInstalls ? 1 : 0));
                    }
                } else if (i2 == 27) {
                    isNotificationPolicyAccessGranted = ((NotificationManager) this.f4970a.getSystemService("notification")).isNotificationPolicyAccessGranted();
                    hashSet.add(Integer.valueOf(isNotificationPolicyAccessGranted ? 1 : 0));
                } else if (i2 == 34) {
                    if (Build.VERSION.SDK_INT >= 31) {
                        canScheduleExactAlarms = ((AlarmManager) this.f4970a.getSystemService(NotificationCompat.CATEGORY_ALARM)).canScheduleExactAlarms();
                        hashSet.add(Integer.valueOf(canScheduleExactAlarms ? 1 : 0));
                    } else {
                        hashSet.add(1);
                    }
                } else if (i2 == 9 || i2 == 32) {
                    int checkSelfPermission = ContextCompat.checkSelfPermission(this.f4970a, str);
                    if ((Build.VERSION.SDK_INT >= 34 ? ContextCompat.checkSelfPermission(this.f4970a, "android.permission.READ_MEDIA_VISUAL_USER_SELECTED") : checkSelfPermission) == 0 && checkSelfPermission == -1) {
                        hashSet.add(3);
                    } else if (checkSelfPermission == 0) {
                        hashSet.add(1);
                    } else {
                        hashSet.add(Integer.valueOf(t.b(this.f4972c, str)));
                    }
                } else if (ContextCompat.checkSelfPermission(this.f4970a, str) != 0) {
                    hashSet.add(Integer.valueOf(t.b(this.f4972c, str)));
                }
            }
            if (!hashSet.isEmpty()) {
                return t.j(hashSet).intValue();
            }
        }
        return 1;
    }

    public final boolean e() {
        List<String> c2 = t.c(this.f4970a, 37);
        boolean z2 = c2 != null && c2.contains("android.permission.WRITE_CALENDAR");
        boolean z3 = c2 != null && c2.contains("android.permission.READ_CALENDAR");
        if (z2 && z3) {
            return true;
        }
        if (!z2) {
            Log.d("permissions_handler", "android.permission.WRITE_CALENDAR missing in manifest");
        }
        if (!z3) {
            Log.d("permissions_handler", "android.permission.READ_CALENDAR missing in manifest");
        }
        return false;
    }

    public final void f(String str, int i2) {
        if (this.f4972c == null) {
            return;
        }
        Intent intent = new Intent(str);
        if (!str.equals("android.settings.NOTIFICATION_POLICY_ACCESS_SETTINGS")) {
            intent.setData(Uri.parse("package:" + this.f4972c.getPackageName()));
        }
        this.f4972c.startActivityForResult(intent, i2);
        this.f4973d++;
    }

    public void g(@Nullable Activity activity) {
        this.f4972c = activity;
    }

    public void h(int i2, c cVar, x.b bVar) {
        Activity activity = this.f4972c;
        if (activity == null) {
            Log.d("permissions_handler", "Unable to detect current Activity.");
            bVar.onError("PermissionHandler.PermissionManager", "Unable to detect current Android Activity.");
            return;
        }
        List<String> c2 = t.c(activity, i2);
        if (c2 == null) {
            Log.d("permissions_handler", "No android specific permissions needed for: " + i2);
            cVar.onSuccess(false);
            return;
        }
        if (!c2.isEmpty()) {
            cVar.onSuccess(ActivityCompat.shouldShowRequestPermissionRationale(this.f4972c, c2.get(0)));
            return;
        }
        Log.d("permissions_handler", "No permissions found in manifest for: " + i2 + " no need to show request rationale");
        cVar.onSuccess(false);
    }

    public boolean onActivityResult(int i2, int i3, Intent intent) {
        int i4;
        boolean canScheduleExactAlarms;
        boolean isNotificationPolicyAccessGranted;
        boolean canRequestPackageInstalls;
        boolean canDrawOverlays;
        boolean isExternalStorageManager;
        boolean isIgnoringBatteryOptimizations;
        Activity activity = this.f4972c;
        int i5 = 0;
        i5 = 0;
        if (activity == null) {
            return false;
        }
        if (this.f4974e == null) {
            this.f4973d = 0;
            return false;
        }
        int i6 = 23;
        if (i2 == 209) {
            if (Build.VERSION.SDK_INT >= 23) {
                String packageName = this.f4970a.getPackageName();
                PowerManager powerManager = (PowerManager) this.f4970a.getSystemService("power");
                if (powerManager != null) {
                    isIgnoringBatteryOptimizations = powerManager.isIgnoringBatteryOptimizations(packageName);
                    if (isIgnoringBatteryOptimizations) {
                        i5 = 1;
                    }
                }
            } else {
                i5 = 2;
            }
            i6 = 16;
            i4 = i5;
        } else if (i2 == 210) {
            if (Build.VERSION.SDK_INT < 30) {
                return false;
            }
            isExternalStorageManager = Environment.isExternalStorageManager();
            i6 = 22;
            i4 = isExternalStorageManager;
        } else if (i2 == 211) {
            if (Build.VERSION.SDK_INT < 23) {
                return false;
            }
            canDrawOverlays = Settings.canDrawOverlays(activity);
            i4 = canDrawOverlays;
        } else if (i2 == 212) {
            if (Build.VERSION.SDK_INT < 26) {
                return false;
            }
            canRequestPackageInstalls = activity.getPackageManager().canRequestPackageInstalls();
            i6 = 24;
            i4 = canRequestPackageInstalls;
        } else if (i2 == 213) {
            if (Build.VERSION.SDK_INT < 23) {
                return false;
            }
            isNotificationPolicyAccessGranted = ((NotificationManager) activity.getSystemService("notification")).isNotificationPolicyAccessGranted();
            i6 = 27;
            i4 = isNotificationPolicyAccessGranted;
        } else {
            if (i2 != 214) {
                return false;
            }
            i6 = 34;
            AlarmManager alarmManager = (AlarmManager) activity.getSystemService(NotificationCompat.CATEGORY_ALARM);
            if (Build.VERSION.SDK_INT >= 31) {
                canScheduleExactAlarms = alarmManager.canScheduleExactAlarms();
                i4 = canScheduleExactAlarms;
            } else {
                i4 = 1;
            }
        }
        this.f4974e.put(Integer.valueOf(i6), Integer.valueOf(i4));
        int i7 = this.f4973d - 1;
        this.f4973d = i7;
        b bVar = this.f4971b;
        if (bVar != null && i7 == 0) {
            bVar.a(this.f4974e);
        }
        return true;
    }

    public boolean onRequestPermissionsResult(int i2, @NonNull String[] strArr, @NonNull int[] iArr) {
        int g2;
        if (i2 != 24) {
            this.f4973d = 0;
            return false;
        }
        if (this.f4974e == null) {
            return false;
        }
        if (strArr.length == 0 && iArr.length == 0) {
            Log.w("permissions_handler", "onRequestPermissionsResult is called without results. This is probably caused by interfering request codes. If you see this error, please file an issue in flutter-permission-handler, including a list of plugins used by this application: https://github.com/Baseflow/flutter-permission-handler/issues");
            return false;
        }
        List asList = Arrays.asList(strArr);
        int indexOf = asList.indexOf("android.permission.WRITE_CALENDAR");
        if (indexOf >= 0) {
            int k2 = t.k(this.f4972c, "android.permission.WRITE_CALENDAR", iArr[indexOf]);
            this.f4974e.put(36, Integer.valueOf(k2));
            int indexOf2 = asList.indexOf("android.permission.READ_CALENDAR");
            if (indexOf2 >= 0) {
                int intValue = t.i(Integer.valueOf(k2), Integer.valueOf(t.k(this.f4972c, "android.permission.READ_CALENDAR", iArr[indexOf2]))).intValue();
                this.f4974e.put(37, Integer.valueOf(intValue));
                this.f4974e.put(0, Integer.valueOf(intValue));
            }
        }
        for (int i3 = 0; i3 < strArr.length; i3++) {
            String str = strArr[i3];
            if (!str.equals("android.permission.WRITE_CALENDAR") && !str.equals("android.permission.READ_CALENDAR") && (g2 = t.g(str)) != 20) {
                int i4 = iArr[i3];
                if (g2 == 8) {
                    this.f4974e.put(8, t.i(this.f4974e.get(8), Integer.valueOf(t.k(this.f4972c, str, i4))));
                } else if (g2 == 7) {
                    if (!this.f4974e.containsKey(7)) {
                        this.f4974e.put(7, Integer.valueOf(t.k(this.f4972c, str, i4)));
                    }
                    if (!this.f4974e.containsKey(14)) {
                        this.f4974e.put(14, Integer.valueOf(t.k(this.f4972c, str, i4)));
                    }
                } else if (g2 == 4) {
                    int k3 = t.k(this.f4972c, str, i4);
                    if (!this.f4974e.containsKey(4)) {
                        this.f4974e.put(4, Integer.valueOf(k3));
                    }
                } else if (g2 == 3) {
                    int k4 = t.k(this.f4972c, str, i4);
                    if (Build.VERSION.SDK_INT < 29 && !this.f4974e.containsKey(4)) {
                        this.f4974e.put(4, Integer.valueOf(k4));
                    }
                    if (!this.f4974e.containsKey(5)) {
                        this.f4974e.put(5, Integer.valueOf(k4));
                    }
                    this.f4974e.put(Integer.valueOf(g2), Integer.valueOf(k4));
                } else if (g2 == 9 || g2 == 32) {
                    this.f4974e.put(Integer.valueOf(g2), Integer.valueOf(d(g2)));
                } else if (!this.f4974e.containsKey(Integer.valueOf(g2))) {
                    this.f4974e.put(Integer.valueOf(g2), Integer.valueOf(t.k(this.f4972c, str, i4)));
                }
            }
        }
        int length = this.f4973d - iArr.length;
        this.f4973d = length;
        b bVar = this.f4971b;
        if (bVar == null || length != 0) {
            return true;
        }
        bVar.a(this.f4974e);
        return true;
    }

    public void requestPermissions(List<Integer> list, b bVar, x.b bVar2) {
        if (this.f4973d > 0) {
            bVar2.onError("PermissionHandler.PermissionManager", "A request for permissions is already running, please wait for it to finish before doing another request (note that you can request multiple permissions at the same time).");
            return;
        }
        if (this.f4972c == null) {
            Log.d("permissions_handler", "Unable to detect current Activity.");
            bVar2.onError("PermissionHandler.PermissionManager", "Unable to detect current Android Activity.");
            return;
        }
        this.f4971b = bVar;
        this.f4974e = new HashMap();
        this.f4973d = 0;
        ArrayList arrayList = new ArrayList();
        for (Integer num : list) {
            if (d(num.intValue()) != 1) {
                List<String> c2 = t.c(this.f4972c, num.intValue());
                if (c2 != null && !c2.isEmpty()) {
                    int i2 = Build.VERSION.SDK_INT;
                    if (i2 >= 23 && num.intValue() == 16) {
                        f("android.settings.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS", 209);
                    } else if (i2 >= 30 && num.intValue() == 22) {
                        f("android.settings.MANAGE_APP_ALL_FILES_ACCESS_PERMISSION", 210);
                    } else if (i2 >= 23 && num.intValue() == 23) {
                        f("android.settings.action.MANAGE_OVERLAY_PERMISSION", 211);
                    } else if (i2 >= 26 && num.intValue() == 24) {
                        f("android.settings.MANAGE_UNKNOWN_APP_SOURCES", 212);
                    } else if (i2 >= 23 && num.intValue() == 27) {
                        f("android.settings.NOTIFICATION_POLICY_ACCESS_SETTINGS", 213);
                    } else if (i2 >= 31 && num.intValue() == 34) {
                        f("android.settings.REQUEST_SCHEDULE_EXACT_ALARM", TTPlayerKeys.OptionIsDebugQcomVpp);
                    } else if (num.intValue() != 37 && num.intValue() != 0) {
                        arrayList.addAll(c2);
                        this.f4973d += c2.size();
                    } else if (e()) {
                        arrayList.add("android.permission.WRITE_CALENDAR");
                        arrayList.add("android.permission.READ_CALENDAR");
                        this.f4973d += 2;
                    } else {
                        this.f4974e.put(num, 0);
                    }
                } else if (!this.f4974e.containsKey(num)) {
                    if (num.intValue() != 16 || Build.VERSION.SDK_INT >= 23) {
                        this.f4974e.put(num, 0);
                    } else {
                        this.f4974e.put(num, 2);
                    }
                    if (num.intValue() != 22 || Build.VERSION.SDK_INT >= 30) {
                        this.f4974e.put(num, 0);
                    } else {
                        this.f4974e.put(num, 2);
                    }
                }
            } else if (!this.f4974e.containsKey(num)) {
                this.f4974e.put(num, 1);
            }
        }
        if (arrayList.size() > 0) {
            ActivityCompat.requestPermissions(this.f4972c, (String[]) arrayList.toArray(new String[0]), 24);
        }
        b bVar3 = this.f4971b;
        if (bVar3 == null || this.f4973d != 0) {
            return;
        }
        bVar3.a(this.f4974e);
    }
}