翰林优商.apk(点击下载) / bd.java


package com.kwad.sdk.utils;

import android.app.ActivityManager;
import android.content.Context;
import android.media.AudioManager;
import android.net.wifi.WifiInfo;
import android.net.wifi.WifiManager;
import android.os.BatteryManager;
import android.os.Build;
import android.os.Environment;
import android.os.LocaleList;
import android.os.Process;
import android.os.SystemClock;
import android.provider.Settings;
import android.system.Os;
import android.system.StructStat;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
import android.util.DisplayMetrics;
import android.view.WindowManager;
import com.bytedance.sdk.openadsdk.downloadnew.core.TTDownloadField;
import com.efs.sdk.base.core.util.NetworkUtil;
import com.kuaishou.weapon.p0.h;
import com.kwad.sdk.core.f.a;
import com.kwad.sdk.crash.utils.b;
import com.kwad.sdk.crash.utils.g;
import com.kwad.sdk.service.ServiceProvider;
import com.kwad.sdk.service.kwai.e;
import com.kwad.sdk.service.kwai.f;
import com.kwai.video.player.KsMediaMeta;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.net.Inet4Address;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Enumeration;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Random;

public final class bd {
    private static String bCA = "";
    private static String bCB = "";
    private static int bCC = 0;
    private static boolean bCD = false;
    private static int bCE = 0;
    private static boolean bCF = false;
    private static final String[] bCG = {"", ""};
    private static String bCH = "";
    private static String bCI = "";
    private static String bCJ = "";
    private static String bCK = null;
    private static String bCL = null;
    private static int bCM = -1;
    private static boolean bCN = false;
    private static boolean bCO = false;
    private static boolean bCP = false;
    private static boolean bCQ = false;
    private static boolean bCR = false;
    private static boolean bCS = false;
    private static int bCT = 0;
    private static long bCU = 0;
    private static String bCV = "";
    private static String bCW = "";
    private static final List<String> bCX = Arrays.asList("a5f5faddde9e9f02", "8e17f7422b35fbea", "b88c3c236923d9d9", "cb36bf76cca443d0", "5d4e49ed381836c5", "cffa38e9136f93e9", "62bd2daa59ea0173", "b7aad49a2d5bc5d9", "f2138912c5e5dd5c", "330a1e81a2bf9f31", "59c0f432ccbef844", "521376155e535f39", "aa5ec6ce14abd680", "5522a09bb500d82f", "6dfe4a96800edfb4", "ecc9a2dded8cdf72", "399f868043955b11", "34dc327c00dbff94", "d1b4e3862c309f8b", "68bdbf71f863ccac", "01558dd995085a35", "351174200a06da52", "fa0988506c76ff4b", "8eb8ef823312c61a", "a72e81be65c4638b", "416d15a015c8f324", "474086ea2d737519", "befdddf908c8d749", "780ee58a6f57aab6", "cfe86fa07cae3601", "704ff4d1534f0ff4", "9298b9e9bbd7cdea", "7b634c42f236c6e8", "11eacf22b9ceab7d", "2941a4f39eec5864", "87d134dc5ba45550", "fdd2313bb1750eb9", "6560ef232d8424bb", "5d876286e1064482", "f66fefb916f4962d", "7baf82d0ac49f596", "57748921d8d88ed4", "120cd57f1a50b8f5", "e164f9610ddd9fc8", "6256f0e8da6389de", "bcb22df712476416", "714fa9aff63f7adb", "cb8252e4da7cf610", "e18f649aa80e140c", "966790a9db5ea8d8", "e1769e681af901dd", "d23f2574a60964a4", "d717e6298d3c9cb2", "f5ea5e8ba730864e", "a8a0a223d1a42232", "6675a4f231f5c8db", "3edb7c2103e5c75a", "8ce6a9a216b326c4", "af606153eb3be0a7", "7ae255c3d760c920", "e50e94c40048c5fd", "55009bca30f9dc4c", "c37566487909214a", "891b74f7e534d14a", "726e190aae663525", "df473127d30fb669", "bfbcc646d92dfd48", "a4a1954c44751936", "da4a44a3d7c4d8be", "5ff5bca4a775dd30", "14917461e1917c53", "14ce20d0a80955fa", "a56a63de4d3f3d39", "f780246adc7bd556", "3495a541aea0da72", "f7f205ce47fed2a5", "f52db3f434279c3a", "dca17088c97dee5e", "dd53a8b3a2a4ccc0", "52e07629290d45e4", "cda522b0f8f50d9a", "b85a1c8bcd51d82c", "e344a00cd3f5e93a", "fa59d8a66d7bdd88", "68fb1f1393a216e8", "4c30ab1fb10af181", "b1376e0578099143", "88752f72d8d305fd", "fddf20078d27bf3c", "dab2120bffa2be8c", "c7c8dde481793471", "e4b1bdbcabfc284d");
    private static String bCx = null;
    private static String bCy = "";
    private static boolean bCz;

