package com.chinapay.mobilepayment; import android.content.Context; import com.meizu.cloud.pushsdk.notification.model.NotifyType; import java.lang.Thread; import java.util.Map; import java.util.Properties; import java.util.concurrent.ConcurrentHashMap; import org.json.JSONException; import org.json.JSONObject; public class s1 { /* renamed from: a */ private static x2 f4218a; private static volatile Map<String, Properties> b = new ConcurrentHashMap(); /* renamed from: c */ private static volatile Map<Integer, Integer> f4219c = new ConcurrentHashMap(10); private static volatile long d = 0; private static volatile long e = 0; private static volatile long f = 0; /* renamed from: g */ private static String f4220g = ""; /* renamed from: h */ private static volatile int f4221h = 0; private static Map<String, Long> i = new ConcurrentHashMap(); private static s2 j = e3.b(); private static Thread.UncaughtExceptionHandler k = null; private static volatile boolean l = true; public static volatile int m = 0; public static volatile long n = 0; private static Context o = null; public static volatile long p = 0; static { new ConcurrentHashMap(); new ConcurrentHashMap(); } public static int a(Context context, boolean z, t1 t1Var) { long currentTimeMillis = System.currentTimeMillis(); boolean z4 = true; boolean z5 = z && currentTimeMillis - e >= ((long) p1.l()); e = currentTimeMillis; if (f == 0) { f = e3.c(); } if (currentTimeMillis >= f) { f = e3.c(); if (f2.a(context).b(context).d() != 1) { f2.a(context).b(context).a(1); } p1.b(0); m = 0; f4220g = e3.a(0); z5 = true; } String str = f4220g; if (e3.a(t1Var)) { str = t1Var.a() + f4220g; } if (i.containsKey(str)) { z4 = z5; } if (z4) { if (e3.a(t1Var)) { a(context, t1Var); } else if (p1.c() < p1.f()) { e3.w(context); a(context, (t1) null); } else { j.c("Exceed StatConfig.getMaxDaySessionNumbers()."); } i.put(str, 1L); } if (l) { h(context); l = false; } return f4221h; } public static synchronized void a(Context context) { synchronized (s1.class) { if (context != null) { if (f4218a == null) { if (b(context)) { Context applicationContext = context.getApplicationContext(); o = applicationContext; f4218a = new x2(); f4220g = e3.a(0); d = System.currentTimeMillis() + p1.w; f4218a.a(new a4(applicationContext)); } } } } } public static void a(Context context, int i3) { s2 s2Var; String str; if (p1.r()) { if (p1.p()) { s2 s2Var2 = j; s2Var2.e("commitEvents, maxNumber=" + i3); } Context g3 = g(context); if (g3 == null) { s2Var = j; str = "The Context of StatService.commitEvents() can not be null!"; } else if (i3 < -1 || i3 == 0) { s2Var = j; str = "The maxNumber of StatService.commitEvents() should be -1 or bigger than 0."; } else if (u1.a(o).f() && c(g3) != null) { f4218a.a(new v1(g3, i3)); return; } else { return; } s2Var.d(str); } } public static void a(Context context, t1 t1Var) { if (c(context) != null) { if (p1.p()) { j.a("start new session."); } if (t1Var == null || f4221h == 0) { f4221h = e3.a(); } p1.a(0); p1.b(); new b2(new t3(context, f4221h, b(), t1Var)).a(); } } public static void a(Context context, String str, Properties properties, t1 t1Var) { s2 s2Var; String str2; if (p1.r()) { Context g3 = g(context); if (g3 == null) { s2Var = j; str2 = "The Context of StatService.trackCustomEvent() can not be null!"; } else if (a(str)) { s2Var = j; str2 = "The event_id of StatService.trackCustomEvent() can not be null or empty."; } else { o3 o3Var = new o3(str, null, properties); if (c(g3) != null) { f4218a.a(new d4(g3, t1Var, o3Var)); return; } return; } s2Var.d(str2); } } public static void a(Context context, Throwable th2) { if (p1.r()) { Context g3 = g(context); if (g3 == null) { j.d("The Context of StatService.reportSdkSelfException() can not be null!"); } else if (c(g3) != null) { f4218a.a(new b4(g3, th2)); } } } public static boolean a() { if (m < 2) { return false; } n = System.currentTimeMillis(); return true; } public static boolean a(Context context, String str, String str2, t1 t1Var) { try { if (!p1.r()) { j.d("MTA StatService is disable."); return false; } if (p1.p()) { j.a("MTA SDK version, current: " + "2.0.4" + " ,required: " + str2); } if (context == null || str2 == null) { j.d("Context or mtaSdkVersion in StatService.startStatService() is null, please check it!"); p1.b(false); return false; } else if (e3.b("2.0.4") < e3.b(str2)) { j.d(("MTA SDK version conflicted, current: " + "2.0.4" + ",required: " + str2) + ". please delete the current SDK and download the latest one. official website: http://mta.qq.com/ or http://mta.oa.com/"); p1.b(false); return false; } else { String c5 = p1.c(context); if (c5 == null || c5.length() == 0) { p1.a("-"); } if (str != null) { p1.a(context, str); } if (c(context) == null) { return true; } f4218a.a(new y1(context, t1Var)); return true; } } catch (Throwable th2) { j.a(th2); return false; } } public static boolean a(String str) { return str == null || str.length() == 0; } public static Properties b(String str) { return b.get(str); } public static JSONObject b() { JSONObject jSONObject = new JSONObject(); try { JSONObject jSONObject2 = new JSONObject(); int i3 = p1.f4198c.d; if (i3 != 0) { jSONObject2.put(NotifyType.VIBRATE, i3); } jSONObject.put(Integer.toString(p1.f4198c.f4235a), jSONObject2); JSONObject jSONObject3 = new JSONObject(); int i12 = p1.b.d; if (i12 != 0) { jSONObject3.put(NotifyType.VIBRATE, i12); } jSONObject.put(Integer.toString(p1.b.f4235a), jSONObject3); } catch (JSONException e6) { j.a((Throwable) e6); } return jSONObject; } public static boolean b(Context context) { boolean z; long a5 = i3.a(context, p1.n, 0L); long b2 = e3.b("2.0.4"); boolean z4 = false; if (b2 <= a5) { s2 s2Var = j; s2Var.d("MTA is disable for current version:" + b2 + ",wakeup version:" + a5); z = false; } else { z = true; } long a12 = i3.a(context, p1.o, 0L); if (a12 > System.currentTimeMillis()) { s2 s2Var2 = j; s2Var2.d("MTA is disable for current time:" + System.currentTimeMillis() + ",wakeup time:" + a12); } else { z4 = z; } p1.b(z4); return z4; } public static x2 c(Context context) { if (f4218a == null) { synchronized (s1.class) { if (f4218a == null) { try { a(context); } catch (Throwable th2) { j.b(th2); p1.b(false); } } } } return f4218a; } public static void c() { m = 0; n = 0; } public static void d() { m++; n = System.currentTimeMillis(); f(o); } public static void d(Context context) { if (p1.r()) { Context g3 = g(context); if (g3 == null) { j.d("The Context of StatService.sendNetworkDetector() can not be null!"); return; } try { x3.b(g3).a(new r3(g3), new c4()); } catch (Throwable th2) { j.a(th2); } } } public static void e(Context context) { p = System.currentTimeMillis() + ((long) (p1.k() * 60000)); i3.b(context, "last_period_ts", p); a(context, -1); } public static void f(Context context) { if (p1.r() && p1.H > 0) { Context g3 = g(context); if (g3 == null) { j.d("The Context of StatService.testSpeed() can not be null!"); } else { f2.a(g3).c(); } } } public static Context g(Context context) { return context != null ? context : o; } public static void h(Context context) { if (p1.r()) { Context g3 = g(context); if (g3 == null) { j.d("The Context of StatService.testSpeed() can not be null!"); } else if (c(g3) != null) { f4218a.a(new w1(g3)); } } } }