package K.K.ῲ;

import android.annotation.SuppressLint;
import android.app.ActivityManager;
import android.bluetooth.BluetoothAdapter;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.graphics.Point;
import android.location.LocationManager;
import android.os.BatteryManager;
import android.os.Build;
import android.os.Environment;
import android.os.StatFs;
import android.os.SystemClock;
import android.provider.Settings;
import android.support.v4.media.session.PlaybackStateCompat;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.WindowManager;
import android.webkit.WebSettings;
import androidx.recyclerview.widget.RecyclerView;
import com.facebook.internal.AnalyticsEvents;
import com.facebook.internal.security.CertificateUtil;
import com.facebook.places.model.PlaceFields;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileFilter;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.LineNumberReader;
import java.lang.reflect.Field;
import java.net.Inet4Address;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Enumeration;
import java.util.Locale;
import java.util.TimeZone;
import org.json.JSONArray;
import org.json.JSONObject;
import ῲ.ᨨ.ῲ.C1806;
import K.K.ʬ.C2360;
import K.K.K.ʬ.C2369;

/* renamed from: K.K.ῲ.ῲ  reason: contains not printable characters */
public class C2364 implements AbstractC2366 {

    /* renamed from: K  reason: contains not printable characters */
    public final Context f8174;

    /* renamed from: K.K.ῲ.ῲ$K  reason: contains not printable characters */
    public class C2365 implements FileFilter {
        public C2365(C2364 r1) {
        }

        public boolean accept(File file) {
            String name = file.getName();
            if (!name.startsWith("cpu")) {
                return false;
            }
            for (int i = 3; i < name.length(); i++) {
                if (name.charAt(i) < '0' || name.charAt(i) > '9') {
                    return false;
                }
            }
            return true;
        }
    }

    public C2364(Context context) {
        this.f8174 = context;
    }

    /* renamed from: ῲ  reason: contains not printable characters */
    public static boolean m6196(String str) {
        Process process = null;
        try {
            Runtime runtime = Runtime.getRuntime();
            process = runtime.exec("ls -l " + str);
            String readLine = new BufferedReader(new InputStreamReader(process.getInputStream())).readLine();
            if (readLine != null && readLine.length() >= 4) {
                char charAt = readLine.charAt(3);
                if (charAt == 's' || charAt == 'x') {
                    process.destroy();
                    return true;
                }
            }
        } catch (IOException e) {
            e.printStackTrace();
            if (0 == 0) {
                return false;
            }
        } catch (Throwable th) {
            if (0 != 0) {
                process.destroy();
            }
            throw th;
        }
        process.destroy();
        return false;
    }

    /* renamed from: ʬ  reason: contains not printable characters */
    public String m6197() {
        try {
            return this.f8174.getPackageManager().getPackageInfo(this.f8174.getPackageName(), 0).packageName;
        } catch (Exception unused) {
            Log.e("zhang", "aaaaaa");
            return null;
        }
    }

    /* renamed from: Ϸ  reason: contains not printable characters */
    public String m6198() {
        return Build.getRadioVersion();
    }

    /* renamed from: В  reason: contains not printable characters */
    public String m6199() {
        return Build.VERSION.CODENAME;
    }

    /* renamed from: ѷ  reason: contains not printable characters */
    public String m6200() {
        return Build.MANUFACTURER;
    }

    /* renamed from: ӯ  reason: contains not printable characters */
    public long m6201() {
        try {
            StatFs statFs = new StatFs(Environment.getExternalStorageDirectory().getPath());
            return (((long) statFs.getBlockSize()) * ((long) statFs.getAvailableBlocks())) / PlaybackStateCompat.ACTION_PLAY_FROM_MEDIA_ID;
        } catch (Exception unused) {
            return -1;
        }
    }

    /* renamed from: Ԕ  reason: contains not printable characters */
    public long m6202() {
        return SystemClock.elapsedRealtime();
    }

    /* renamed from: Ԛ  reason: contains not printable characters */
    public String m6203() {
        return Build.TAGS;
    }

    /* renamed from: Ն  reason: contains not printable characters */
    public boolean m6204() {
        try {
            return Settings.Secure.getInt(this.f8174.getContentResolver(), "adb_enabled", 0) > 0;
        } catch (Exception unused) {
            return false;
        }
    }

    /* renamed from: ؿ  reason: contains not printable characters */
    public String m6205() {
        return Build.DEVICE;
    }

    /* renamed from: ڎ  reason: contains not printable characters */
    public boolean m6206() {
        try {
            return ((LocationManager) this.f8174.getSystemService(PlaceFields.LOCATION)).isProviderEnabled("gps");
        } catch (Exception unused) {
            return false;
        }
    }

