package com.loc; import android.content.Context; import android.content.SharedPreferences; import android.net.Uri; import android.os.Build; import android.os.SystemClock; import android.text.TextUtils; import com.amap.api.maps.AMapException; import com.google.android.exoplayer2.metadata.id3.InternalFrame; import com.huawei.hms.support.hianalytics.HiAnalyticsConstant; import com.loc.bf; import com.loc.bh; import com.lzy.okgo.cookie.SerializableCookie; import com.xiaomi.mipush.sdk.Constants; import java.net.Inet4Address; import java.net.Inet6Address; import java.net.InetAddress; import java.net.InterfaceAddress; import java.net.NetworkInterface; import java.net.URLDecoder; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Queue; import java.util.Vector; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.atomic.AtomicInteger; import javax.crypto.Cipher; import javax.crypto.IllegalBlockSizeException; import javax.crypto.spec.IvParameterSpec; import javax.crypto.spec.SecretKeySpec; import org.apache.commons.lang3.BooleanUtils; import org.json.JSONException; import org.json.JSONObject; /* compiled from: AuthConfigManager */ public final class l { private static ConcurrentHashMap<String, Boolean> A = new ConcurrentHashMap<>(); private static ArrayList<bf.a> B = new ArrayList<>(); private static volatile boolean C = false; private static Queue<bf.c> D = new LinkedList(); public static int a = -1; public static String b = ""; public static Context c = null; public static volatile boolean d = false; public static int e = 5000; public static boolean f = true; public static boolean g = false; public static boolean h = true; public static boolean i = false; public static boolean j = false; private static String k = "6"; private static String l = "4"; private static String m = "9"; private static String n = "8"; private static volatile boolean o = true; private static Vector<e> p = new Vector<>(); private static Map<String, Integer> q = new HashMap(); private static String r = null; private static long s = 0; private static volatile ConcurrentHashMap<String, Long> t = new ConcurrentHashMap<>(8); private static volatile ConcurrentHashMap<String, Long> u = new ConcurrentHashMap<>(8); private static volatile ConcurrentHashMap<String, d> v = new ConcurrentHashMap<>(8); private static boolean w = false; private static int x = 3; private static int y = 3; private static ConcurrentHashMap<String, Boolean> z = new ConcurrentHashMap<>(); /* compiled from: AuthConfigManager */ public interface a { void a(b bVar); } /* compiled from: AuthConfigManager */ public static class b { @Deprecated public JSONObject a; @Deprecated public JSONObject b; public String c; public int d = -1; public long e = 0; public JSONObject f; public a g; public C0022b h; private boolean i; /* compiled from: AuthConfigManager */ public static class a { public boolean a; public boolean b; public JSONObject c; } /* renamed from: com.loc.l$b$b reason: collision with other inner class name */ /* compiled from: AuthConfigManager */ public static class C0022b { public boolean a; } } /* access modifiers changed from: package-private */ /* compiled from: AuthConfigManager */ public static class c extends bd { private String g; private Map<String, String> h = null; private String i; private String j; private String k; c(Context context, t tVar, String str, String str2, String str3, String str4) { super(context, tVar); this.g = str; this.i = str2; this.j = str3; this.k = str4; a(bh.c.HTTPS); a(bh.a.FIX); } private static String a(String str, String str2) { try { return !TextUtils.isEmpty(str2) ? Uri.parse(str).buildUpon().encodedAuthority(str2).build().toString() : str; } catch (Throwable unused) { return str; } } @Override // com.loc.bh public final Map<String, String> a() { if (TextUtils.isEmpty(this.k)) { return null; } HashMap hashMap = new HashMap(); hashMap.put(SerializableCookie.HOST, this.k); return hashMap; } @Override // com.loc.bd public final byte[] a_() { return null; } @Override // com.loc.bh public final String b() { return a("https://restsdk.amap.com/v3/iasdkauth", this.i); } @Override // com.loc.bd public final byte[] b_() { String w = n.w(this.a); if (!TextUtils.isEmpty(w)) { w = r.a(new StringBuilder(w).reverse().toString()); } HashMap hashMap = new HashMap(); hashMap.put("authkey", TextUtils.isEmpty(this.g) ? "" : this.g); hashMap.put("plattype", "android"); hashMap.put("product", this.b.a()); hashMap.put(Constants.VERSION, this.b.b()); hashMap.put("output", "json"); StringBuilder sb = new StringBuilder(); sb.append(Build.VERSION.SDK_INT); hashMap.put("androidversion", sb.toString()); hashMap.put("deviceId", w); hashMap.put("manufacture", Build.MANUFACTURER); Map<String, String> map = this.h; if (map != null && !map.isEmpty()) { hashMap.putAll(this.h); } hashMap.put("abitype", u.a(this.a)); hashMap.put("ext", this.b.d()); return u.a(u.a(hashMap)); } @Override // com.loc.q, com.loc.bh public final String c() { return a("https://dualstack-arestapi.amap.com/v3/iasdkauth", this.j); } /* access modifiers changed from: protected */ @Override // com.loc.bd public final String f() { return "3.0"; } /* access modifiers changed from: protected */ @Override // com.loc.bh public final String g() { return !TextUtils.isEmpty(this.k) ? this.k : super.g(); } } /* access modifiers changed from: private */ /* compiled from: AuthConfigManager */ public static class d { t a; String b; a c; private d() { } /* synthetic */ d(byte b2) { this(); } } /* compiled from: AuthConfigManager */ public static class e { private String a; private String b; private AtomicInteger c; public e(String str, String str2, int i) { this.a = str; this.b = str2; this.c = new AtomicInteger(i); } public static e b(String str) { if (TextUtils.isEmpty(str)) { return null; } try { JSONObject jSONObject = new JSONObject(str); return new e(jSONObject.optString("a"), jSONObject.optString("f"), jSONObject.optInt("h")); } catch (Throwable unused) { return null; } } public final int a() { AtomicInteger atomicInteger = this.c; if (atomicInteger == null) { return 0; } return atomicInteger.get(); } public final void a(String str) { this.b = str; } public final String b() { try { JSONObject jSONObject = new JSONObject(); jSONObject.put("a", this.a); jSONObject.put("f", this.b); jSONObject.put("h", this.c.get()); return jSONObject.toString(); } catch (Throwable unused) { return ""; } } } /* compiled from: AuthConfigManager */ public static class f { public static boolean a = true; public static boolean b = false; public static boolean c = true; public static int d = 0; public static boolean e = false; public static int f; } public static b a(Context context, t tVar, String str, String str2, String str3, String str4) { return b(context, tVar, str, str2, str3, str4); } /* JADX WARNING: Removed duplicated region for block: B:15:0x002f A[DONT_GENERATE] */ /* JADX WARNING: Removed duplicated region for block: B:17:0x0031 */ private static synchronized e a(Context context, String str, String str2) { e eVar; synchronized (l.class) { if (!TextUtils.isEmpty(str)) { int i2 = 0; while (true) { if (i2 >= p.size()) { break; } eVar = p.get(i2); if (eVar != null && str.equals(eVar.a)) { break; } i2++; } if (eVar == null) { return eVar; } if (context == null) { return null; } e b2 = e.b(am.b(context, str2, str, "")); String a2 = u.a(System.currentTimeMillis(), "yyyyMMdd"); if (b2 == null) { b2 = new e(str, a2, 0); } if (!a2.equals(b2.b)) { b2.a(a2); b2.c.set(0); } p.add(b2); return b2; } eVar = null; if (eVar == null) { } } } public static void a(Context context) { if (context != null) { c = context.getApplicationContext(); } } private static void a(Context context, t tVar, String str) { HashMap hashMap = new HashMap(); hashMap.put("amap_sdk_auth_fail", "1"); hashMap.put("amap_sdk_auth_fail_type", str); hashMap.put("amap_sdk_name", tVar.a()); hashMap.put("amap_sdk_version", tVar.c()); String jSONObject = new JSONObject(hashMap).toString(); if (!TextUtils.isEmpty(jSONObject)) { try { bn bnVar = new bn(context, "core", "2.0", "O001"); bnVar.a(jSONObject); bo.a(bnVar, context); } catch (j unused) { } } } public static synchronized void a(Context context, t tVar, String str, a aVar) { synchronized (l.class) { if (context != null && tVar != null) { try { if (c == null) { c = context.getApplicationContext(); } String a2 = tVar.a(); if (!TextUtils.isEmpty(a2)) { a(tVar); if (v == null) { v = new ConcurrentHashMap<>(8); } if (u == null) { u = new ConcurrentHashMap<>(8); } if (t == null) { t = new ConcurrentHashMap<>(8); } if (!v.containsKey(a2)) { d dVar = new d((byte) 0); dVar.a = tVar; dVar.b = str; dVar.c = aVar; v.put(a2, dVar); t.put(a2, Long.valueOf(am.b(c, "open_common", a2))); d(c); } } } catch (Throwable th) { ah.a(th, "at", "rglc"); } } } } /* JADX WARNING: Removed duplicated region for block: B:101:0x0244 A[SYNTHETIC, Splitter:B:101:0x0244] */ /* JADX WARNING: Removed duplicated region for block: B:126:0x02e5 A[SYNTHETIC, Splitter:B:126:0x02e5] */ /* JADX WARNING: Removed duplicated region for block: B:132:0x02fd A[SYNTHETIC, Splitter:B:132:0x02fd] */ /* JADX WARNING: Removed duplicated region for block: B:141:? A[RETURN, SYNTHETIC] */ private static void a(Context context, t tVar, String str, b bVar, JSONObject jSONObject) throws JSONException { String str2; String str3; String str4; Context context2; Throwable th; boolean a2; boolean a3; boolean a4; String[] strArr; b.a aVar = new b.a(); aVar.a = false; aVar.b = false; bVar.g = aVar; try { String[] split = str.split(";"); if (split != null && split.length > 0) { int length = split.length; int i2 = 0; while (i2 < length) { String str5 = split[i2]; if (jSONObject.has(str5)) { strArr = split; bVar.f.putOpt(str5, jSONObject.get(str5)); } else { strArr = split; } i2++; split = strArr; } } } catch (Throwable th2) { ah.a(th2, "at", "co"); } if (u.a(jSONObject, "16H")) { try { bVar.i = a(jSONObject.getJSONObject("16H").optString("able"), false); } catch (Throwable th3) { ah.a(th3, "AuthConfigManager", "load 16H"); } } if (u.a(jSONObject, "11K")) { try { JSONObject jSONObject2 = jSONObject.getJSONObject("11K"); aVar.a = a(jSONObject2.getString("able"), false); if (jSONObject2.has(BooleanUtils.OFF)) { aVar.c = jSONObject2.getJSONObject(BooleanUtils.OFF); } } catch (Throwable th4) { ah.a(th4, "AuthConfigManager", "load 11K"); } } if (u.a(jSONObject, "145")) { try { bVar.a = jSONObject.getJSONObject("145"); } catch (Throwable th5) { ah.a(th5, "AuthConfigManager", "load 145"); } } if (u.a(jSONObject, "14D")) { try { bVar.b = jSONObject.getJSONObject("14D"); } catch (Throwable th6) { ah.a(th6, "AuthConfigManager", "load 14D"); } } if (u.a(jSONObject, "151")) { try { JSONObject jSONObject3 = jSONObject.getJSONObject("151"); b.C0022b bVar2 = new b.C0022b(); if (jSONObject3 != null) { bVar2.a = a(jSONObject3.optString("able"), false); } bVar.h = bVar2; } catch (Throwable th7) { ah.a(th7, "AuthConfigManager", "load 151"); } } if (u.a(jSONObject, "17S")) { try { JSONObject jSONObject4 = jSONObject.getJSONObject("17S"); if (!(jSONObject4 == null || (a4 = a(jSONObject4.optString("able"), false)) == o)) { o = a4; if (context != null) { SharedPreferences.Editor a5 = am.a(context, "open_common"); am.a(a5, "a2", a4); am.a(a5); } } if (jSONObject4 != null) { boolean a6 = a(jSONObject4.optString("static_enable"), true); boolean a7 = a(jSONObject4.optString("static_ip_direct_enable"), false); int optInt = jSONObject4.optInt("static_timeout", 5) * 1000; int optInt2 = jSONObject4.optInt("static_retry", 3); str4 = "ustv"; try { a2 = a(jSONObject4.optString("bgp_enable"), true); str3 = "ust"; try { a3 = a(jSONObject4.optString("bgp_ip_direct_enable"), false); str2 = "umv"; } catch (Throwable th8) { th = th8; str2 = "umv"; ah.a(th, "AuthConfigManager", "load 17S"); if (u.a(jSONObject, "15K")) { } context2 = context; if (u.a(jSONObject, "183")) { } if (u.a(jSONObject, "17I")) { } } } catch (Throwable th9) { th = th9; str3 = "ust"; str2 = "umv"; ah.a(th, "AuthConfigManager", "load 17S"); if (u.a(jSONObject, "15K")) { } context2 = context; if (u.a(jSONObject, "183")) { } if (u.a(jSONObject, "17I")) { } } try { int optInt3 = jSONObject4.optInt("bgp_retry", 3); boolean a8 = a(jSONObject4.optString("perf_data_upload_enable"), false); if (!(a6 == f && a7 == g && optInt == e && optInt2 == x && a2 == h && a3 == i && optInt3 == y && a8 == j)) { f = a6; g = a7; e = optInt; x = optInt2; h = a2; i = a3; y = optInt3; j = a8; if (context != null) { SharedPreferences.Editor a9 = am.a(context, "open_common"); am.a(a9, "a13", a6); am.a(a9, "a6", a2); am.a(a9, "a7", a7); am.a(a9, "a8", optInt); am.a(a9, "a9", optInt2); am.a(a9, "a10", a3); am.a(a9, "a11", optInt3); am.a(a9, "a12", a8); am.a(a9); } } new StringBuilder("static_enable=").append(f); bf.a(); new StringBuilder("bgp_enable=").append(h); bf.a(); new StringBuilder("static_ip_direct_enable=").append(g); bf.a(); new StringBuilder("bgp_ip_direct_enable=").append(i); bf.a(); new StringBuilder("perf_data_upload_enable=").append(j); bf.a(); } catch (Throwable th10) { th = th10; ah.a(th, "AuthConfigManager", "load 17S"); if (u.a(jSONObject, "15K")) { } context2 = context; if (u.a(jSONObject, "183")) { } if (u.a(jSONObject, "17I")) { } } if (u.a(jSONObject, "15K")) { try { JSONObject jSONObject5 = jSONObject.getJSONObject("15K"); if (jSONObject5 != null) { boolean a10 = a(jSONObject5.optString("ucf"), f.a); boolean a11 = a(jSONObject5.optString("fsv2"), f.b); boolean a12 = a(jSONObject5.optString("usc"), f.c); int optInt4 = jSONObject5.optInt(str2, f.d); boolean a13 = a(jSONObject5.optString(str3), f.e); int optInt5 = jSONObject5.optInt(str4, f.f); if (!(a10 == f.a && a11 == f.b && a12 == f.c && optInt4 == f.d && a13 == f.e && optInt5 == f.d)) { f.a = a10; f.b = a11; f.c = a12; f.d = optInt4; f.e = a13; f.f = optInt5; context2 = context; try { SharedPreferences.Editor a14 = am.a(context2, "open_common"); am.a(a14, "ucf", f.a); am.a(a14, "fsv2", f.b); am.a(a14, "usc", f.c); am.a(a14, str2, f.d); am.a(a14, str3, f.e); am.a(a14, str4, f.f); am.a(a14); } catch (Throwable unused) { } if (u.a(jSONObject, "183")) { try { be.a(tVar, jSONObject.getJSONObject("183")); } catch (Throwable th11) { ah.a(th11, "AuthConfigManager", "load 183"); } } if (u.a(jSONObject, "17I")) { try { JSONObject jSONObject6 = jSONObject.getJSONObject("17I"); boolean a15 = a(jSONObject6.optString("na"), false); boolean a16 = a(jSONObject6.optString("aa"), false); ad.d = a15; ad.e = a16; SharedPreferences.Editor a17 = am.a(context2, "open_common"); am.a(a17, "a4", a15); am.a(a17, "a5", a16); am.a(a17); return; } catch (Throwable th12) { ah.a(th12, "AuthConfigManager", "load 17I"); return; } } else { return; } } } } catch (Throwable th13) { context2 = context; ah.a(th13, "AuthConfigManager", "load 15K"); } } context2 = context; if (u.a(jSONObject, "183")) { } if (u.a(jSONObject, "17I")) { } } } catch (Throwable th14) { th = th14; str4 = "ustv"; str3 = "ust"; str2 = "umv"; ah.a(th, "AuthConfigManager", "load 17S"); if (u.a(jSONObject, "15K")) { } context2 = context; if (u.a(jSONObject, "183")) { } if (u.a(jSONObject, "17I")) { } } } str4 = "ustv"; str3 = "ust"; str2 = "umv"; if (u.a(jSONObject, "15K")) { } context2 = context; if (u.a(jSONObject, "183")) { } if (u.a(jSONObject, "17I")) { } } private static void a(Context context, t tVar, Throwable th) { a(context, tVar, th.getMessage()); } public static void a(Context context, String str) { k.a(context, str); } private static void a(Context context, String str, String str2, e eVar) { if (eVar != null && !TextUtils.isEmpty(eVar.a)) { String b2 = eVar.b(); if (!TextUtils.isEmpty(b2) && context != null) { SharedPreferences.Editor a2 = am.a(context, str2); a2.putString(str, b2); am.a(a2); } } } public static void a(bf.c cVar) { if (cVar != null && c != null) { HashMap hashMap = new HashMap(); hashMap.put("serverip", cVar.c); hashMap.put("hostname", cVar.e); hashMap.put("path", cVar.d); hashMap.put("csid", cVar.a); hashMap.put("degrade", String.valueOf(cVar.b.a())); hashMap.put("errorcode", String.valueOf(cVar.m)); hashMap.put("errorsubcode", String.valueOf(cVar.n)); hashMap.put("connecttime", String.valueOf(cVar.h)); hashMap.put("writetime", String.valueOf(cVar.i)); hashMap.put("readtime", String.valueOf(cVar.j)); hashMap.put("datasize", String.valueOf(cVar.l)); hashMap.put("totaltime", String.valueOf(cVar.f)); String jSONObject = new JSONObject(hashMap).toString(); "--埋点--".concat(String.valueOf(jSONObject)); bf.a(); if (!TextUtils.isEmpty(jSONObject)) { try { bn bnVar = new bn(c, "core", "2.0", "O008"); bnVar.a(jSONObject); bo.a(bnVar, c); } catch (j unused) { } } } } private static void a(t tVar) { if (tVar != null) { try { if (!TextUtils.isEmpty(tVar.a())) { String c2 = tVar.c(); if (TextUtils.isEmpty(c2)) { c2 = tVar.b(); } if (!TextUtils.isEmpty(c2)) { ad.a(tVar.a(), c2); } } } catch (Throwable unused) { } } } private static void a(String str, String str2) { e a2 = a(c, str, str2); String a3 = u.a(System.currentTimeMillis(), "yyyyMMdd"); if (!a3.equals(a2.b)) { a2.a(a3); a2.c.set(0); } a2.c.incrementAndGet(); a(c, str, str2, a2); } public static synchronized void a(final String str, boolean z2, final String str2, final String str3, final String str4) { synchronized (l.class) { try { if (!TextUtils.isEmpty(str)) { if (u == null) { u = new ConcurrentHashMap<>(8); } u.put(str, Long.valueOf(SystemClock.elapsedRealtime())); if (v != null) { if (v.containsKey(str)) { if (!TextUtils.isEmpty(str)) { if (z2) { be.a(true, str); } cf.a().b(new cg() { /* class com.loc.l.AnonymousClass1 */ @Override // com.loc.cg public final void a() { d dVar = (d) l.v.get(str); if (dVar != null) { a aVar = dVar.c; b a2 = l.a(l.c, dVar.a, dVar.b, str2, str3, str4); if (a2 != null && aVar != null) { aVar.a(a2); } } } }); } } } } } catch (Throwable th) { ah.a(th, "at", "lca"); } } } public static void a(String str, boolean z2, boolean z3, boolean z4) { if (!TextUtils.isEmpty(str) && c != null) { HashMap hashMap = new HashMap(); hashMap.put("url", str); hashMap.put("downLevel", String.valueOf(z2)); String str2 = "0"; hashMap.put("ant", n.q(c) == 0 ? str2 : "1"); hashMap.put("type", z4 ? z2 ? m : n : z2 ? k : l); if (!z3) { str2 = "1"; } hashMap.put("status", str2); String jSONObject = new JSONObject(hashMap).toString(); if (!TextUtils.isEmpty(jSONObject)) { try { bn bnVar = new bn(c, "core", "2.0", "O002"); bnVar.a(jSONObject); bo.a(bnVar, c); } catch (j unused) { } } } } public static void a(boolean z2, bf.a aVar) { if (C && aVar != null) { synchronized (B) { if (z2) { Iterator<bf.a> it2 = B.iterator(); while (it2.hasNext()) { bf.a next = it2.next(); if (next.b.equals(aVar.b) && next.e.equals(aVar.e) && next.f == aVar.f) { if (next.j == aVar.j) { it2.remove(); } else { next.j.set(next.j.get() - aVar.j.get()); } bf.a(); } } } C = false; Iterator<bf.a> it3 = B.iterator(); while (true) { bf.a(); if (it3.hasNext()) { bf.a next2 = it3.next(); StringBuilder sb = new StringBuilder("----path="); sb.append(next2.e); sb.append("-counts="); sb.append(next2.j); sb.append("-code="); sb.append(next2.f); sb.append(InternalFrame.ID); } else { bf.a(); } } } } } public static void a(boolean z2, String str) { try { "--markHostNameFailed---hostname=".concat(String.valueOf(str)); bf.a(); if (!f && !z2) { return; } if ((!i && z2) || TextUtils.isEmpty(str)) { return; } if (!z2) { if (z.get(str) == null) { z.put(str, Boolean.TRUE); a(b(str, "a14"), "open_common"); } } else if (A.get(str) == null) { A.put(str, Boolean.TRUE); a(b(str, "a15"), "open_common"); } } catch (Throwable unused) { } } public static boolean a() { e a2; if (c != null) { i(); if (!c()) { return false; } if (b()) { return true; } } return o && (a2 = a(c, "IPV6_CONFIG_NAME", "open_common")) != null && a2.a() < 5; } public static synchronized boolean a(String str) { synchronized (l.class) { try { if (TextUtils.isEmpty(str)) { return false; } if (v == null) { return false; } if (u == null) { u = new ConcurrentHashMap<>(8); } if (v.containsKey(str) && !u.containsKey(str)) { u.put(str, Long.valueOf(SystemClock.elapsedRealtime())); return true; } return false; } catch (Throwable th) { ah.a(th, "at", "cslct"); } } } public static synchronized boolean a(String str, long j2) { synchronized (l.class) { boolean z2 = false; try { if (TextUtils.isEmpty(str)) { return false; } if (j2 > c(str)) { long j3 = 0; if (u != null && u.containsKey(str)) { j3 = u.get(str).longValue(); } if (SystemClock.elapsedRealtime() - j3 > 30000) { z2 = true; } } return z2; } catch (Throwable unused) { } } } public static boolean a(String str, boolean z2) { try { if (TextUtils.isEmpty(str)) { return z2; } String[] split = URLDecoder.decode(str).split("/"); return split[split.length - 1].charAt(4) % 2 == 1; } catch (Throwable unused) { return z2; } } private static boolean a(InetAddress inetAddress) { return inetAddress.isLoopbackAddress() || inetAddress.isLinkLocalAddress() || inetAddress.isAnyLocalAddress(); } /* JADX DEBUG: Multi-variable search result rejected for r2v53, resolved type: byte[] */ /* JADX WARN: Multi-variable type inference failed */ /* JADX WARNING: Missing exception handler attribute for start block: B:67:0x0146 */ /* JADX WARNING: Removed duplicated region for block: B:98:0x01b9 A[RETURN] */ /* JADX WARNING: Removed duplicated region for block: B:99:0x01ba */ private static b b(Context context, t tVar, String str, String str2, String str3, String str4) { String str5; String str6; String str7; String str8; String str9; b bVar; String str10; byte[] bArr; bi biVar; String str11; String str12; byte[] bArr2; j e2; String str13; Context context2; IllegalBlockSizeException th; Context context3; j e3; Context context4; byte[] bArr3; StringBuilder sb; b bVar2 = new b(); bVar2.f = new JSONObject(); if (context != null) { c = context.getApplicationContext(); } e(); String str14 = null; try { a(tVar); new bc(); boolean isEmpty = TextUtils.isEmpty(str); if (!isEmpty) { try { sb = new StringBuilder(); str13 = str; } catch (j e4) { e3 = e4; str13 = str; str5 = "infocode"; str7 = HiAnalyticsConstant.BI_KEY_RESUST; str6 = "ver"; bVar = bVar2; str9 = "at"; str10 = "lc"; try { throw e3; } catch (j e5) { e2 = e5; } catch (IllegalBlockSizeException e6) { th = e6; str8 = str13; biVar = null; context2 = null; a(context, tVar, th); bArr = context2; if (bArr == null) { } } catch (Throwable th2) { th = th2; str8 = str13; biVar = null; context3 = null; ak.b(th, str9, str10); context2 = context3; a(context, tVar, th); bArr = context2; if (bArr == null) { } } } catch (Throwable unused) { str13 = str; str8 = str13; str5 = "infocode"; str7 = HiAnalyticsConstant.BI_KEY_RESUST; str6 = "ver"; bVar = bVar2; str9 = "at"; str10 = "lc"; try { throw new j(AMapException.ERROR_UNKNOWN); } catch (j e7) { e2 = e7; biVar = null; bArr2 = null; bVar.c = e2.a(); a(context, tVar, e2.a()); ak.a(tVar, "/v3/iasdkauth", e2); bArr = bArr2; if (bArr == null) { } } catch (IllegalBlockSizeException e8) { th = e8; biVar = null; context2 = null; a(context, tVar, th); bArr = context2; if (bArr == null) { } } catch (Throwable th3) { th = th3; biVar = null; context3 = null; ak.b(th, str9, str10); context2 = context3; a(context, tVar, th); bArr = context2; if (bArr == null) { } } } try { sb.append(str13); sb.append(";15K;16H;17I;17S;183"); str8 = sb.toString(); } catch (j e9) { e3 = e9; str5 = "infocode"; str7 = HiAnalyticsConstant.BI_KEY_RESUST; str6 = "ver"; bVar = bVar2; str9 = "at"; str10 = "lc"; throw e3; } catch (Throwable unused2) { str8 = str13; str5 = "infocode"; str7 = HiAnalyticsConstant.BI_KEY_RESUST; str6 = "ver"; bVar = bVar2; str9 = "at"; str10 = "lc"; throw new j(AMapException.ERROR_UNKNOWN); } } else { str8 = str; } try { d(context); context4 = context; str7 = HiAnalyticsConstant.BI_KEY_RESUST; bVar = bVar2; str6 = "ver"; str9 = "at"; str5 = "infocode"; str10 = "lc"; } catch (j e10) { e3 = e10; str5 = "infocode"; str7 = HiAnalyticsConstant.BI_KEY_RESUST; str6 = "ver"; bVar = bVar2; str9 = "at"; str10 = "lc"; str13 = str8; throw e3; } catch (Throwable unused3) { str5 = "infocode"; str7 = HiAnalyticsConstant.BI_KEY_RESUST; str6 = "ver"; bVar = bVar2; str9 = "at"; str10 = "lc"; throw new j(AMapException.ERROR_UNKNOWN); } try { biVar = bc.a(new c(context4, tVar, str8, str2, str3, str4)); if (isEmpty) { return bVar; } if (biVar != null) { try { byte[] bArr4 = biVar.a; try { Map<String, List<String>> map = biVar.b; bArr3 = bArr4; if (map != null) { bArr3 = bArr4; if (map.containsKey("lct")) { List<String> list = map.get("lct"); bArr3 = bArr4; if (list != null) { bArr3 = bArr4; if (list.size() > 0) { String str15 = list.get(0); bArr3 = bArr4; if (!TextUtils.isEmpty(str15)) { bVar.e = Long.valueOf(str15).longValue(); bArr3 = bArr4; if (tVar != null) { bArr3 = bArr4; if (bVar.e != 0) { String a2 = tVar.a(); bArr3 = bArr4; if (!TextUtils.isEmpty(a2)) { b(a2, bVar.e); bArr3 = bArr4; } } } } } } } } } catch (Throwable th4) { try { ak.b(th4, str9, "lct"); bArr3 = bArr4; } catch (j e11) { e2 = e11; bArr2 = context4; bVar.c = e2.a(); a(context, tVar, e2.a()); ak.a(tVar, "/v3/iasdkauth", e2); bArr = bArr2; if (bArr == null) { } } catch (IllegalBlockSizeException e12) { th = e12; context2 = context4; a(context, tVar, th); bArr = context2; if (bArr == null) { } } catch (Throwable th5) { th = th5; context3 = context4; ak.b(th, str9, str10); context2 = context3; a(context, tVar, th); bArr = context2; if (bArr == null) { } } } } catch (j e13) { e2 = e13; bArr2 = null; bVar.c = e2.a(); a(context, tVar, e2.a()); ak.a(tVar, "/v3/iasdkauth", e2); bArr = bArr2; if (bArr == null) { } } catch (IllegalBlockSizeException e14) { th = e14; context2 = null; a(context, tVar, th); bArr = context2; if (bArr == null) { } } catch (Throwable th6) { th = th6; context3 = null; ak.b(th, str9, str10); context2 = context3; a(context, tVar, th); bArr = context2; if (bArr == null) { } } } else { bArr3 = null; } byte[] bArr5 = new byte[16]; byte[] bArr6 = new byte[(bArr3.length - 16)]; System.arraycopy(bArr3, 0, bArr5, 0, 16); System.arraycopy(bArr3, 16, bArr6, 0, bArr3.length - 16); SecretKeySpec secretKeySpec = new SecretKeySpec(bArr5, u.c("EQUVT")); Cipher instance = Cipher.getInstance(u.c("CQUVTL0NCQy9QS0NTNVBhZGRpbmc")); instance.init(2, secretKeySpec, new IvParameterSpec(u.c())); str14 = u.a(instance.doFinal(bArr6)); bArr = bArr3; if (bArr == null) { return bVar; } if (TextUtils.isEmpty(str14)) { str14 = u.a(bArr); } if (TextUtils.isEmpty(str14)) { a(context, tVar, "result is null"); } try { JSONObject jSONObject = new JSONObject(str14); if (jSONObject.has("status")) { int i2 = jSONObject.getInt("status"); if (i2 == 1) { a = 1; } else if (i2 == 0) { if (biVar != null) { str11 = biVar.c; str12 = biVar.d; } else { str11 = "authcsid"; str12 = "authgsid"; } u.a(context, str11, str12, jSONObject); a = 0; if (jSONObject.has("info")) { b = jSONObject.getString("info"); } String str16 = ""; if (jSONObject.has(str5)) { str16 = jSONObject.getString(str5); } ak.a(tVar, "/v3/iasdkauth", b, str12, str11, str16); if (a == 0) { bVar.c = b; return bVar; } } try { if (jSONObject.has(str6)) { bVar.d = jSONObject.getInt(str6); } } catch (Throwable th7) { ah.a(th7, str9, str10); } if (u.a(jSONObject, str7)) { JSONObject jSONObject2 = jSONObject.getJSONObject(str7); a(context, tVar, str8, bVar, jSONObject2); try { JSONObject jSONObject3 = jSONObject2.getJSONObject("15K"); boolean a3 = a(jSONObject3.optString("isTargetAble"), false); if (!a(jSONObject3.optString("able"), false)) { p.a(); p.b(context); } else { p.a().a(context, a3); } } catch (Throwable unused4) { } } } } catch (Throwable th8) { ah.a(th8, str9, str10); } return bVar; } catch (j e15) { e3 = e15; str13 = str8; throw e3; } catch (Throwable unknown) { throw new j(AMapException.ERROR_UNKNOWN); } } catch (j e16) { e2 = e16; str13 = str; str5 = "infocode"; str7 = HiAnalyticsConstant.BI_KEY_RESUST; str6 = "ver"; bVar = bVar2; str9 = "at"; str10 = "lc"; str8 = str13; biVar = null; bArr2 = null; bVar.c = e2.a(); a(context, tVar, e2.a()); ak.a(tVar, "/v3/iasdkauth", e2); bArr = bArr2; if (bArr == null) { } } catch (IllegalBlockSizeException e17) { th = e17; str13 = str; str5 = "infocode"; str7 = HiAnalyticsConstant.BI_KEY_RESUST; str6 = "ver"; bVar = bVar2; str9 = "at"; str10 = "lc"; str8 = str13; biVar = null; context2 = null; a(context, tVar, th); bArr = context2; if (bArr == null) { } } catch (Throwable th9) { th = th9; str13 = str; str5 = "infocode"; str7 = HiAnalyticsConstant.BI_KEY_RESUST; str6 = "ver"; bVar = bVar2; str9 = "at"; str10 = "lc"; str8 = str13; biVar = null; context3 = null; ak.b(th, str9, str10); context2 = context3; a(context, tVar, th); bArr = context2; if (bArr == null) { } } } private static String b(String str, String str2) { String a2 = r.a(str.getBytes()); return str2 + "_" + a2; } public static void b(Context context) { if (context != null) { o = am.a(context, "open_common", "a2", true); } } public static void b(bf.c cVar) { synchronized (B) { boolean z2 = false; for (int i2 = 0; i2 < B.size(); i2++) { bf.a aVar = B.get(i2); if (cVar.c.equals(aVar.b) && cVar.d.equals(aVar.e) && cVar.m == aVar.f) { if (aVar.f == 1) { aVar.i = ((((long) aVar.j.get()) * aVar.i) + cVar.f) / ((long) (aVar.j.get() + 1)); } aVar.j.getAndIncrement(); z2 = true; } } if (!z2) { B.add(new bf.a(cVar)); } bf.a(); } } public static synchronized void b(String str) { synchronized (l.class) { if (u != null) { if (u.containsKey(str)) { u.remove(str); } } } } private static synchronized void b(String str, long j2) { synchronized (l.class) { try { if (v != null) { if (v.containsKey(str)) { if (t == null) { t = new ConcurrentHashMap<>(8); } t.put(str, Long.valueOf(j2)); Context context = c; if (context != null) { SharedPreferences.Editor a2 = am.a(context, "open_common"); am.a(a2, str, j2); am.a(a2); } } } } catch (Throwable th) { ah.a(th, "at", "ucut"); } } } public static synchronized void b(String str, boolean z2) { synchronized (l.class) { a(str, z2, (String) null, (String) null, (String) null); } } public static boolean b() { Integer num; Context context = c; if (context == null) { return false; } String v2 = n.v(context); return !TextUtils.isEmpty(v2) && (num = q.get(v2.toUpperCase())) != null && num.intValue() == 2; } public static synchronized long c(String str) { synchronized (l.class) { try { if (t == null) { t = new ConcurrentHashMap<>(8); } if (t.containsKey(str)) { return t.get(str).longValue(); } } catch (Throwable th) { ah.a(th, "at", "glcut"); } return 0; } } private static void c(Context context) { if (context != null) { f = am.a(context, "open_common", "a13", true); h = am.a(context, "open_common", "a6", true); g = am.a(context, "open_common", "a7", false); e = am.a(context, "open_common", "a8", 5000); x = am.a(context, "open_common", "a9", 3); i = am.a(context, "open_common", "a10", false); y = am.a(context, "open_common", "a11", 3); j = am.a(context, "open_common", "a12", false); } } public static void c(bf.c cVar) { if (cVar != null && j) { synchronized (D) { D.offer(cVar); bf.a(); } } } public static boolean c() { Integer num; Context context = c; if (context == null) { return false; } String v2 = n.v(context); return !TextUtils.isEmpty(v2) && (num = q.get(v2.toUpperCase())) != null && num.intValue() >= 2; } public static void d() { try { e a2 = a(c, "IPV6_CONFIG_NAME", "open_common"); String a3 = u.a(System.currentTimeMillis(), "yyyyMMdd"); if (!a3.equals(a2.b)) { a2.a(a3); a2.c.set(0); } a2.c.incrementAndGet(); a(c, "IPV6_CONFIG_NAME", "open_common", a2); } catch (Throwable unused) { } } private static void d(Context context) { try { if (!w) { ad.d = am.a(context, "open_common", "a4", true); ad.e = am.a(context, "open_common", "a5", true); w = true; } } catch (Throwable unused) { } } public static boolean d(String str) { e a2; try { if (TextUtils.isEmpty(str)) { return true; } if (!f) { return false; } if (!(z.get(str) == null)) { return false; } Context context = c; return context == null || (a2 = a(context, b(str, "a14"), "open_common")) == null || a2.a() < x; } catch (Throwable unused) { return true; } } public static void e() { if (!d) { try { Context context = c; if (context != null) { d = true; p.a().a(context); b(context); c(context); f.a = am.a(context, "open_common", "ucf", f.a); f.b = am.a(context, "open_common", "fsv2", f.b); f.c = am.a(context, "open_common", "usc", f.c); f.d = am.a(context, "open_common", "umv", f.d); f.e = am.a(context, "open_common", "ust", f.e); f.f = am.a(context, "open_common", "ustv", f.f); } } catch (Throwable unused) { } } } public static boolean e(String str) { e a2; try { if (TextUtils.isEmpty(str) || !i) { return false; } if (!(A.get(str) == null)) { return false; } Context context = c; return context == null || (a2 = a(context, b(str, "a15"), "open_common")) == null || a2.a() < y; } catch (Throwable unused) { } } public static bf.a f() { if (C) { return null; } synchronized (B) { if (C) { return null; } Collections.sort(B); if (B.size() <= 0) { return null; } bf.a a2 = B.get(0).clone(); C = true; return a2; } } public static bf.c g() { synchronized (D) { bf.c poll = D.poll(); if (poll != null) { return poll; } return null; } } private static void i() { Map<String, Integer> map; String str; Integer valueOf; try { Context context = c; if (context != null) { String v2 = n.v(context); if (!TextUtils.isEmpty(r) && !TextUtils.isEmpty(v2) && r.equals(v2) && System.currentTimeMillis() - s < 60000) { return; } if (!TextUtils.isEmpty(v2)) { r = v2; } } else if (System.currentTimeMillis() - s < 10000) { return; } s = System.currentTimeMillis(); q.clear(); Iterator it2 = Collections.list(NetworkInterface.getNetworkInterfaces()).iterator(); while (it2.hasNext()) { NetworkInterface networkInterface = (NetworkInterface) it2.next(); if (!networkInterface.getInterfaceAddresses().isEmpty()) { String displayName = networkInterface.getDisplayName(); int i2 = 0; for (InterfaceAddress interfaceAddress : networkInterface.getInterfaceAddresses()) { InetAddress address = interfaceAddress.getAddress(); if (address instanceof Inet6Address) { if (!a((Inet6Address) address)) { i2 |= 2; } } else if (address instanceof Inet4Address) { Inet4Address inet4Address = (Inet4Address) address; if (!a(inet4Address) && !inet4Address.getHostAddress().startsWith(u.c("FMTkyLjE2OC40My4"))) { i2 |= 1; } } } if (i2 != 0) { if (displayName != null && displayName.startsWith("wlan")) { map = q; str = "WIFI"; valueOf = Integer.valueOf(i2); } else if (displayName != null && displayName.startsWith("rmnet")) { map = q; str = "MOBILE"; valueOf = Integer.valueOf(i2); } map.put(str, valueOf); } } } } catch (Throwable th) { ah.a(th, "at", "ipstack"); } } }