大漢易經書院.apk(点击下载) / e.java


package com.baidu.techain.i;

import android.content.Context;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.provider.Settings;
import android.text.TextUtils;
import android.util.Base64;
import android.util.DisplayMetrics;
import android.view.Display;
import android.view.WindowManager;
import com.baidu.techain.h.a;
import com.baidu.techain.i.j;
import com.huawei.hms.framework.common.ContainerUtils;
import com.huawei.hms.support.hianalytics.HiAnalyticsConstant;
import com.meizu.cloud.pushsdk.constants.PushConstants;
import com.xiaomi.mipush.sdk.Constants;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.UUID;

/* compiled from: DbUtil */
public final class e {
    private static String a = "";

    public static void a(Context context) {
        try {
            a a2 = a.a(context);
            String l = a2.l();
            if (!TextUtils.isEmpty(l)) {
                String e = c.e(l);
                if (!TextUtils.isEmpty(e) && !e.equals(a2.k())) {
                    a2.b(e);
                }
            }
        } catch (Throwable unused) {
            c.a();
        }
    }

    /* JADX WARNING: Code restructure failed: missing block: B:40:?, code lost:
        com.baidu.techain.i.c.a();
     */
    /* JADX WARNING: Code restructure failed: missing block: B:42:0x00d5, code lost:
        return "";
     */
    /* JADX WARNING: Exception block dominator not found, dom blocks: [] */
    /* JADX WARNING: Missing exception handler attribute for start block: B:39:0x00cf */
    public static synchronized String b(Context context) {
        synchronized (e.class) {
            if (!TextUtils.isEmpty(a)) {
                return a;
            }
            String a2 = a(context, false);
            if (!TextUtils.isEmpty(a2)) {
                a = a2;
                return a2;
            }
            a a3 = a.a(context);
            String l = a3.l();
            if (!TextUtils.isEmpty(l)) {
                try {
                    String e = c.e(l);
                    if (!TextUtils.isEmpty(e)) {
                        a = e;
                        return e;
                    }
                } catch (Throwable unused) {
                    c.a();
                }
            }
            String k = a3.k();
            if (!TextUtils.isEmpty(k)) {
                a3.c(new String(Base64.encode(g.a("30212102dicudiab".getBytes(), k.getBytes("UTF-8")), 10), "UTF-8"));
                a = k;
                return k;
            }
            String h = h(context);
            String h2 = s.h(context);
            if (TextUtils.isEmpty(h2)) {
                h2 = PushConstants.PUSH_TYPE_NOTIFY;
            }
            String str = h + HiAnalyticsConstant.REPORT_VAL_SEPARATOR + new StringBuffer(h2).reverse().toString();
            String str2 = new String(Base64.encode(g.a("30212102dicudiab".getBytes(), str.getBytes("UTF-8")), 10), "UTF-8");
            String k2 = a3.k();
            if (TextUtils.isEmpty(k2)) {
                a3.b(str);
                a3.c(str2);
                a = str;
                return str;
            }
            a = k2;
            return k2;
        }
    }

    public static String c(Context context) {
        if (!TextUtils.isEmpty(a)) {
            return a;
        }
        String a2 = a(context, true);
        if (TextUtils.isEmpty(a2)) {
            return b(context);
        }
        a = a2;
        return a2;
    }

    private static String a(Context context, boolean z) {
        try {
            Bundle a2 = u.a(context, "getRemoteZid", null, z, null, false);
            if (a2 == null) {
                return "";
            }
            String string = a2.getString("_zid");
            if (!TextUtils.isEmpty(string)) {
                return string;
            }
            return "";
        } catch (Throwable unused) {
            c.a();
            return "";
        }
    }

    public static String d(Context context) {
        try {
            a a2 = a.a(context);
            String string = a2.c.getString("sgud", "");
            if (!TextUtils.isEmpty(string)) {
                return string;
            }
            if (Build.VERSION.SDK_INT > 25) {
                return "";
            }
            String h = s.h(context);
            String i = s.i(context);
            if (TextUtils.isEmpty(h) && TextUtils.isEmpty(i)) {
                return "";
            }
            byte[] bytes = (h + Constants.COLON_SEPARATOR + i).getBytes();
            for (int i2 = 0; i2 < bytes.length; i2++) {
                bytes[i2] = (byte) (bytes[i2] ^ 246);
            }
            String a3 = n.a(bytes);
            if (TextUtils.isEmpty(a3)) {
                return "";
            }
            a2.d.putString("sgud", a3);
            a2.d.commit();
            return a3;
        } catch (Throwable unused) {
            c.a();
            return "";
        }
    }

