package com.xiaomi.push; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.os.Parcelable; import android.text.TextUtils; import com.xiaomi.channel.commonutils.logger.b; import com.xiaomi.mipush.sdk.Constants; import java.util.Arrays; import java.util.HashMap; import java.util.Locale; import java.util.Map; public class l { private static volatile int a = 0; /* renamed from: a reason: collision with other field name */ private static Map<String, q> f7451a = null; private static int b = -1; /* JADX WARNING: Removed duplicated region for block: B:12:0x0024 A[Catch:{ all -> 0x0029 }] */ /* JADX WARNING: Removed duplicated region for block: B:13:0x0025 A[Catch:{ all -> 0x0029 }] */ public static int a() { boolean z; if (a == 0) { try { int i = 1; if (TextUtils.isEmpty(m9606a("ro.miui.ui.version.code"))) { if (TextUtils.isEmpty(m9606a("ro.miui.ui.version.name"))) { z = false; if (z) { i = 2; } a = i; b.b("isMIUI's value is: " + a); } } z = true; if (z) { } a = i; } catch (Throwable th) { b.a("get isMIUI failed", th); a = 0; } b.b("isMIUI's value is: " + a); } return a; } public static int a(Context context) { String a2 = m9606a("ro.miui.ui.version.code"); if (TextUtils.isEmpty(a2) || !TextUtils.isDigitsOnly(a2)) { return 0; } return Integer.parseInt(a2); } public static q a(String str) { q b2 = b(str); return b2 == null ? q.Global : b2; } /* renamed from: a reason: collision with other method in class */ public static String m9605a() { int a2 = v.a(); return (!m9608a() || a2 <= 0) ? "" : a2 < 2 ? "alpha" : a2 < 3 ? "development" : "stable"; } public static String a(Intent intent) { if (intent == null) { return null; } return intent.toString() + " " + a(intent.getExtras()); } public static String a(Bundle bundle) { String a2; StringBuilder sb = new StringBuilder("Bundle["); if (bundle == null) { sb.append("null"); } else { boolean z = true; for (String str : bundle.keySet()) { if (!z) { sb.append(", "); } sb.append(str); sb.append('='); Object obj = bundle.get(str); if (obj instanceof int[]) { a2 = Arrays.toString((int[]) obj); } else if (obj instanceof byte[]) { a2 = Arrays.toString((byte[]) obj); } else if (obj instanceof boolean[]) { a2 = Arrays.toString((boolean[]) obj); } else if (obj instanceof short[]) { a2 = Arrays.toString((short[]) obj); } else if (obj instanceof long[]) { a2 = Arrays.toString((long[]) obj); } else if (obj instanceof float[]) { a2 = Arrays.toString((float[]) obj); } else if (obj instanceof double[]) { a2 = Arrays.toString((double[]) obj); } else if (obj instanceof String[]) { a2 = Arrays.toString((String[]) obj); } else if (obj instanceof CharSequence[]) { a2 = Arrays.toString((CharSequence[]) obj); } else if (obj instanceof Parcelable[]) { a2 = Arrays.toString((Parcelable[]) obj); } else if (obj instanceof Bundle) { a2 = a((Bundle) obj); } else { sb.append(obj); z = false; } sb.append(a2); z = false; } } sb.append("]"); return sb.toString(); } /* renamed from: a reason: collision with other method in class */ public static String m9606a(String str) { try { return (String) bk.a("android.os.SystemProperties", "get", str, ""); } catch (Exception e) { b.d("fail to get property. " + e); } catch (Throwable unused) { } return null; } /* renamed from: a reason: collision with other method in class */ private static void m9607a() { if (f7451a == null) { HashMap hashMap = new HashMap(); f7451a = hashMap; hashMap.put("CN", q.China); f7451a.put("FI", q.Europe); f7451a.put("SE", q.Europe); f7451a.put("NO", q.Europe); f7451a.put("FO", q.Europe); f7451a.put("EE", q.Europe); f7451a.put("LV", q.Europe); f7451a.put("LT", q.Europe); f7451a.put("BY", q.Europe); f7451a.put("MD", q.Europe); f7451a.put("UA", q.Europe); f7451a.put("PL", q.Europe); f7451a.put("CZ", q.Europe); f7451a.put("SK", q.Europe); f7451a.put("HU", q.Europe); f7451a.put("DE", q.Europe); f7451a.put("AT", q.Europe); f7451a.put("CH", q.Europe); f7451a.put("LI", q.Europe); f7451a.put("GB", q.Europe); f7451a.put("IE", q.Europe); f7451a.put("NL", q.Europe); f7451a.put("BE", q.Europe); f7451a.put("LU", q.Europe); f7451a.put("FR", q.Europe); f7451a.put("RO", q.Europe); f7451a.put("BG", q.Europe); f7451a.put("RS", q.Europe); f7451a.put("MK", q.Europe); f7451a.put("AL", q.Europe); f7451a.put("GR", q.Europe); f7451a.put("SI", q.Europe); f7451a.put("HR", q.Europe); f7451a.put("IT", q.Europe); f7451a.put("SM", q.Europe); f7451a.put("MT", q.Europe); f7451a.put("ES", q.Europe); f7451a.put("PT", q.Europe); f7451a.put("AD", q.Europe); f7451a.put("CY", q.Europe); f7451a.put("DK", q.Europe); f7451a.put("RU", q.Russia); f7451a.put("IN", q.India); } } /* renamed from: a reason: collision with other method in class */ public static boolean m9608a() { return a() == 1; } /* renamed from: a reason: collision with other method in class */ public static boolean m9609a(Context context) { return context != null && m9610a(context.getPackageName()); } /* renamed from: a reason: collision with other method in class */ public static boolean m9610a(String str) { return "com.xiaomi.xmsf".equals(str); } private static q b(String str) { m9607a(); return f7451a.get(str.toUpperCase()); } public static String b() { String a2 = u.a("ro.miui.region", ""); if (TextUtils.isEmpty(a2)) { a2 = u.a("persist.sys.oppo.region", ""); } if (TextUtils.isEmpty(a2)) { a2 = u.a("ro.oppo.regionmark", ""); } if (TextUtils.isEmpty(a2)) { a2 = u.a("ro.vendor.oplus.regionmark", ""); } if (TextUtils.isEmpty(a2)) { a2 = u.a("ro.hw.country", ""); } if (TextUtils.isEmpty(a2)) { a2 = u.a("ro.csc.countryiso_code", ""); } if (TextUtils.isEmpty(a2)) { a2 = m9611b(u.a("ro.product.country.region", "")); } if (TextUtils.isEmpty(a2)) { a2 = u.a("gsm.vivo.countrycode", ""); } if (TextUtils.isEmpty(a2)) { a2 = u.a("persist.sys.oem.region", ""); } if (TextUtils.isEmpty(a2)) { a2 = u.a("ro.product.locale.region", ""); } if (TextUtils.isEmpty(a2)) { a2 = u.a("persist.sys.country", ""); } if (!TextUtils.isEmpty(a2)) { b.m9051a("get region from system, region = " + a2); } if (!TextUtils.isEmpty(a2)) { return a2; } String country = Locale.getDefault().getCountry(); b.m9051a("locale.default.country = " + country); return country; } /* renamed from: b reason: collision with other method in class */ private static String m9611b(String str) { if (TextUtils.isEmpty(str)) { return str; } String[] split = str.split(Constants.ACCEPT_TIME_SEPARATOR_SERVER); return split.length > 0 ? split[0] : str; } /* renamed from: b reason: collision with other method in class */ public static boolean m9612b() { return a() == 2; } public static String c() { return m9606a("ro.miui.ui.version.name"); } /* renamed from: c reason: collision with other method in class */ public static boolean m9613c() { if (b < 0) { b = !m9615e() ? 1 : 0; } return b > 0; } public static String d() { return m9606a("ro.build.characteristics"); } /* renamed from: d reason: collision with other method in class */ public static boolean m9614d() { return !q.China.name().equalsIgnoreCase(a(b()).name()); } public static String e() { return m9606a("ro.product.manufacturer"); } /* renamed from: e reason: collision with other method in class */ public static boolean m9615e() { String str = ""; try { str = u.a("ro.miui.ui.version.code", str); } catch (Exception unused) { } return !TextUtils.isEmpty(str); } }