    /* renamed from: ݜ  reason: contains not printable characters */
    public String m6207() {
        return Build.PRODUCT;
    }

    /* renamed from: ݰ  reason: contains not printable characters */
    public long m6208() {
        return SystemClock.uptimeMillis();
    }

    /* renamed from: ࠋ  reason: contains not printable characters */
    public String m6209() {
        return "Android";
    }

    /* renamed from: ࡔ  reason: contains not printable characters */
    public boolean m6210() {
        int i = Build.VERSION.SDK_INT;
        return m6233("android.hardware.nfc.hce");
    }

    /* renamed from: ಯ  reason: contains not printable characters */
    public String m6211() {
        return Build.DISPLAY;
    }

    /* renamed from: ඓ  reason: contains not printable characters */
    public String m6212() {
        try {
            return this.f8174.getPackageManager().getPackageInfo(this.f8174.getPackageName(), 64).signatures[0].toCharsString();
        } catch (Exception unused) {
            return null;
        }
    }

    /* renamed from: ผ  reason: contains not printable characters */
    public String m6213() {
        return Build.VERSION.RELEASE;
    }

    /* renamed from: ᆯ  reason: contains not printable characters */
    public String m6214() {
        StringBuilder sb = new StringBuilder();
        try {
            InputStream inputStream = new ProcessBuilder("/system/bin/cat", "/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq").start().getInputStream();
            byte[] bArr = new byte[24];
            while (inputStream.read(bArr) != -1) {
                sb.append(new String(bArr));
            }
            inputStream.close();
            return sb.toString().trim();
        } catch (Exception unused) {
            return null;
        }
    }