    /* JADX WARNING: Removed duplicated region for block: B:15:0x0037  */
    /* JADX WARNING: Removed duplicated region for block: B:17:0x0061 A[RETURN] */
    /* JADX WARNING: Removed duplicated region for block: B:18:0x0062  */
    public static String e(Context context) {
        String str;
        String string;
        try {
            String i = s.i(context);
            try {
                str = Settings.System.getString(context.getContentResolver(), c.e("ARQJ8IArCy4jLSUJ6i4PbDdNue2ww1CwfUTDQn8F4ug="));
                try {
                    if (TextUtils.isEmpty(str)) {
                        str = s.h(context);
                    }
                } catch (Throwable unused) {
                    c.a();
                    string = Settings.System.getString(context.getContentResolver(), c.e("FLI7RPHK558lhmIMdK5V18TV2libLOeHJlQPRa8lKBaxRs4pujQo1mXKtiCUFVkg"));
                    if (TextUtils.isEmpty(string)) {
                    }
                    if (string == null) {
                    }
                }
            } catch (Throwable unused2) {
                str = "";
                c.a();
                string = Settings.System.getString(context.getContentResolver(), c.e("FLI7RPHK558lhmIMdK5V18TV2libLOeHJlQPRa8lKBaxRs4pujQo1mXKtiCUFVkg"));
                if (TextUtils.isEmpty(string)) {
                }
                if (string == null) {
                }
            }
            string = Settings.System.getString(context.getContentResolver(), c.e("FLI7RPHK558lhmIMdK5V18TV2libLOeHJlQPRa8lKBaxRs4pujQo1mXKtiCUFVkg"));
            if (TextUtils.isEmpty(string)) {
                string = Settings.System.getString(context.getContentResolver(), a((c.e("q6R8gqLUgHDSsH6dbL27xN7Qr9sa0MxMqXTV66AWUUE=") + str + i).getBytes()));
            }
            if (string == null) {
                return "";
            }
            String h = s.h(context);
            if (TextUtils.isEmpty(h)) {
                h = PushConstants.PUSH_TYPE_NOTIFY;
            }
            String stringBuffer = new StringBuffer(h).reverse().toString();
            return string + HiAnalyticsConstant.REPORT_VAL_SEPARATOR + stringBuffer;
        } catch (Throwable unused3) {
            return "";
        }
    }

    private static String h(Context context) {
        String str;
        String str2 = "";
        try {
            str = s.h(context);
            try {
                str2 = s.i(context);
            } catch (Throwable unused) {
            }
        } catch (Throwable unused2) {
            str = str2;
            c.a();
            String uuid = UUID.randomUUID().toString();
            return a((str + str2 + uuid).getBytes());
        }
        String uuid2 = UUID.randomUUID().toString();
        return a((str + str2 + uuid2).getBytes());
    }

    private static String a(byte[] bArr) {
        try {
            MessageDigest instance = MessageDigest.getInstance("MD5");
            instance.reset();
            instance.update(bArr);
            byte[] digest = instance.digest();
            StringBuilder sb = new StringBuilder();
            for (byte b : digest) {
                String upperCase = Integer.toHexString(b & 255).toUpperCase();
                if (upperCase.length() == 1) {
                    sb.append(PushConstants.PUSH_TYPE_NOTIFY);
                }
                sb.append(upperCase);
                sb.append("");
            }
            return sb.toString();
        } catch (NoSuchAlgorithmException unused) {
            c.a();
            return null;
        }
    }

    public static String f(Context context) {
        String str;
        try {
            if (s.b(context)) {
                str = Settings.System.getString(context.getContentResolver(), c.e("ARQJ8IArCy4jLSUJ6i4PbDdNue2ww1CwfUTDQn8F4ug="));
            } else {
                str = "";
            }
            if (TextUtils.isEmpty(str)) {
                str = s.h(context);
            }
            try {
                String h = s.h(context);
                if (TextUtils.isEmpty(h)) {
                    h = PushConstants.PUSH_TYPE_NOTIFY;
                }
                String stringBuffer = new StringBuffer(h).reverse().toString();
                String a2 = a(context, str);
                if (!TextUtils.isEmpty(a2)) {
                    return a2 + HiAnalyticsConstant.REPORT_VAL_SEPARATOR + stringBuffer;
                }
            } catch (Throwable unused) {
                c.a();
                return "";
            }
        } catch (Exception unused2) {
        }
        return "";
    }

    private static String a(Context context, String str) {
        if (TextUtils.isEmpty(str) || !s.c(context)) {
            return "";
        }
        File externalStorageDirectory = Environment.getExternalStorageDirectory();
        try {
            BufferedReader bufferedReader = new BufferedReader(new FileReader(new File(externalStorageDirectory, c.e("u_lhldj5Nkwulw6YvIU2wr_ieZRcYQnQZ7zSlbUYnYY=") + "/" + c.e("u2fjUEpcZJL7IE6RlBqIRmFJW_FjZrNApjdMKDgt7FM="))));
            StringBuilder sb = new StringBuilder();
            while (true) {
                String readLine = bufferedReader.readLine();
                if (readLine == null) {
                    break;
                }
                sb.append(readLine);
                sb.append("\r\n");
            }
            bufferedReader.close();
            Object[] split = new String(j.a.a("30212102dicudiab", "30212102dicudiab", Base64.decode(sb.toString().getBytes(), 0))).split(ContainerUtils.KEY_VALUE_DELIMITER);
            if (split == null || split.length != 2 || !str.equals(split[0])) {
                return "";
            }
            return split[1];
        } catch (Exception unused) {
            c.a();
            return "";
        }
    }

    public static String a() {
        return Build.DISPLAY;
    }

    public static String b() {
        return Build.VERSION.SDK_INT > 7 ? Build.HARDWARE : "";
    }

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

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

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

    public static String g(Context context) {
        try {
            Display defaultDisplay = ((WindowManager) context.getSystemService("window")).getDefaultDisplay();
            DisplayMetrics displayMetrics = new DisplayMetrics();
            defaultDisplay.getMetrics(displayMetrics);
            if (displayMetrics.widthPixels < displayMetrics.heightPixels) {
                return displayMetrics.widthPixels + "*" + displayMetrics.heightPixels;
            }
            return displayMetrics.heightPixels + "*" + displayMetrics.widthPixels;
        } catch (Exception unused) {
            c.a();
            return "";
        }
    }
}