package com.chinapay.mobilepayment; import android.content.Context; import android.os.Build; import com.meizu.cloud.pushsdk.notification.model.NotifyType; import java.net.URI; import java.util.Iterator; import org.json.JSONException; import org.json.JSONObject; public class p1 { private static volatile String A = "http://pingma.qq.com:80/mstat/report"; private static int B = 20; private static int C = 0; private static boolean D = false; private static String E = null; private static v3 F = null; public static boolean G = true; public static int H = 0; public static long I = 10000; public static int J = 512; /* renamed from: a reason: collision with root package name */ private static s2 f4197a = e3.b(); public static u3 b = new u3(2); /* renamed from: c reason: collision with root package name */ public static u3 f4198c = new u3(1); private static q1 d = q1.APP_LAUNCH; private static boolean e = false; private static boolean f = true; /* renamed from: g reason: collision with root package name */ private static int f4199g = 30000; /* renamed from: h reason: collision with root package name */ private static int f4200h = 100000; private static int i = 30; private static int j = 10; private static int k = 100; private static int l = 30; private static int m = 1; public static String n = "__HIBERNATE__"; public static String o = "__HIBERNATE__TIME"; public static String p = "__MTA_KILL__"; /* renamed from: q reason: collision with root package name */ private static String f4201q; private static String r; public static String s = ""; private static int t = 180; /* renamed from: u reason: collision with root package name */ public static boolean f4202u = false; /* renamed from: v reason: collision with root package name */ public static int f4203v = 100; public static long w = 10000; public static boolean x = true; public static boolean y = true; public static volatile String z = "pingma.qq.com:80"; public static int a() { return i; } public static synchronized String a(Context context) { String str; synchronized (p1.class) { str = f4201q; } return str; } public static String a(String str, String str2) { try { String string = f4198c.b.getString(str); return string != null ? string : str2; } catch (Throwable unused) { s2 s2Var = f4197a; s2Var.g("can't find custom key:" + str); } } public static synchronized void a(int i3) { synchronized (p1.class) { } } public static void a(long j12) { i3.b(x3.a(), n, j12); b(false); f4197a.h("MTA is disable for current SDK version"); } public static void a(Context context, u3 u3Var) { int i3 = u3Var.f4235a; if (i3 == f4198c.f4235a) { f4198c = u3Var; a(u3Var.b); if (!f4198c.b.isNull("iplist")) { u1.a(context).a(f4198c.b.getString("iplist")); } } else if (i3 == b.f4235a) { b = u3Var; } } public static void a(Context context, u3 u3Var, JSONObject jSONObject) { try { Iterator<String> keys = jSONObject.keys(); boolean z4 = false; while (keys.hasNext()) { String next = keys.next(); if (next.equalsIgnoreCase(NotifyType.VIBRATE)) { int i3 = jSONObject.getInt(next); if (u3Var.d != i3) { z4 = true; } u3Var.d = i3; } else if (next.equalsIgnoreCase("c")) { String string = jSONObject.getString("c"); if (string.length() > 0) { u3Var.b = new JSONObject(string); } } else if (next.equalsIgnoreCase("m")) { u3Var.f4236c = jSONObject.getString("m"); } } if (z4) { f2 a5 = f2.a(x3.a()); if (a5 != null) { a5.a(u3Var); } if (u3Var.f4235a == f4198c.f4235a) { a(u3Var.b); b(u3Var.b); } } a(context, u3Var); } catch (JSONException e6) { f4197a.a((Throwable) e6); } } public static void a(Context context, String str) { s2 s2Var; String str2; if (context == null) { s2Var = f4197a; str2 = "ctx in StatConfig.setAppKey() is null"; } else if (str == null || str.length() > 256) { s2Var = f4197a; str2 = "appkey in StatConfig.setAppKey() is null or exceed 256 bytes"; } else { f4201q = str; return; } s2Var.d(str2); } public static void a(Context context, JSONObject jSONObject) { u3 u3Var; JSONObject jSONObject2; try { Iterator<String> keys = jSONObject.keys(); while (keys.hasNext()) { String next = keys.next(); if (next.equalsIgnoreCase(Integer.toString(f4198c.f4235a))) { jSONObject2 = jSONObject.getJSONObject(next); u3Var = f4198c; } else if (next.equalsIgnoreCase(Integer.toString(b.f4235a))) { jSONObject2 = jSONObject.getJSONObject(next); u3Var = b; } else if (next.equalsIgnoreCase("rs")) { q1 statReportStrategy = q1.getStatReportStrategy(jSONObject.getInt(next)); if (statReportStrategy != null) { d = statReportStrategy; if (p()) { s2 s2Var = f4197a; s2Var.a("Change to ReportStrategy:" + statReportStrategy.name()); } } } else { return; } a(context, u3Var, jSONObject2); } } catch (JSONException e6) { f4197a.a((Throwable) e6); } } public static void a(q1 q1Var) { d = q1Var; if (q1Var != q1.PERIOD) { s1.p = 0; } if (p()) { s2 s2Var = f4197a; s2Var.a("Change to statSendStrategy: " + q1Var); } } public static void a(String str) { r = str; } public static void a(JSONObject jSONObject) { try { q1 statReportStrategy = q1.getStatReportStrategy(jSONObject.getInt("rs")); if (statReportStrategy != null) { a(statReportStrategy); } } catch (JSONException unused) { if (p()) { f4197a.e("rs not found."); } } } public static void a(boolean z4) { x = z4; } public static boolean a(int i3, int i12, int i13) { return i3 >= i12 && i3 <= i13; } public static boolean a(JSONObject jSONObject, String str, String str2) { if (jSONObject.isNull(str)) { return false; } String optString = jSONObject.optString(str); return e3.c(str2) && e3.c(optString) && str2.equalsIgnoreCase(optString); } public static String b(Context context) { if (context == null) { f4197a.d("Context for getCustomUid is null."); return null; } if (E == null) { E = i3.a(context, "MTA_CUSTOM_UID", ""); } return E; } public static void b() { C++; } public static void b(int i3) { if (i3 >= 0) { C = i3; } } public static void b(Context context, String str) { if (str.length() > 128) { f4197a.d("the length of installChannel can not exceed the range of 128 bytes."); } else { r = str; } } /* JADX WARNING: Removed duplicated region for block: B:18:0x0040 A[Catch:{ Exception -> 0x01a7 }] */ public static void b(Context context, JSONObject jSONObject) { int i3; Integer num; try { String optString = jSONObject.optString(p); if (e3.c(optString)) { JSONObject jSONObject2 = new JSONObject(optString); if (jSONObject2.length() != 0) { boolean z4 = false; if (!jSONObject2.isNull("sm")) { Object obj = jSONObject2.get("sm"); if (obj instanceof Integer) { num = (Integer) obj; } else if (obj instanceof String) { num = Integer.valueOf((String) obj); } else { i3 = 0; if (i3 > 0) { if (p()) { s2 s2Var = f4197a; s2Var.e("match sleepTime:" + i3 + " minutes"); } i3.b(context, o, System.currentTimeMillis() + ((long) (i3 * 60 * 1000))); b(false); f4197a.h("MTA is disable for current SDK version"); } } i3 = num.intValue(); if (i3 > 0) { } } boolean z5 = true; if (a(jSONObject2, "sv", "2.0.4")) { f4197a.e("match sdk version:2.0.4"); z4 = true; } String str = Build.MODEL; if (a(jSONObject2, "md", str)) { s2 s2Var2 = f4197a; s2Var2.e("match MODEL:" + str); z4 = true; } if (a(jSONObject2, "av", e3.i(context))) { s2 s2Var3 = f4197a; s2Var3.e("match app version:" + e3.i(context)); z4 = true; } StringBuilder sb2 = new StringBuilder(); String str2 = Build.MANUFACTURER; sb2.append(str2); if (a(jSONObject2, "mf", sb2.toString())) { s2 s2Var4 = f4197a; s2Var4.e("match MANUFACTURER:" + str2); z4 = true; } StringBuilder sb3 = new StringBuilder(); int i12 = Build.VERSION.SDK_INT; sb3.append(i12); if (a(jSONObject2, "osv", sb3.toString())) { s2 s2Var5 = f4197a; s2Var5.e("match android SDK version:" + i12); z4 = true; } StringBuilder sb4 = new StringBuilder(); sb4.append(i12); if (a(jSONObject2, "ov", sb4.toString())) { s2 s2Var6 = f4197a; s2Var6.e("match android SDK version:" + i12); z4 = true; } if (a(jSONObject2, "ui", f2.a(context).b(context).b())) { s2 s2Var7 = f4197a; s2Var7.e("match imei:" + f2.a(context).b(context).b()); z4 = true; } if (a(jSONObject2, "mid", d(context))) { s2 s2Var8 = f4197a; s2Var8.e("match mid:" + d(context)); } else { z5 = z4; } if (z5) { a(e3.b("2.0.4")); } } } } catch (Exception e6) { f4197a.a((Throwable) e6); } } public static void b(String str) { if (str == null || str.length() == 0) { f4197a.d("statReportUrl cannot be null or empty."); return; } A = str; try { z = new URI(A).getHost(); } catch (Exception e6) { f4197a.g(e6); } if (p()) { s2 s2Var = f4197a; s2Var.e("url:" + A + ", domain:" + z); } } public static void b(JSONObject jSONObject) { if (jSONObject != null && jSONObject.length() != 0) { try { b(x3.a(), jSONObject); String string = jSONObject.getString(n); if (p()) { s2 s2Var = f4197a; s2Var.a("hibernateVer:" + string + ", current version:2.0.4"); } long b2 = e3.b(string); if (e3.b("2.0.4") <= b2) { a(b2); } } catch (JSONException unused) { f4197a.a("__HIBERNATE__ not found."); } } } public static void b(boolean z4) { f = z4; if (!z4) { f4197a.h("!!!!!!MTA StatService has been disabled!!!!!!"); } } public static int c() { return C; } public static synchronized String c(Context context) { String str; synchronized (p1.class) { str = r; } return str; } public static void c(int i3) { if (!a(i3, 1, 10080)) { f4197a.d("setSendPeriodMinutes can not exceed the range of [1, 7*24*60] minutes."); } else { t = i3; } } public static v3 d() { return F; } public static String d(Context context) { return context != null ? e0.a(context).a().a() : "0"; } public static int e() { return l; } public static String e(Context context) { return i3.a(context, "mta.acc.qq", s); } public static int f() { return B; } public static int g() { return k; } public static int h() { return j; } public static int i() { return f4200h; } public static int j() { return m; } public static int k() { return t; } public static int l() { return f4199g; } public static String m() { return A; } public static q1 n() { return d; } public static boolean o() { return y; } public static boolean p() { return e; } public static boolean q() { return D; } public static boolean r() { return f; } }