    public static long ZA() {
        if (((f) ServiceProvider.get(f.class)).R(1024)) {
            return 0;
        }
        return g.E(Environment.getDataDirectory());
    }

    public static int ZB() {
        int i = bCT;
        if (i > 0) {
            return i;
        }
        int availableProcessors = Runtime.getRuntime().availableProcessors();
        bCT = availableProcessors;
        return availableProcessors;
    }

    public static String ZC() {
        return Build.MODEL;
    }

    public static synchronized long ZD() {
        long j;
        synchronized (bd.class) {
            j = 0;
            if (at.YT() && (!TextUtils.isEmpty(at.YU()) || at.YV() != null)) {
                j = 1;
            }
            if (at.YR() && at.YS() != null) {
                j |= 64;
            }
            if (at.YT() && !TextUtils.isEmpty(at.YW())) {
                j |= 2;
            }
            if (at.YX() && !TextUtils.isEmpty(at.YY())) {
                j |= 4;
            }
            if (at.YZ() && !TextUtils.isEmpty(at.Za())) {
                j |= KsMediaMeta.AV_CH_TOP_CENTER;
            }
            if (at.Zd() && at.Ze() != null) {
                j |= 16;
            }
        }
        return j;
    }

    public static String ZE() {
        return Build.BRAND;
    }

    public static synchronized long ZF() {
        long elapsedRealtime;
        synchronized (bd.class) {
            elapsedRealtime = SystemClock.elapsedRealtime() / 1000;
        }
        return elapsedRealtime;
    }

    public static synchronized long ZG() {
        long j;
        synchronized (bd.class) {
            j = Build.TIME;
        }
        return j;
    }

    public static synchronized String ZH() {
        String str;
        synchronized (bd.class) {
            str = Build.FINGERPRINT;
        }
        return str;
    }

    public static synchronized String ZI() {
        synchronized (bd.class) {
            if (!TextUtils.isEmpty(bCx)) {
                return bCx;
            }
            String radioVersion = Build.getRadioVersion();
            bCx = radioVersion;
            return radioVersion;
        }
    }

    public static synchronized String ZJ() {
        String name;
        synchronized (bd.class) {
            name = as.getName();
        }
        return name;
    }

    public static synchronized String ZK() {
        String version;
        synchronized (bd.class) {
            version = as.getVersion();
        }
        return version;
    }

    public static String ZL() {
        return Build.MANUFACTURER;
    }

    public static int ZM() {
        if (bCM == -1) {
            bCM = ec(((e) ServiceProvider.get(e.class)).getContext()) ? 4 : 3;
        }
        return bCM;
    }

    public static String ZN() {
        if (TextUtils.isEmpty(bCL)) {
            bCL = System.getProperty("os.arch");
        }
        return bCL;
    }

    public static int ZO() {
        return Build.VERSION.SDK_INT;
    }