    /* renamed from: ሽ  reason: contains not printable characters */
    public String m6215() {
        String readLine;
        try {
            LineNumberReader lineNumberReader = new LineNumberReader(new InputStreamReader(Runtime.getRuntime().exec("cat /proc/cpuinfo").getInputStream()));
            for (int i = 1; i < 100 && (readLine = lineNumberReader.readLine()) != null; i++) {
                if (readLine.contains("Serial")) {
                    return readLine.substring(readLine.indexOf(CertificateUtil.DELIMITER) + 1).trim();
                }
            }
            return null;
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }

    /* renamed from: ኩ  reason: contains not printable characters */
    public boolean m6216() {
        if (!new File("/system/bin/su").exists() || !m6196("/system/bin/su")) {
            return new File("/system/xbin/su").exists() && m6196("/system/xbin/su");
        }
        return true;
    }

    /* renamed from: ጒ  reason: contains not printable characters */
    public String m6217() {
        return Build.FINGERPRINT;
    }

    /* renamed from: Ꮝ  reason: contains not printable characters */
    public JSONArray m6218() {
        JSONArray jSONArray = new JSONArray();
        try {
            String[] strArr = this.f8174.getPackageManager().getPackageInfo(m6197(), RecyclerView.AbstractC0269.FLAG_APPEARED_IN_PRE_LAYOUT).requestedPermissions;
            if (strArr != null) {
                for (String str : strArr) {
                    int r6 = C1806.m4687(this.f8174, str);
                    JSONObject jSONObject = new JSONObject();
                    jSONObject.put("name", str);
                    jSONObject.put("granted", r6 == 0);
                    jSONArray.put(jSONObject);
                }
                return jSONArray;
            }
        } catch (Exception e) {
            Log.e("zhang", e.getMessage());
        }
        return jSONArray;
    }

    /* renamed from: ᑓ  reason: contains not printable characters */
    public String m6219() {
        return Build.CPU_ABI;
    }

    /* renamed from: ᑾ  reason: contains not printable characters */
    public String m6220() {
        StringBuilder sb = new StringBuilder();
        try {
            InputStream inputStream = new ProcessBuilder("/system/bin/cat", "/sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed").start().getInputStream();
            byte[] bArr = new byte[24];
            while (inputStream.read(bArr) != -1) {
                sb.append(new String(bArr));
            }
            inputStream.close();
            return sb.toString().trim();
        } catch (Exception unused) {
            return null;
        }
    }

    /* renamed from: ᓆ  reason: contains not printable characters */
    public String m6221() {
        return Build.TYPE;
    }

    /* renamed from: ᓣ  reason: contains not printable characters */
    public String m6222() {
        return Build.HOST;
    }

    /* renamed from: ᔝ  reason: contains not printable characters */
    public float m6223() {
        try {
            DisplayMetrics displayMetrics = new DisplayMetrics();
            ((WindowManager) this.f8174.getSystemService("window")).getDefaultDisplay().getMetrics(displayMetrics);
            return displayMetrics.density;
        } catch (Exception unused) {
            return 0.0f;
        }
    }

    /* renamed from: ᕣ  reason: contains not printable characters */
    public String m6224() {
        try {
            if (C2369.m6286(this.f8174, "android.permission.BLUETOOTH")) {
                if (Build.VERSION.SDK_INT < 23) {
                    return BluetoothAdapter.getDefaultAdapter().getAddress();
                }
                BluetoothAdapter defaultAdapter = BluetoothAdapter.getDefaultAdapter();
                Field declaredField = defaultAdapter.getClass().getDeclaredField("mService");
                declaredField.setAccessible(true);
                Object obj = declaredField.get(defaultAdapter);
                if (obj == null) {
                    return null;
                }
                Object invoke = obj.getClass().getMethod("getAddress", new Class[0]).invoke(obj, new Object[0]);
                if (invoke instanceof String) {
                    return (String) invoke;
                }
            }
        } catch (Exception unused) {
        }
        return null;
    }

    /* renamed from: ᝁ  reason: contains not printable characters */
    public String m6225() {
        String readLine;
        try {
            BufferedReader bufferedReader = new BufferedReader(new FileReader("/proc/cpuinfo"));
            do {
                readLine = bufferedReader.readLine();
                if (readLine == null) {
                    bufferedReader.close();
                    return null;
                }
            } while (!readLine.contains("Hardware"));
            return readLine.split(CertificateUtil.DELIMITER)[1].trim();
        } catch (Exception unused) {
            return null;
        }
    }

    /* JADX WARNING: Removed duplicated region for block: B:11:0x0029 A[Catch:{ Exception -> 0x0040 }] */
    /* JADX WARNING: Removed duplicated region for block: B:12:0x002b A[Catch:{ Exception -> 0x0040 }] */
    /* JADX WARNING: Removed duplicated region for block: B:14:0x002e A[Catch:{ Exception -> 0x0040 }] */
    /* JADX WARNING: Removed duplicated region for block: B:16:0x0031 A[Catch:{ Exception -> 0x0040 }] */
    /* JADX WARNING: Removed duplicated region for block: B:17:0x0034 A[Catch:{ Exception -> 0x0040 }] */
    /* renamed from: ᨨ  reason: contains not printable characters */
    public String m6226() {
        boolean z;
        int intExtra;
        try {
            Intent registerReceiver = this.f8174.registerReceiver(null, new IntentFilter("android.intent.action.BATTERY_CHANGED"));
            int intExtra2 = registerReceiver.getIntExtra(AnalyticsEvents.PARAMETER_SHARE_DIALOG_CONTENT_STATUS, -1);
            boolean z2 = false;
            if (intExtra2 != 2) {
                if (intExtra2 != 5) {
                    z = false;
                    intExtra = registerReceiver.getIntExtra("plugged", -1);
                    boolean z3 = intExtra != 2;
                    if (intExtra == 1) {
                        z2 = true;
                    }
                    return !z3 ? "PLUGGED_USB" : z2 ? "PLUGGED_AC" : z ? "UNKNOWN_CHARGING" : "NOT_CHARGING";
                }
            }
            z = true;
            intExtra = registerReceiver.getIntExtra("plugged", -1);
            if (intExtra != 2) {
            }
            if (intExtra == 1) {
            }
            if (!z3) {
            }
        } catch (Exception unused) {
            return null;
        }
    }

    /* renamed from: ᴊ  reason: contains not printable characters */
    public String m6227() {
        try {
            Point point = new Point();
            ((WindowManager) this.f8174.getSystemService("window")).getDefaultDisplay().getSize(point);
            return point.x + "*" + point.y;
        } catch (Exception unused) {
            return null;
        }
    }

    /* renamed from: ᶲ  reason: contains not printable characters */
    public String m6228() {
        return C2360.m6193(this.f8174);
    }

    @SuppressLint({"HardwareIds"})
    /* renamed from: ῲ  reason: contains not printable characters */
    public String m6229() {
        try {
            return Settings.Secure.getString(this.f8174.getContentResolver(), "android_id");
        } catch (Exception unused) {
            return null;
        }
    }

    /* renamed from: ⁱ  reason: contains not printable characters */
    public String m6230() {
        try {
            return this.f8174.getPackageManager().getPackageInfo(this.f8174.getPackageName(), 0).versionName;
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }

    /* renamed from: ₱  reason: contains not printable characters */
    public String m6231() {
        try {
            if ("WIFI".equals(C2360.m6193(this.f8174))) {
                return null;
            }
            Enumeration<NetworkInterface> networkInterfaces = NetworkInterface.getNetworkInterfaces();
            while (networkInterfaces.hasMoreElements()) {
                Enumeration<InetAddress> inetAddresses = networkInterfaces.nextElement().getInetAddresses();
                while (true) {
                    if (inetAddresses.hasMoreElements()) {
                        InetAddress nextElement = inetAddresses.nextElement();
                        if (!nextElement.isLoopbackAddress() && (nextElement instanceof Inet4Address)) {
                            return nextElement.getHostAddress();
                        }
                    }
                }
            }
            return null;
        } catch (Exception unused) {
            return null;
        }
    }

    /* renamed from: K  reason: contains not printable characters */
    public boolean m6232() {
        try {
            return (this.f8174.getPackageManager().getApplicationInfo(this.f8174.getPackageName(), 0).flags & 2) != 0;
        } catch (Exception unused) {
            return false;
        }
    }

    /* renamed from: K  reason: contains not printable characters */
    public final boolean m6233(String str) {
        try {
            return this.f8174.getPackageManager().hasSystemFeature(str);
        } catch (Exception unused) {
            return false;
        }
    }

    /* renamed from: ⶍ  reason: contains not printable characters */
    public String m6234() {
        StringBuilder sb = new StringBuilder();
        try {
            InputStream inputStream = new ProcessBuilder("/system/bin/cat", "/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_min_freq").start().getInputStream();
            byte[] bArr = new byte[24];
            while (inputStream.read(bArr) != -1) {
                sb.append(new String(bArr));
            }
            inputStream.close();
            return sb.toString().trim();
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }

    /* renamed from: ゎ  reason: contains not printable characters */
    public String m6235() {
        return Build.CPU_ABI2;
    }

    /* renamed from: を  reason: contains not printable characters */
    public String m6236() {
        String str;
        int i = Build.VERSION.SDK_INT;
        try {
            str = WebSettings.getDefaultUserAgent(this.f8174);
        } catch (Exception unused) {
            str = System.getProperty("http.agent");
        }
        StringBuilder sb = new StringBuilder();
        int length = str.length();
        for (int i2 = 0; i2 < length; i2++) {
            char charAt = str.charAt(i2);
            if (charAt <= 31 || charAt >= 127) {
                sb.append(String.format("\\u%04x", Integer.valueOf(charAt)));
            } else {
                sb.append(charAt);
            }
        }
        return sb.toString();
    }

    /* renamed from: ト  reason: contains not printable characters */
    public String m6237() {
        String readLine;
        try {
            BufferedReader bufferedReader = new BufferedReader(new FileReader("/proc/cpuinfo"));
            do {
                readLine = bufferedReader.readLine();
                if (readLine == null) {
                    bufferedReader.close();
                    return null;
                }
            } while (!readLine.contains("Processor"));
            return readLine.split(CertificateUtil.DELIMITER)[1].trim();
        } catch (Exception unused) {
            return null;
        }
    }

    /* renamed from: ピ  reason: contains not printable characters */
    public long m6238() {
        try {
            ActivityManager.MemoryInfo memoryInfo = new ActivityManager.MemoryInfo();
            ((ActivityManager) this.f8174.getSystemService("activity")).getMemoryInfo(memoryInfo);
            return memoryInfo.availMem / PlaybackStateCompat.ACTION_PLAY_FROM_MEDIA_ID;
        } catch (Exception unused) {
            return -1;
        }
    }

    /* renamed from: 㑃  reason: contains not printable characters */
    public String m6239() {
        return Build.BOARD;
    }

    /* renamed from: 㒁  reason: contains not printable characters */
    public long m6240() {
        return Runtime.getRuntime().maxMemory() / PlaybackStateCompat.ACTION_PLAY_FROM_MEDIA_ID;
    }

    /* renamed from: 㓚  reason: contains not printable characters */
    public long m6241() {
        try {
            ActivityManager.MemoryInfo memoryInfo = new ActivityManager.MemoryInfo();
            ((ActivityManager) this.f8174.getSystemService("activity")).getMemoryInfo(memoryInfo);
            int i = Build.VERSION.SDK_INT;
            return memoryInfo.totalMem / PlaybackStateCompat.ACTION_PLAY_FROM_MEDIA_ID;
        } catch (Exception unused) {
            return -1;
        }
    }

    /* renamed from: 㗗  reason: contains not printable characters */
    public String m6242() {
        return Build.BRAND;
    }

    /* renamed from: 㗼  reason: contains not printable characters */
    public String m6243() {
        return TimeZone.getDefault().getDisplayName(true, 0, Locale.ENGLISH);
    }

    /* renamed from: 㗽  reason: contains not printable characters */
    public String m6244() {
        return Build.ID;
    }

    /* renamed from: 㗾  reason: contains not printable characters */
    public long m6245() {
        return System.currentTimeMillis();
    }

    /* renamed from: 㣙  reason: contains not printable characters */
    public boolean m6246() {
        int i = Build.VERSION.SDK_INT;
        return m6233("android.hardware.bluetooth_le");
    }

    /* renamed from: 㮔  reason: contains not printable characters */
    public int m6247() {
        try {
            return new File("/sys/devices/system/cpu/").listFiles(new C2365(this)).length;
        } catch (Exception unused) {
            return 0;
        }
    }

    /* renamed from: 㮝  reason: contains not printable characters */
    public String m6248() {
        return Build.MODEL;
    }

    /* renamed from: 㱶  reason: contains not printable characters */
    public int m6249() {
        return Build.VERSION.SDK_INT;
    }

    /* JADX WARNING: Removed duplicated region for block: B:8:0x0016 A[Catch:{ Exception -> 0x0031 }] */
    /* renamed from: 㳨  reason: contains not printable characters */
    public boolean m6250() {
        try {
            ArrayList<NetworkInterface> list = Collections.list(NetworkInterface.getNetworkInterfaces());
            if (list == null) {
                return false;
            }
            for (NetworkInterface networkInterface : list) {
                String name = networkInterface.getName();
                if (name.equals("tun0") || name.equals("ppp0")) {
                    return true;
                }
                while (r1.hasNext()) {
                }
            }
            return false;
        } catch (Exception unused) {
            return false;
        }
    }

    /* renamed from: 㳳  reason: contains not printable characters */
    public int m6251() {
        try {
            int i = Build.VERSION.SDK_INT;
            return ((BatteryManager) this.f8174.getSystemService("batterymanager")).getIntProperty(4);
        } catch (Exception unused) {
            return -1;
        }
    }

    /* renamed from: 㴪  reason: contains not printable characters */
    public String m6252() {
        return Build.USER;
    }

    /* renamed from: 㴹  reason: contains not printable characters */
    public int m6253() {
        try {
            return this.f8174.getPackageManager().getPackageInfo(this.f8174.getPackageName(), 0).versionCode;
        } catch (Exception e) {
            e.printStackTrace();
            return -1;
        }
    }

    /* renamed from: 㵟  reason: contains not printable characters */
    public long m6254() {
        try {
            StatFs statFs = new StatFs(Environment.getExternalStorageDirectory().getPath());
            return (((long) statFs.getBlockSize()) * ((long) statFs.getBlockCount())) / PlaybackStateCompat.ACTION_PLAY_FROM_MEDIA_ID;
        } catch (Exception unused) {
            return -1;
        }
    }

    /* renamed from: 㶋  reason: contains not printable characters */
    public long m6255() {
        return Build.TIME;
    }

    /* renamed from: 㷛  reason: contains not printable characters */
    public String m6256() {
        return Build.VERSION.INCREMENTAL;
    }

    /* renamed from: 㸾  reason: contains not printable characters */
    public String m6257() {
        try {
            return this.f8174.getResources().getString(this.f8174.getPackageManager().getPackageInfo(this.f8174.getPackageName(), 0).applicationInfo.labelRes);
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }

    /* renamed from: 㹎  reason: contains not printable characters */
    public String m6258() {
        return Build.HARDWARE;
    }

    /* renamed from: 㿎  reason: contains not printable characters */
    public String m6259() {
        try {
            Class<?> cls = Class.forName("android.os.SystemProperties");
            Object newInstance = cls.newInstance();
            return (String) cls.getMethod("get", String.class, String.class).invoke(newInstance, "gsm.version.baseband", "no message");
        } catch (Exception unused) {
            return null;
        }
    }

    /* renamed from: 䀟  reason: contains not printable characters */
    public String m6260() {
        try {
            return Build.VERSION.SDK_INT >= 26 ? C2369.m6286(this.f8174, "android.permission.READ_PHONE_STATE") ? Build.getSerial() : "" : Build.SERIAL;
        } catch (Exception unused) {
            return null;
        }
    }

    /* renamed from: 䁗  reason: contains not printable characters */
    public String m6261() {
        return Build.BOOTLOADER;
    }

    /* renamed from: 䃖  reason: contains not printable characters */
    public String m6262() {
        String str = null;
        try {
            BufferedReader bufferedReader = new BufferedReader(new FileReader("/sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq"));
            str = bufferedReader.readLine().trim();
            bufferedReader.close();
            return str;
        } catch (Exception unused) {
            return str;
        }
    }
}
