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.alipay.sdk.m.u.i; import com.amap.api.maps.AMapException; import com.heytap.mcssdk.constant.Constants; import com.loc.bj; import com.loc.bl; import com.taobao.weex.WXEnvironment; import com.taobao.weex.el.parse.Operators; import io.dcloud.common.adapter.util.Logger; 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.json.JSONException; import org.json.JSONObject; /* compiled from: AuthConfigManager */ public final class m { private static ConcurrentHashMap<String, Boolean> A = new ConcurrentHashMap<>(); private static ArrayList<bj.a> B = new ArrayList<>(); private static volatile boolean C = false; private static Queue<bj.c> D = new LinkedList(); /* renamed from: a reason: collision with root package name */ public static int f6758a = -1; /* renamed from: b reason: collision with root package name */ public static String f6759b = ""; /* renamed from: c reason: collision with root package name */ public static Context f6760c = null; /* renamed from: d reason: collision with root package name */ public static volatile boolean f6761d = false; /* renamed from: e reason: collision with root package name */ public static int f6762e = 5000; /* renamed from: f reason: collision with root package name */ public static boolean f6763f = true; /* renamed from: g reason: collision with root package name */ public static boolean f6764g = 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 /* renamed from: a reason: collision with root package name */ public JSONObject f6769a; @Deprecated /* renamed from: b reason: collision with root package name */ public JSONObject f6770b; /* renamed from: c reason: collision with root package name */ public String f6771c; /* renamed from: d reason: collision with root package name */ public int f6772d = -1; /* renamed from: e reason: collision with root package name */ public long f6773e = 0; /* renamed from: f reason: collision with root package name */ public JSONObject f6774f; /* renamed from: g reason: collision with root package name */ public a f6775g; public C0062b h; private boolean i; /* compiled from: AuthConfigManager */ public static class a { /* renamed from: a reason: collision with root package name */ public boolean f6776a; /* renamed from: b reason: collision with root package name */ public boolean f6777b; /* renamed from: c reason: collision with root package name */ public JSONObject f6778c; } /* renamed from: com.loc.m$b$b reason: collision with other inner class name */ /* compiled from: AuthConfigManager */ public static class C0062b { /* renamed from: a reason: collision with root package name */ public boolean f6779a; } } /* access modifiers changed from: package-private */ /* compiled from: AuthConfigManager */ public static class c extends bh { private String h; private Map<String, String> i = null; private String j; private String k; private String l; c(Context context, w wVar, String str, String str2, String str3, String str4) { super(context, wVar); this.h = str; this.j = str2; this.k = str3; this.l = str4; a(bl.c.HTTPS); a(bl.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.bl public final Map<String, String> a() { if (TextUtils.isEmpty(this.l)) { return null; } HashMap hashMap = new HashMap(); hashMap.put(com.alipay.sdk.m.l.c.f2245f, this.l); return hashMap; } @Override // com.loc.bh public final byte[] a_() { return null; } @Override // com.loc.bl public final String b() { return a("https://restsdk.amap.com/v3/iasdkauth", this.j); } @Override // com.loc.bh public final byte[] b_() { String u = o.u(((bh) this).f6211a); if (!TextUtils.isEmpty(u)) { u = s.a(new StringBuilder(u).reverse().toString()); } HashMap hashMap = new HashMap(); hashMap.put("authkey", TextUtils.isEmpty(this.h) ? "" : this.h); hashMap.put("plattype", WXEnvironment.OS); hashMap.put("product", ((bh) this).f6212b.a()); hashMap.put("version", ((bh) this).f6212b.b()); hashMap.put("output", "json"); StringBuilder sb = new StringBuilder(); sb.append(Build.VERSION.SDK_INT); hashMap.put("androidversion", sb.toString()); hashMap.put("deviceId", u); hashMap.put("manufacture", Build.MANUFACTURER); Map<String, String> map = this.i; if (map != null && !map.isEmpty()) { hashMap.putAll(this.i); } hashMap.put("abitype", x.a(((bh) this).f6211a)); hashMap.put("ext", ((bh) this).f6212b.d()); return x.a(x.a(hashMap)); } @Override // com.loc.r, com.loc.bl public final String c() { return a("https://dualstack-arestapi.amap.com/v3/iasdkauth", this.k); } /* access modifiers changed from: protected */ @Override // com.loc.bh public final String f() { return "3.0"; } /* access modifiers changed from: protected */ @Override // com.loc.bl public final String g() { return !TextUtils.isEmpty(this.l) ? this.l : super.g(); } } /* access modifiers changed from: private */ /* compiled from: AuthConfigManager */ public static class d { /* renamed from: a reason: collision with root package name */ w f6780a; /* renamed from: b reason: collision with root package name */ String f6781b; /* renamed from: c reason: collision with root package name */ a f6782c; private d() { } /* synthetic */ d(byte b2) { this(); } } /* compiled from: AuthConfigManager */ public static class e { /* renamed from: a reason: collision with root package name */ private String f6783a; /* renamed from: b reason: collision with root package name */ private String f6784b; /* renamed from: c reason: collision with root package name */ private AtomicInteger f6785c; public e(String str, String str2, int i) { this.f6783a = str; this.f6784b = str2; this.f6785c = 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.f6785c; if (atomicInteger == null) { return 0; } return atomicInteger.get(); } public final void a(String str) { this.f6784b = str; } public final String b() { try { JSONObject jSONObject = new JSONObject(); jSONObject.put("a", this.f6783a); jSONObject.put("f", this.f6784b); jSONObject.put("h", this.f6785c.get()); return jSONObject.toString(); } catch (Throwable unused) { return ""; } } } /* compiled from: AuthConfigManager */ public static class f { /* renamed from: a reason: collision with root package name */ public static boolean f6786a = true; /* renamed from: b reason: collision with root package name */ public static boolean f6787b = false; /* renamed from: c reason: collision with root package name */ public static boolean f6788c = true; /* renamed from: d reason: collision with root package name */ public static int f6789d = 0; /* renamed from: e reason: collision with root package name */ public static boolean f6790e = false; /* renamed from: f reason: collision with root package name */ public static int f6791f; } public static b a(Context context, w wVar, String str, String str2, String str3, String str4) { return b(context, wVar, 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 (m.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.f6783a)) { break; } i2++; } if (eVar == null) { return eVar; } if (context == null) { return null; } e b2 = e.b(av.b(context, str2, str, "")); String a2 = x.a(System.currentTimeMillis(), Logger.TIMESTAMP_YYYY_MM_DD); if (b2 == null) { b2 = new e(str, a2, 0); } if (!a2.equals(b2.f6784b)) { b2.a(a2); b2.f6785c.set(0); } p.add(b2); return b2; } eVar = null; if (eVar == null) { } } } public static void a(Context context) { if (context != null) { f6760c = context.getApplicationContext(); } } private static void a(Context context, w wVar, 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", wVar.a()); hashMap.put("amap_sdk_version", wVar.c()); String jSONObject = new JSONObject(hashMap).toString(); if (!TextUtils.isEmpty(jSONObject)) { try { br brVar = new br(context, "core", "2.0", "O001"); brVar.a(jSONObject); bs.a(brVar, context); } catch (k unused) { } } } public static synchronized void a(Context context, w wVar, String str, a aVar) { synchronized (m.class) { if (context != null && wVar != null) { try { if (f6760c == null) { f6760c = context.getApplicationContext(); } String a2 = wVar.a(); if (!TextUtils.isEmpty(a2)) { a(wVar); 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.f6780a = wVar; dVar.f6781b = str; dVar.f6782c = aVar; v.put(a2, dVar); t.put(a2, Long.valueOf(av.b(f6760c, "open_common", a2))); d(f6760c); } } } catch (Throwable th) { ak.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:0x02e3 A[SYNTHETIC, Splitter:B:126:0x02e3] */ /* JADX WARNING: Removed duplicated region for block: B:132:0x02fb A[SYNTHETIC, Splitter:B:132:0x02fb] */ /* JADX WARNING: Removed duplicated region for block: B:141:? A[RETURN, SYNTHETIC] */ private static void a(Context context, w wVar, 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.f6776a = false; aVar.f6777b = false; bVar.f6775g = aVar; try { String[] split = str.split(i.f2452b); 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.f6774f.putOpt(str5, jSONObject.get(str5)); } else { strArr = split; } i2++; split = strArr; } } } catch (Throwable th2) { ak.a(th2, "at", "co"); } if (x.a(jSONObject, "16H")) { try { bVar.i = a(jSONObject.getJSONObject("16H").optString("able"), false); } catch (Throwable th3) { ak.a(th3, "AuthConfigManager", "load 16H"); } } if (x.a(jSONObject, "11K")) { try { JSONObject jSONObject2 = jSONObject.getJSONObject("11K"); aVar.f6776a = a(jSONObject2.getString("able"), false); if (jSONObject2.has("off")) { aVar.f6778c = jSONObject2.getJSONObject("off"); } } catch (Throwable th4) { ak.a(th4, "AuthConfigManager", "load 11K"); } } if (x.a(jSONObject, "145")) { try { bVar.f6769a = jSONObject.getJSONObject("145"); } catch (Throwable th5) { ak.a(th5, "AuthConfigManager", "load 145"); } } if (x.a(jSONObject, "14D")) { try { bVar.f6770b = jSONObject.getJSONObject("14D"); } catch (Throwable th6) { ak.a(th6, "AuthConfigManager", "load 14D"); } } if (x.a(jSONObject, "151")) { try { JSONObject jSONObject3 = jSONObject.getJSONObject("151"); b.C0062b bVar2 = new b.C0062b(); if (jSONObject3 != null) { bVar2.f6779a = a(jSONObject3.optString("able"), false); } bVar.h = bVar2; } catch (Throwable th7) { ak.a(th7, "AuthConfigManager", "load 151"); } } if (x.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 = av.a(context, "open_common"); av.a(a5, "a2", a4); av.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"; ak.a(th, "AuthConfigManager", "load 17S"); if (x.a(jSONObject, "15K")) { } context2 = context; if (x.a(jSONObject, "183")) { } if (x.a(jSONObject, "17I")) { } } } catch (Throwable th9) { th = th9; str3 = "ust"; str2 = "umv"; ak.a(th, "AuthConfigManager", "load 17S"); if (x.a(jSONObject, "15K")) { } context2 = context; if (x.a(jSONObject, "183")) { } if (x.a(jSONObject, "17I")) { } } try { int optInt3 = jSONObject4.optInt("bgp_retry", 3); boolean a8 = a(jSONObject4.optString("perf_data_upload_enable"), false); if (!(a6 == f6763f && a7 == f6764g && optInt == f6762e && optInt2 == x && a2 == h && a3 == i && optInt3 == y && a8 == j)) { f6763f = a6; f6764g = a7; f6762e = optInt; x = optInt2; h = a2; i = a3; y = optInt3; j = a8; if (context != null) { SharedPreferences.Editor a9 = av.a(context, "open_common"); av.a(a9, "a13", a6); av.a(a9, "a6", a2); av.a(a9, "a7", a7); av.a(a9, "a8", optInt); av.a(a9, "a9", optInt2); av.a(a9, "a10", a3); av.a(a9, "a11", optInt3); av.a(a9, "a12", a8); av.a(a9); } } new StringBuilder("static_enable=").append(f6763f); bj.a(); new StringBuilder("bgp_enable=").append(h); bj.a(); new StringBuilder("static_ip_direct_enable=").append(f6764g); bj.a(); new StringBuilder("bgp_ip_direct_enable=").append(i); bj.a(); new StringBuilder("perf_data_upload_enable=").append(j); bj.a(); } catch (Throwable th10) { th = th10; ak.a(th, "AuthConfigManager", "load 17S"); if (x.a(jSONObject, "15K")) { } context2 = context; if (x.a(jSONObject, "183")) { } if (x.a(jSONObject, "17I")) { } } if (x.a(jSONObject, "15K")) { try { JSONObject jSONObject5 = jSONObject.getJSONObject("15K"); if (jSONObject5 != null) { boolean a10 = a(jSONObject5.optString("ucf"), f.f6786a); boolean a11 = a(jSONObject5.optString("fsv2"), f.f6787b); boolean a12 = a(jSONObject5.optString("usc"), f.f6788c); int optInt4 = jSONObject5.optInt(str2, f.f6789d); boolean a13 = a(jSONObject5.optString(str3), f.f6790e); int optInt5 = jSONObject5.optInt(str4, f.f6791f); if (!(a10 == f.f6786a && a11 == f.f6787b && a12 == f.f6788c && optInt4 == f.f6789d && a13 == f.f6790e && optInt5 == f.f6789d)) { f.f6786a = a10; f.f6787b = a11; f.f6788c = a12; f.f6789d = optInt4; f.f6790e = a13; f.f6791f = optInt5; context2 = context; try { SharedPreferences.Editor a14 = av.a(context2, "open_common"); av.a(a14, "ucf", f.f6786a); av.a(a14, "fsv2", f.f6787b); av.a(a14, "usc", f.f6788c); av.a(a14, str2, f.f6789d); av.a(a14, str3, f.f6790e); av.a(a14, str4, f.f6791f); av.a(a14); } catch (Throwable unused) { } if (x.a(jSONObject, "183")) { try { bi.a(wVar, jSONObject.getJSONObject("183")); } catch (Throwable th11) { ak.a(th11, "AuthConfigManager", "load 183"); } } if (x.a(jSONObject, "17I")) { try { JSONObject jSONObject6 = jSONObject.getJSONObject("17I"); boolean a15 = a(jSONObject6.optString("na"), false); boolean a16 = a(jSONObject6.optString("aa"), false); ag.f6109d = a15; ag.f6110e = a16; SharedPreferences.Editor a17 = av.a(context2, "open_common"); av.a(a17, "a4", a15); av.a(a17, "a5", a16); av.a(a17); return; } catch (Throwable th12) { ak.a(th12, "AuthConfigManager", "load 17I"); return; } } else { return; } } } } catch (Throwable th13) { context2 = context; ak.a(th13, "AuthConfigManager", "load 15K"); } } context2 = context; if (x.a(jSONObject, "183")) { } if (x.a(jSONObject, "17I")) { } } } catch (Throwable th14) { th = th14; str4 = "ustv"; str3 = "ust"; str2 = "umv"; ak.a(th, "AuthConfigManager", "load 17S"); if (x.a(jSONObject, "15K")) { } context2 = context; if (x.a(jSONObject, "183")) { } if (x.a(jSONObject, "17I")) { } } } str4 = "ustv"; str3 = "ust"; str2 = "umv"; if (x.a(jSONObject, "15K")) { } context2 = context; if (x.a(jSONObject, "183")) { } if (x.a(jSONObject, "17I")) { } } private static void a(Context context, w wVar, Throwable th) { a(context, wVar, th.getMessage()); } public static void a(Context context, String str) { l.a(context, str); } private static void a(Context context, String str, String str2, e eVar) { if (eVar != null && !TextUtils.isEmpty(eVar.f6783a)) { String b2 = eVar.b(); if (!TextUtils.isEmpty(b2) && context != null) { SharedPreferences.Editor a2 = av.a(context, str2); a2.putString(str, b2); av.a(a2); } } } public static void a(bj.c cVar) { if (cVar != null && f6760c != null) { HashMap hashMap = new HashMap(); hashMap.put("serverip", cVar.f6245c); hashMap.put("hostname", cVar.f6247e); hashMap.put("path", cVar.f6246d); hashMap.put("csid", cVar.f6243a); hashMap.put("degrade", String.valueOf(cVar.f6244b.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.f6248f)); String jSONObject = new JSONObject(hashMap).toString(); "--埋点--".concat(String.valueOf(jSONObject)); bj.a(); if (!TextUtils.isEmpty(jSONObject)) { try { br brVar = new br(f6760c, "core", "2.0", "O008"); brVar.a(jSONObject); bs.a(brVar, f6760c); } catch (k unused) { } } } } private static void a(w wVar) { if (wVar != null) { try { if (!TextUtils.isEmpty(wVar.a())) { String c2 = wVar.c(); if (TextUtils.isEmpty(c2)) { c2 = wVar.b(); } if (!TextUtils.isEmpty(c2)) { ag.a(wVar.a(), c2); } } } catch (Throwable unused) { } } } private static void a(String str, String str2) { e a2 = a(f6760c, str, str2); String a3 = x.a(System.currentTimeMillis(), Logger.TIMESTAMP_YYYY_MM_DD); if (!a3.equals(a2.f6784b)) { a2.a(a3); a2.f6785c.set(0); } a2.f6785c.incrementAndGet(); a(f6760c, str, str2, a2); } public static synchronized void a(final String str, boolean z2, final String str2, final String str3, final String str4) { synchronized (m.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) { bi.a(true, str); } cj.a().b(new ck() { /* class com.loc.m.AnonymousClass1 */ @Override // com.loc.ck public final void a() { d dVar = (d) m.v.get(str); if (dVar != null) { a aVar = dVar.f6782c; b a2 = m.a(m.f6760c, dVar.f6780a, dVar.f6781b, str2, str3, str4); if (a2 != null && aVar != null) { aVar.a(a2); } } } }); } } } } } catch (Throwable th) { ak.a(th, "at", "lca"); } } } public static void a(String str, boolean z2, boolean z3, boolean z4) { if (!TextUtils.isEmpty(str) && f6760c != null) { HashMap hashMap = new HashMap(); hashMap.put("url", str); hashMap.put("downLevel", String.valueOf(z2)); String str2 = "0"; hashMap.put("ant", o.o(f6760c) == 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 { br brVar = new br(f6760c, "core", "2.0", "O002"); brVar.a(jSONObject); bs.a(brVar, f6760c); } catch (k unused) { } } } } public static void a(boolean z2, bj.a aVar) { if (C && aVar != null) { synchronized (B) { if (z2) { Iterator<bj.a> it = B.iterator(); while (it.hasNext()) { bj.a next = it.next(); if (next.f6235b.equals(aVar.f6235b) && next.f6238e.equals(aVar.f6238e) && next.f6239f == aVar.f6239f) { if (next.j == aVar.j) { it.remove(); } else { next.j.set(next.j.get() - aVar.j.get()); } bj.a(); } } } C = false; Iterator<bj.a> it2 = B.iterator(); while (true) { bj.a(); if (it2.hasNext()) { bj.a next2 = it2.next(); StringBuilder sb = new StringBuilder("----path="); sb.append(next2.f6238e); sb.append("-counts="); sb.append(next2.j); sb.append("-code="); sb.append(next2.f6239f); sb.append("----"); } else { bj.a(); } } } } } public static void a(boolean z2, String str) { Boolean bool = Boolean.TRUE; try { "--markHostNameFailed---hostname=".concat(String.valueOf(str)); bj.a(); if (!f6763f && !z2) { return; } if ((!i && z2) || TextUtils.isEmpty(str)) { return; } if (!z2) { if (z.get(str) == null) { z.put(str, bool); a(b(str, "a14"), "open_common"); } } else if (A.get(str) == null) { A.put(str, bool); a(b(str, "a15"), "open_common"); } } catch (Throwable unused) { } } public static boolean a() { e a2; if (f6760c != null) { i(); if (!c()) { return false; } if (b()) { return true; } } return o && (a2 = a(f6760c, "IPV6_CONFIG_NAME", "open_common")) != null && a2.a() < 5; } public static synchronized boolean a(String str) { synchronized (m.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) { ak.a(th, "at", "cslct"); } } } public static synchronized boolean a(String str, long j2) { synchronized (m.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(Operators.DIV); 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:0x0144 */ /* JADX WARNING: Removed duplicated region for block: B:98:0x01b7 A[RETURN] */ /* JADX WARNING: Removed duplicated region for block: B:99:0x01b8 */ private static b b(Context context, w wVar, String str, String str2, String str3, String str4) { String str5; String str6; String str7; String str8; String str9; b bVar; String str10; byte[] bArr; bm bmVar; String str11; String str12; byte[] bArr2; k e2; String str13; Context context2; IllegalBlockSizeException th; Context context3; k e3; Context context4; byte[] bArr3; StringBuilder sb; b bVar2 = new b(); bVar2.f6774f = new JSONObject(); if (context != null) { f6760c = context.getApplicationContext(); } e(); String str14 = null; try { a(wVar); new bg(); boolean isEmpty = TextUtils.isEmpty(str); if (!isEmpty) { try { sb = new StringBuilder(); str13 = str; } catch (k e4) { e3 = e4; str13 = str; str5 = "infocode"; str7 = "result"; str6 = "ver"; bVar = bVar2; str9 = "at"; str10 = "lc"; try { throw e3; } catch (k e5) { e2 = e5; } catch (IllegalBlockSizeException e6) { th = e6; str8 = str13; bmVar = null; context2 = null; a(context, wVar, th); bArr = context2; if (bArr == null) { } } catch (Throwable th2) { th = th2; str8 = str13; bmVar = null; context3 = null; an.b(th, str9, str10); context2 = context3; a(context, wVar, th); bArr = context2; if (bArr == null) { } } } catch (Throwable unused) { str13 = str; str8 = str13; str5 = "infocode"; str7 = "result"; str6 = "ver"; bVar = bVar2; str9 = "at"; str10 = "lc"; try { throw new k(AMapException.ERROR_UNKNOWN); } catch (k e7) { e2 = e7; bmVar = null; bArr2 = null; bVar.f6771c = e2.a(); a(context, wVar, e2.a()); an.a(wVar, "/v3/iasdkauth", e2); bArr = bArr2; if (bArr == null) { } } catch (IllegalBlockSizeException e8) { th = e8; bmVar = null; context2 = null; a(context, wVar, th); bArr = context2; if (bArr == null) { } } catch (Throwable th3) { th = th3; bmVar = null; context3 = null; an.b(th, str9, str10); context2 = context3; a(context, wVar, th); bArr = context2; if (bArr == null) { } } } try { sb.append(str13); sb.append(";15K;16H;17I;17S;183"); str8 = sb.toString(); } catch (k e9) { e3 = e9; str5 = "infocode"; str7 = "result"; str6 = "ver"; bVar = bVar2; str9 = "at"; str10 = "lc"; throw e3; } catch (Throwable unused2) { str8 = str13; str5 = "infocode"; str7 = "result"; str6 = "ver"; bVar = bVar2; str9 = "at"; str10 = "lc"; throw new k(AMapException.ERROR_UNKNOWN); } } else { str8 = str; } try { d(context); context4 = context; str7 = "result"; bVar = bVar2; str6 = "ver"; str9 = "at"; str5 = "infocode"; str10 = "lc"; } catch (k e10) { e3 = e10; str5 = "infocode"; str7 = "result"; str6 = "ver"; bVar = bVar2; str9 = "at"; str10 = "lc"; str13 = str8; throw e3; } catch (Throwable unused3) { str5 = "infocode"; str7 = "result"; str6 = "ver"; bVar = bVar2; str9 = "at"; str10 = "lc"; throw new k(AMapException.ERROR_UNKNOWN); } try { bmVar = bg.a(new c(context4, wVar, str8, str2, str3, str4)); if (isEmpty) { return bVar; } if (bmVar != null) { try { byte[] bArr4 = bmVar.f6289a; try { Map<String, List<String>> map = bmVar.f6290b; 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)) { long longValue = Long.valueOf(str15).longValue(); bVar.f6773e = longValue; bArr3 = bArr4; if (wVar != null) { bArr3 = bArr4; if (longValue != 0) { String a2 = wVar.a(); bArr3 = bArr4; if (!TextUtils.isEmpty(a2)) { b(a2, bVar.f6773e); bArr3 = bArr4; } } } } } } } } } catch (Throwable th4) { try { an.b(th4, str9, "lct"); bArr3 = bArr4; } catch (k e11) { e2 = e11; bArr2 = context4; bVar.f6771c = e2.a(); a(context, wVar, e2.a()); an.a(wVar, "/v3/iasdkauth", e2); bArr = bArr2; if (bArr == null) { } } catch (IllegalBlockSizeException e12) { th = e12; context2 = context4; a(context, wVar, th); bArr = context2; if (bArr == null) { } } catch (Throwable th5) { th = th5; context3 = context4; an.b(th, str9, str10); context2 = context3; a(context, wVar, th); bArr = context2; if (bArr == null) { } } } } catch (k e13) { e2 = e13; bArr2 = null; bVar.f6771c = e2.a(); a(context, wVar, e2.a()); an.a(wVar, "/v3/iasdkauth", e2); bArr = bArr2; if (bArr == null) { } } catch (IllegalBlockSizeException e14) { th = e14; context2 = null; a(context, wVar, th); bArr = context2; if (bArr == null) { } } catch (Throwable th6) { th = th6; context3 = null; an.b(th, str9, str10); context2 = context3; a(context, wVar, 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, x.c("EQUVT")); Cipher instance = Cipher.getInstance(x.c("CQUVTL0NCQy9QS0NTNVBhZGRpbmc")); instance.init(2, secretKeySpec, new IvParameterSpec(x.c())); str14 = x.a(instance.doFinal(bArr6)); bArr = bArr3; if (bArr == null) { return bVar; } if (TextUtils.isEmpty(str14)) { str14 = x.a(bArr); } if (TextUtils.isEmpty(str14)) { a(context, wVar, "result is null"); } try { JSONObject jSONObject = new JSONObject(str14); if (jSONObject.has("status")) { int i2 = jSONObject.getInt("status"); if (i2 == 1) { f6758a = 1; } else if (i2 == 0) { if (bmVar != null) { str11 = bmVar.f6291c; str12 = bmVar.f6292d; } else { str11 = "authcsid"; str12 = "authgsid"; } x.a(context, str11, str12, jSONObject); f6758a = 0; if (jSONObject.has("info")) { f6759b = jSONObject.getString("info"); } String str16 = ""; if (jSONObject.has(str5)) { str16 = jSONObject.getString(str5); } an.a(wVar, "/v3/iasdkauth", f6759b, str12, str11, str16); if (f6758a == 0) { bVar.f6771c = f6759b; return bVar; } } try { if (jSONObject.has(str6)) { bVar.f6772d = jSONObject.getInt(str6); } } catch (Throwable th7) { ak.a(th7, str9, str10); } if (x.a(jSONObject, str7)) { JSONObject jSONObject2 = jSONObject.getJSONObject(str7); a(context, wVar, str8, bVar, jSONObject2); try { JSONObject jSONObject3 = jSONObject2.getJSONObject("15K"); boolean a3 = a(jSONObject3.optString("isTargetAble"), false); if (!a(jSONObject3.optString("able"), false)) { q.a(); q.b(context); } else { q.a().a(context, a3); } } catch (Throwable unused4) { } } } } catch (Throwable th8) { ak.a(th8, str9, str10); } return bVar; } catch (k e15) { e3 = e15; str13 = str8; throw e3; } catch (Throwable unknown) { throw new k(AMapException.ERROR_UNKNOWN); } } catch (k e16) { e2 = e16; str13 = str; str5 = "infocode"; str7 = "result"; str6 = "ver"; bVar = bVar2; str9 = "at"; str10 = "lc"; str8 = str13; bmVar = null; bArr2 = null; bVar.f6771c = e2.a(); a(context, wVar, e2.a()); an.a(wVar, "/v3/iasdkauth", e2); bArr = bArr2; if (bArr == null) { } } catch (IllegalBlockSizeException e17) { th = e17; str13 = str; str5 = "infocode"; str7 = "result"; str6 = "ver"; bVar = bVar2; str9 = "at"; str10 = "lc"; str8 = str13; bmVar = null; context2 = null; a(context, wVar, th); bArr = context2; if (bArr == null) { } } catch (Throwable th9) { th = th9; str13 = str; str5 = "infocode"; str7 = "result"; str6 = "ver"; bVar = bVar2; str9 = "at"; str10 = "lc"; str8 = str13; bmVar = null; context3 = null; an.b(th, str9, str10); context2 = context3; a(context, wVar, th); bArr = context2; if (bArr == null) { } } } private static String b(String str, String str2) { String a2 = s.a(str.getBytes()); return str2 + "_" + a2; } public static void b(Context context) { if (context != null) { o = av.a(context, "open_common", "a2", true); } } public static void b(bj.c cVar) { int i2; synchronized (B) { boolean z2 = false; for (int i3 = 0; i3 < B.size(); i3++) { bj.a aVar = B.get(i3); if (cVar.f6245c.equals(aVar.f6235b) && cVar.f6246d.equals(aVar.f6238e) && cVar.m == (i2 = aVar.f6239f)) { if (i2 == 1) { aVar.i = ((((long) aVar.j.get()) * aVar.i) + cVar.f6248f) / ((long) (aVar.j.get() + 1)); } aVar.j.getAndIncrement(); z2 = true; } } if (!z2) { B.add(new bj.a(cVar)); } bj.a(); } } public static synchronized void b(String str) { synchronized (m.class) { if (u != null) { if (u.containsKey(str)) { u.remove(str); } } } } private static synchronized void b(String str, long j2) { synchronized (m.class) { try { if (v != null) { if (v.containsKey(str)) { if (t == null) { t = new ConcurrentHashMap<>(8); } t.put(str, Long.valueOf(j2)); Context context = f6760c; if (context != null) { SharedPreferences.Editor a2 = av.a(context, "open_common"); av.a(a2, str, j2); av.a(a2); } } } } catch (Throwable th) { ak.a(th, "at", "ucut"); } } } public static synchronized void b(String str, boolean z2) { synchronized (m.class) { a(str, z2, (String) null, (String) null, (String) null); } } public static boolean b() { Integer num; Context context = f6760c; if (context == null) { return false; } String t2 = o.t(context); return !TextUtils.isEmpty(t2) && (num = q.get(t2.toUpperCase())) != null && num.intValue() == 2; } public static synchronized long c(String str) { synchronized (m.class) { try { if (t == null) { t = new ConcurrentHashMap<>(8); } if (t.containsKey(str)) { return t.get(str).longValue(); } } catch (Throwable th) { ak.a(th, "at", "glcut"); } return 0; } } private static void c(Context context) { if (context != null) { f6763f = av.a(context, "open_common", "a13", true); h = av.a(context, "open_common", "a6", true); f6764g = av.a(context, "open_common", "a7", false); f6762e = av.a(context, "open_common", "a8", 5000); x = av.a(context, "open_common", "a9", 3); i = av.a(context, "open_common", "a10", false); y = av.a(context, "open_common", "a11", 3); j = av.a(context, "open_common", "a12", false); } } public static void c(bj.c cVar) { if (cVar != null && j) { synchronized (D) { D.offer(cVar); bj.a(); } } } public static boolean c() { Integer num; Context context = f6760c; if (context == null) { return false; } String t2 = o.t(context); return !TextUtils.isEmpty(t2) && (num = q.get(t2.toUpperCase())) != null && num.intValue() >= 2; } public static void d() { try { e a2 = a(f6760c, "IPV6_CONFIG_NAME", "open_common"); String a3 = x.a(System.currentTimeMillis(), Logger.TIMESTAMP_YYYY_MM_DD); if (!a3.equals(a2.f6784b)) { a2.a(a3); a2.f6785c.set(0); } a2.f6785c.incrementAndGet(); a(f6760c, "IPV6_CONFIG_NAME", "open_common", a2); } catch (Throwable unused) { } } private static void d(Context context) { try { if (!w) { ag.f6109d = av.a(context, "open_common", "a4", true); ag.f6110e = av.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 (!f6763f) { return false; } if (!(z.get(str) == null)) { return false; } Context context = f6760c; 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 (!f6761d) { try { Context context = f6760c; if (context != null) { f6761d = true; q.a().a(context); b(context); c(context); f.f6786a = av.a(context, "open_common", "ucf", f.f6786a); f.f6787b = av.a(context, "open_common", "fsv2", f.f6787b); f.f6788c = av.a(context, "open_common", "usc", f.f6788c); f.f6789d = av.a(context, "open_common", "umv", f.f6789d); f.f6790e = av.a(context, "open_common", "ust", f.f6790e); f.f6791f = av.a(context, "open_common", "ustv", f.f6791f); } } 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 = f6760c; return context == null || (a2 = a(context, b(str, "a15"), "open_common")) == null || a2.a() < y; } catch (Throwable unused) { } } public static bj.a f() { if (C) { return null; } synchronized (B) { if (C) { return null; } Collections.sort(B); if (B.size() <= 0) { return null; } bj.a a2 = B.get(0).clone(); C = true; return a2; } } public static bj.c g() { synchronized (D) { bj.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 = f6760c; if (context != null) { String t2 = o.t(context); if (!TextUtils.isEmpty(r) && !TextUtils.isEmpty(t2) && r.equals(t2) && System.currentTimeMillis() - s < Constants.MILLS_OF_MIN) { return; } if (!TextUtils.isEmpty(t2)) { r = t2; } } else if (System.currentTimeMillis() - s < Constants.MILLS_OF_EXCEPTION_TIME) { return; } s = System.currentTimeMillis(); q.clear(); Iterator it = Collections.list(NetworkInterface.getNetworkInterfaces()).iterator(); while (it.hasNext()) { NetworkInterface networkInterface = (NetworkInterface) it.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(x.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) { ak.a(th, "at", "ipstack"); } } }