    public static String ZP() {
        if (at.Zb() || ((f) ServiceProvider.get(f.class)).R(8)) {
            return "";
        }
        try {
            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 instanceof Inet4Address) && !nextElement.isLoopbackAddress()) {
                            return nextElement.getHostAddress();
                        }
                    }
                }
            }
        } catch (Throwable unused) {
        }
        return "";
    }

    private static String ZQ() {
        try {
            return a(Long.toHexString(new Random(System.currentTimeMillis()).nextLong()), 16, '0');
        } catch (Throwable unused) {
            return null;
        }
    }

    private static String ZR() {
        if (((e) ServiceProvider.get(e.class)).getContext() == null) {
            return null;
        }
        String g = x.g("ksadsdk_pref", "android_id", null);
        x.h(g, "ksadsdk_pref", "android_id");
        return g;
    }

    public static String ZS() {
        if (!TextUtils.isEmpty(bCV)) {
            return bCV;
        }
        try {
            String aa = p.aa(new File("/proc/sys/kernel/random/boot_id"));
            bCV = TextUtils.isEmpty(aa) ? "" : aa.substring(0, aa.indexOf("\n"));
        } catch (IOException unused) {
        }
        return bCV;
    }

    private static long Zx() {
        BufferedReader bufferedReader;
        Throwable th;
        String readLine;
        BufferedReader bufferedReader2 = null;
        try {
            bufferedReader = new BufferedReader(new FileReader("/proc/meminfo"), 8192);
            do {
                try {
                    readLine = bufferedReader.readLine();
                    if (readLine == null) {
                        b.closeQuietly(bufferedReader);
                        return 0;
                    }
                } catch (Exception unused) {
                    bufferedReader2 = bufferedReader;
                    b.closeQuietly(bufferedReader2);
                    return 0;
                } catch (Throwable th2) {
                    th = th2;
                    b.closeQuietly(bufferedReader);
                    throw th;
                }
            } while (!readLine.contains("MemTotal"));
            long longValue = Long.valueOf(readLine.split("\\s+")[1]).longValue() << 10;
            b.closeQuietly(bufferedReader);
            return longValue;
        } catch (Exception unused2) {
            b.closeQuietly(bufferedReader2);
            return 0;
        } catch (Throwable th3) {
            bufferedReader = null;
            th = th3;
            b.closeQuietly(bufferedReader);
            throw th;
        }
    }

    public static long Zz() {
        return g.F(Environment.getDataDirectory());
    }

    private static String a(String str, int i, char c) {
        StringBuilder sb = new StringBuilder();
        while (sb.length() + str.length() < 16) {
            sb.append('0');
        }
        sb.append(str);
        return sb.toString();
    }

    public static String cG(boolean z) {
        Context context = ((e) ServiceProvider.get(e.class)).getContext();
        String bv = a.bv(context);
        return (TextUtils.isEmpty(bv) && !z && TextUtils.isEmpty(dV(context))) ? ((f) ServiceProvider.get(f.class)).Jn() : bv;
    }

    public static int checkSelfPermission(Context context, String str) {
        return context.checkPermission(str, Process.myPid(), Process.myUid());
    }

    public static long dS(Context context) {
        if (context == null || ((f) ServiceProvider.get(f.class)).R(1024)) {
            return 0;
        }
        try {
            ActivityManager.MemoryInfo memoryInfo = new ActivityManager.MemoryInfo();
            ((ActivityManager) context.getSystemService(TTDownloadField.TT_ACTIVITY)).getMemoryInfo(memoryInfo);
            return memoryInfo.availMem;
        } catch (Exception unused) {
            return 0;
        }
    }

    public static int dT(Context context) {
        if (((f) ServiceProvider.get(f.class)).R(512)) {
            return 0;
        }
        try {
            if (Build.VERSION.SDK_INT >= 21) {
                return ((BatteryManager) context.getApplicationContext().getSystemService("batterymanager")).getIntProperty(4);
            }
        } catch (Exception unused) {
        }
        return 0;
    }

    public static long dU(Context context) {
        long j = bCU;
        if (j > 0) {
            return j;
        }
        if (context == null) {
            return 0;
        }
        try {
            ActivityManager.MemoryInfo memoryInfo = new ActivityManager.MemoryInfo();
            ((ActivityManager) context.getApplicationContext().getSystemService(TTDownloadField.TT_ACTIVITY)).getMemoryInfo(memoryInfo);
            long j2 = memoryInfo.totalMem;
            if (j2 <= 0) {
                j2 = Zx();
            }
            bCU = j2;
            return j2;
        } catch (Exception unused) {
            return 0;
        }
    }

    private static synchronized String dV(Context context) {
        synchronized (bd.class) {
            if (at.YT() && !TextUtils.isEmpty(at.YU())) {
                return at.YU();
            } else if (bCN) {
                return bCA;
            } else if (!TextUtils.isEmpty(bCA) || context == null) {
                return bCA;
            } else if (Build.VERSION.SDK_INT >= 29) {
                return bCA;
            } else if (at.YT() || ((f) ServiceProvider.get(f.class)).R(1)) {
                return bCA;
            } else {
                try {
                    if (SystemUtil.dR(context)) {
                        String deviceId = ((TelephonyManager) context.getSystemService("phone")).getDeviceId();
                        bCA = deviceId;
                        if (TextUtils.isEmpty(deviceId)) {
                            bCN = true;
                        }
                    }
                } catch (Exception e) {
                    com.kwad.sdk.core.e.b.printStackTrace(e);
                    if (0 != 0) {
                        bCN = true;
                    }
                }
                return bCA;
            }
        }
    }

    /* JADX WARNING: Code restructure failed: missing block: B:24:0x004f, code lost:
        if (android.text.TextUtils.isEmpty(r5) != false) goto L_0x0051;
     */
    public static synchronized String dW(Context context) {
        TelephonyManager telephonyManager;
        synchronized (bd.class) {
            if (bCS) {
                return bCB;
            }
            if (!TextUtils.isEmpty(bCB) || context == null) {
                return bCB;
            }
            if (at.YT() || ((f) ServiceProvider.get(f.class)).R(KsMediaMeta.AV_CH_TOP_FRONT_LEFT)) {
                return bCB;
            }
            try {
                if (SystemUtil.dR(context) && (telephonyManager = (TelephonyManager) context.getSystemService("phone")) != null) {
                    if (Build.VERSION.SDK_INT >= 26) {
                        String meid = telephonyManager.getMeid();
                        bCB = meid;
                    } else if (telephonyManager.getPhoneType() == 2) {
                        String deviceId = telephonyManager.getDeviceId();
                        bCB = deviceId;
                        if (TextUtils.isEmpty(deviceId)) {
                        }
                    } else {
                        bCB = null;
                    }
                    bCS = true;
                }
            } catch (Exception e) {
                com.kwad.sdk.core.e.b.printStackTrace(e);
                if (0 != 0) {
                    bCS = true;
                }
            }
            return bCB;
        }
    }

    /* JADX WARNING: Code restructure failed: missing block: B:44:0x0094, code lost:
        if (android.text.TextUtils.isEmpty(r10[1]) != false) goto L_0x0096;
     */
    /* JADX WARNING: Removed duplicated region for block: B:65:0x00e5  */
    public static synchronized String[] dX(Context context) {
        Exception e;
        synchronized (bd.class) {
            if (at.YT() && at.YV() != null) {
                return at.YV();
            } else if (bCR) {
                return bCG;
            } else if (Build.VERSION.SDK_INT >= 29) {
                return bCG;
            } else {
                String[] strArr = bCG;
                boolean z = false;
                if (!TextUtils.isEmpty(strArr[0]) || !TextUtils.isEmpty(strArr[1]) || context == null) {
                    return strArr;
                }
                if (at.YT() || ((f) ServiceProvider.get(f.class)).R(1)) {
                    return strArr;
                }
                try {
                    boolean dR = SystemUtil.dR(context);
                    if (dR) {
                        try {
                            TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService("phone");
                            if (telephonyManager != null) {
                                if (Build.VERSION.SDK_INT >= 26) {
                                    int min = Math.min(dY(context), 2);
                                    for (int i = 0; i < min; i++) {
                                        bCG[i] = telephonyManager.getImei(i);
                                    }
                                    String[] strArr2 = bCG;
                                    if (TextUtils.isEmpty(strArr2[0])) {
                                    }
                                } else if (telephonyManager.getPhoneType() == 1) {
                                    if (Build.VERSION.SDK_INT >= 23) {
                                        int min2 = Math.min(dY(context), 2);
                                        for (int i2 = 0; i2 < min2; i2++) {
                                            bCG[i2] = telephonyManager.getDeviceId(i2);
                                        }
                                    } else {
                                        strArr[0] = telephonyManager.getDeviceId();
                                        strArr[1] = null;
                                    }
                                    String[] strArr3 = bCG;
                                    if (TextUtils.isEmpty(strArr3[0]) && TextUtils.isEmpty(strArr3[1])) {
                                    }
                                } else {
                                    strArr[0] = null;
                                    strArr[1] = null;
                                }
                                bCR = true;
                            }
                        } catch (Exception e2) {
                            e = e2;
                            z = dR;
                            com.kwad.sdk.core.e.b.printStackTraceOnly(e);
                            if (z) {
                            }
                            return bCG;
                        }
                    }
                } catch (Exception e3) {
                    e = e3;
                    com.kwad.sdk.core.e.b.printStackTraceOnly(e);
                    if (z) {
                        bCR = true;
                    }
                    return bCG;
                }
                return bCG;
            }
        }
    }

    public static synchronized int dY(Context context) {
        synchronized (bd.class) {
            if (bCD || bCC > 0 || Build.VERSION.SDK_INT < 23 || context == null || at.YT()) {
                return bCC;
            }
            try {
                bCC = ((TelephonyManager) context.getSystemService("phone")).getPhoneCount();
            } catch (Exception unused) {
            }
            int i = bCC;
            bCD = i == 0;
            return i;
        }
    }

    public static int dZ(Context context) {
        if (context == null || bCE > 0 || bCF || Build.VERSION.SDK_INT < 22 || !SystemUtil.dR(context) || at.YT()) {
            return bCE;
        }
        try {
            bCE = ((SubscriptionManager) context.getSystemService("telephony_subscription_service")).getActiveSubscriptionInfoCount();
        } catch (Throwable unused) {
        }
        int i = bCE;
        bCF = i != 0;
        return i;
    }

    public static String dp(Context context) {
        if (at.YT() && !TextUtils.isEmpty(at.YW())) {
            return at.YW();
        }
        if (!TextUtils.isEmpty(bCJ) || context == null) {
            return bCJ;
        }
        if (bCQ) {
            return bCJ;
        }
        if (at.YT() || ((f) ServiceProvider.get(f.class)).R(2)) {
            return bCJ;
        }
        try {
            String string = Settings.Secure.getString(context.getContentResolver(), "android_id");
            bCJ = string;
            if (!fH(string)) {
                bCJ = "";
            }
        } catch (Exception unused) {
        }
        if (TextUtils.isEmpty(bCJ)) {
            bCQ = true;
        }
        return bCJ;
    }

    public static synchronized String dt(Context context) {
        synchronized (bd.class) {
            if (context != null) {
                if (!bCO && TextUtils.isEmpty(bCH) && SystemUtil.dR(context) && !at.YT() && !((f) ServiceProvider.get(f.class)).R(128)) {
                    try {
                        bCH = ((TelephonyManager) context.getApplicationContext().getSystemService("phone")).getSubscriberId();
                    } catch (Exception unused) {
                    }
                    bCO = TextUtils.isEmpty(bCH);
                    return bCH;
                }
            }
            return bCH;
        }
    }

    public static String ea(Context context) {
        if (!TextUtils.isEmpty(bCI) || context == null) {
            return bCI;
        }
        if (bCP) {
            return bCI;
        }
        if (at.YT() || ((f) ServiceProvider.get(f.class)).R(128)) {
            return bCI;
        }
        boolean z = false;
        try {
            z = SystemUtil.dR(context);
            if (z) {
                bCI = ((TelephonyManager) context.getApplicationContext().getSystemService("phone")).getSimSerialNumber();
            }
        } catch (Exception e) {
            com.kwad.sdk.core.e.b.printStackTrace(e);
            bCI = null;
        }
        if (z && TextUtils.isEmpty(bCI)) {
            bCP = true;
        }
        String str = TextUtils.isEmpty(bCI) ? "" : bCI;
        bCI = str;
        return str;
    }

    public static synchronized int eb(Context context) {
        int ringerMode;
        synchronized (bd.class) {
            ringerMode = ((AudioManager) context.getSystemService("audio")).getRingerMode();
        }
        return ringerMode;
    }

    private static boolean ec(Context context) {
        return (context == null || context.getResources() == null || context.getResources().getConfiguration() == null || (context.getResources().getConfiguration().screenLayout & 15) < 3) ? false : true;
    }

    public static synchronized String ed(Context context) {
        synchronized (bd.class) {
            if (TextUtils.isEmpty(bCy) && context != null) {
                if (!bCz) {
                    if (at.YX()) {
                        String YY = at.YY();
                        bCy = YY;
                        return YY;
                    } else if (((f) ServiceProvider.get(f.class)).R(4)) {
                        return bCy;
                    } else {
                        try {
                            WifiInfo connectionInfo = ((WifiManager) context.getApplicationContext().getSystemService(NetworkUtil.NETWORK_TYPE_WIFI)).getConnectionInfo();
                            if (connectionInfo != null) {
                                bCy = connectionInfo.getMacAddress();
                            }
                            if (fF(bCy)) {
                                Iterator it = Collections.list(NetworkInterface.getNetworkInterfaces()).iterator();
                                while (true) {
                                    if (!it.hasNext()) {
                                        break;
                                    }
                                    NetworkInterface networkInterface = (NetworkInterface) it.next();
                                    if (networkInterface != null && "wlan0".equals(networkInterface.getName())) {
                                        byte[] hardwareAddress = networkInterface.getHardwareAddress();
                                        if (hardwareAddress != null && hardwareAddress.length != 0) {
                                            StringBuilder sb = new StringBuilder();
                                            int length = hardwareAddress.length;
                                            for (int i = 0; i < length; i++) {
                                                sb.append(String.format("%02X:", Byte.valueOf(hardwareAddress[i])));
                                            }
                                            if (sb.length() > 0) {
                                                sb.deleteCharAt(sb.length() - 1);
                                            }
                                            bCy = sb.toString();
                                        }
                                    }
                                }
                            }
                            if (fF(bCy)) {
                                bCy = g.d(Runtime.getRuntime().exec("cat /sys/class/net/wlan0/address ").getInputStream());
                            }
                            if (!fF(bCy)) {
                                bCy = bCy.toUpperCase(Locale.US);
                            }
                        } catch (Exception unused) {
                            bCz = true;
                        }
                        bCz = fF(bCy);
                        return bCy;
                    }
                }
            }
            return bCy;
        }
    }

    public static List<String> ee(Context context) {
        String[] list;
        if (c.cc(context)) {
            return new ArrayList();
        }
        if (!ef(context)) {
            return new ArrayList();
        }
        File file = new File(Environment.getExternalStorageDirectory().getAbsolutePath() + "/Android/data");
        if (!file.exists() || !file.isDirectory() || (list = file.list()) == null) {
            return null;
        }
        ArrayList arrayList = new ArrayList();
        for (String str : list) {
            if (!TextUtils.isEmpty(str) && !str.startsWith(".")) {
                arrayList.add(str);
            }
        }
        return arrayList;
    }

    public static boolean ef(Context context) {
        return context.checkCallingOrSelfPermission(h.j) == 0;
    }

    private static boolean fF(String str) {
        return TextUtils.isEmpty(str) || str.equals("02:00:00:00:00:00");
    }

    private static boolean fG(String str) {
        return bCX.contains(str.toLowerCase(Locale.US));
    }

    private static boolean fH(String str) {
        for (int i = 0; i < str.length(); i++) {
            try {
                if (str.charAt(i) != '0') {
                    return true;
                }
            } catch (Throwable unused) {
            }
        }
        return false;
    }

    private static void fI(String str) {
        if (((e) ServiceProvider.get(e.class)).getContext() != null) {
            x.a("ksadsdk_pref", "android_id", str, true);
        }
    }

    public static String fJ(String str) {
        String str2;
        if (!TextUtils.isEmpty(bCW) || TextUtils.isEmpty(str)) {
            return bCW;
        }
        if (Build.VERSION.SDK_INT >= 21) {
            try {
                StructStat stat = Os.stat(str);
                if (stat == null) {
                    return bCW;
                }
                String str3 = "";
                if (Build.VERSION.SDK_INT >= 27) {
                    if (stat.st_atim == null) {
                        str2 = str3;
                    } else {
                        str3 = String.valueOf(stat.st_atim.tv_sec);
                        str2 = String.valueOf(stat.st_atim.tv_nsec);
                    }
                    bCW = str3 + "." + str2;
                } else {
                    if (stat.st_atime != 0) {
                        str3 = String.valueOf(stat.st_atime);
                    }
                    bCW = str3;
                }
            } catch (Exception e) {
                com.kwad.sdk.core.e.b.printStackTrace(e);
            }
        }
        return bCW;
    }

    public static String getDeviceId() {
        try {
            if (!TextUtils.isEmpty(bCK)) {
                return bCK;
            }
            String ZR = ZR();
            if (!TextUtils.isEmpty(ZR)) {
                String str = "ANDROID_" + ZR;
                bCK = str;
                return str;
            }
            String dp = dp(((e) ServiceProvider.get(e.class)).getContext());
            if (TextUtils.isEmpty(dp) || fG(dp) || !fH(dp)) {
                String ZQ = ZQ();
                if (!TextUtils.isEmpty(ZQ)) {
                    bCK = "ANDROID_" + ZQ;
                    fI(ZQ);
                    return bCK;
                }
                return "ANDROID_";
            }
            String str2 = "ANDROID_" + dp;
            bCK = str2;
            return str2;
        } catch (Exception e) {
            com.kwad.sdk.core.e.b.printStackTraceOnly(e);
        }
    }

    public static String getLanguage() {
        return Locale.getDefault().getLanguage();
    }

    public static String getLocale() {
        Locale locale = Build.VERSION.SDK_INT >= 24 ? LocaleList.getDefault().get(0) : Locale.getDefault();
        if (locale == null) {
            locale = Locale.CHINESE;
        }
        return String.valueOf(locale);
    }

    public static String getOsVersion() {
        return Build.VERSION.RELEASE;
    }

    public static int getScreenHeight(Context context) {
        try {
            DisplayMetrics displayMetrics = new DisplayMetrics();
            ((WindowManager) context.getSystemService("window")).getDefaultDisplay().getMetrics(displayMetrics);
            return displayMetrics.heightPixels;
        } catch (Exception unused) {
            return 0;
        }
    }

    public static int getScreenWidth(Context context) {
        try {
            DisplayMetrics displayMetrics = new DisplayMetrics();
            ((WindowManager) context.getSystemService("window")).getDefaultDisplay().getMetrics(displayMetrics);
            return displayMetrics.widthPixels;
        } catch (Exception unused) {
            return 0;
        }
    }

    public static String v(Context context, boolean z) {
        if (at.YT() && !TextUtils.isEmpty(at.YU())) {
            return at.YU();
        }
        String dV = dV(context);
        return (TextUtils.isEmpty(dV) && !z && TextUtils.isEmpty(a.bv(context))) ? ((f) ServiceProvider.get(f.class)).Jm() : dV;
    }
}