package com.g.gysdk.a; import android.text.TextUtils; import com.g.gysdk.GyCode; import com.g.gysdk.GyErrorCode; import com.g.gysdk.a.am; import com.g.gysdk.a.d; import com.g.gysdk.a.o; import com.g.gysdk.a.y; import java.util.concurrent.atomic.AtomicBoolean; import org.json.JSONObject; import y7.f; public class s { /* renamed from: a reason: collision with root package name */ public static boolean f22628a = true; /* renamed from: b reason: collision with root package name */ private AtomicBoolean f22629b; /* renamed from: c reason: collision with root package name */ private final o f22630c; /* renamed from: d reason: collision with root package name */ private final o f22631d; /* renamed from: e reason: collision with root package name */ private final o f22632e; /* renamed from: f reason: collision with root package name */ private String f22633f; /* renamed from: g reason: collision with root package name */ private String f22634g; /* renamed from: h reason: collision with root package name */ private String f22635h; /* renamed from: i reason: collision with root package name */ private String f22636i; /* renamed from: j reason: collision with root package name */ private String f22637j; /* renamed from: k reason: collision with root package name */ private String f22638k; /* renamed from: com.g.gysdk.a.s$6 reason: invalid class name */ public static /* synthetic */ class AnonymousClass6 { /* renamed from: a reason: collision with root package name */ public static final /* synthetic */ int[] f22648a; /* JADX WARNING: Can't wrap try/catch for region: R(6:0|1|2|3|4|(3:5|6|8)) */ /* JADX WARNING: Failed to process nested try/catch */ /* JADX WARNING: Missing exception handler attribute for start block: B:3:0x0012 */ /* JADX WARNING: Missing exception handler attribute for start block: B:5:0x001d */ static { int[] iArr = new int[o.e.values().length]; f22648a = iArr; iArr[o.e.CT.ordinal()] = 1; f22648a[o.e.CM.ordinal()] = 2; try { f22648a[o.e.CU.ordinal()] = 3; } catch (NoSuchFieldError unused) { } } } public static class a { /* renamed from: a reason: collision with root package name */ private static final s f22649a = new s(); } private s() { this.f22629b = new AtomicBoolean(false); this.f22633f = ""; this.f22634g = ""; this.f22635h = ""; this.f22636i = ""; this.f22637j = ""; this.f22638k = ""; this.f22630c = null; this.f22631d = new p(); this.f22632e = new q(); } private static int a(long j14, int i10) { long currentTimeMillis = System.currentTimeMillis(); if (j14 > currentTimeMillis) { j14 = currentTimeMillis; } int i14 = (i10 - ((int) (currentTimeMillis - j14))) - 100; if (i14 < 100) { return 100; } return i14; } private o a(boolean z14, int i10) throws Throwable { o oVar; o.e a14 = ar.a(z14, i10); int i14 = AnonymousClass6.f22648a[a14.ordinal()]; if (i14 == 1) { oVar = this.f22630c; } else if (i14 == 2) { oVar = this.f22631d; } else if (i14 == 3) { oVar = this.f22632e; } else { throw new IllegalStateException("unSupport operator:" + a14.f22609e); } if (oVar != null) { return oVar; } throw new IllegalStateException("unInit operator:" + a14.f22609e); } public static s a() { return a.f22649a; } public static boolean b(String str, String str2, String str3, String str4, String str5, String str6) { return (!TextUtils.isEmpty(str3) && !TextUtils.isEmpty(str4)) || (!TextUtils.isEmpty(str5) && !TextUtils.isEmpty(str6)); } public void a(long j14, int i10, final r rVar) throws Throwable { int a14 = a(j14, i10); try { a(true, -1).a(a14, new o.b() { /* class com.g.gysdk.a.s.AnonymousClass1 */ @Override // com.g.gysdk.a.o.b public void a(v vVar) { rVar.a(vVar.j()); } }); } catch (Throwable th3) { GyErrorCode gyErrorCode = GyErrorCode.UNSUPPORT_OPERATOR; if (!ar.c(d.f22558b)) { gyErrorCode = GyErrorCode.NO_SIM_CARD; } rVar.a(new com.g.gysdk.a(GyCode.PRELOGIN_ERROR, gyErrorCode, an.a(th3)).a("preLogin", "", null)); } } public void a(String str, long j14, int i10, final r rVar) throws Throwable { int a14 = a(j14, i10); try { a(true, -1).a(str, a14, new o.c() { /* class com.g.gysdk.a.s.AnonymousClass3 */ @Override // com.g.gysdk.a.o.c public void a(w wVar) { rVar.a(wVar.h()); } }); } catch (Throwable th3) { GyErrorCode gyErrorCode = GyErrorCode.UNSUPPORT_OPERATOR; if (!ar.c(d.f22558b)) { gyErrorCode = GyErrorCode.NO_SIM_CARD; } rVar.a(new com.g.gysdk.a(GyCode.PREVERIFY_ERROR, gyErrorCode, an.a(th3)).a("getAccessCode", "", null)); } } public void a(String str, String str2, String str3, int i10, long j14, int i14, final r rVar) throws Throwable { int a14 = a(j14, i14); try { a(false, i10).a(str, str2, str3, a14, new o.d() { /* class com.g.gysdk.a.s.AnonymousClass4 */ @Override // com.g.gysdk.a.o.d public void a(x xVar) { rVar.a(xVar.h()); } }); } catch (Throwable th3) { GyErrorCode gyErrorCode = GyErrorCode.UNSUPPORT_OPERATOR; if (!ar.c(d.f22558b)) { gyErrorCode = GyErrorCode.NO_SIM_CARD; } rVar.a(new com.g.gysdk.a(GyCode.VERIFY_ERROR, gyErrorCode, an.a(th3))); } } public void a(String str, String str2, String str3, String str4, String str5, String str6) { o oVar; o oVar2; o oVar3; String str7 = ""; String str8 = str == null ? str7 : str; String str9 = str2 == null ? str7 : str2; String str10 = str3 == null ? str7 : str3; String str11 = str4 == null ? str7 : str4; String str12 = str5 == null ? str7 : str5; if (str6 != null) { str7 = str6; } boolean z14 = this.f22630c != null && (!TextUtils.equals(this.f22633f, str8) || !TextUtils.equals(this.f22634g, str9)); boolean z15 = this.f22631d != null && (!TextUtils.equals(this.f22635h, str10) || !TextUtils.equals(this.f22636i, str11)); boolean z16 = this.f22632e != null && (!TextUtils.equals(this.f22637j, str12) || !TextUtils.equals(this.f22638k, str7)); if (z14 || z15 || z16) { this.f22633f = str8; this.f22634g = str9; this.f22635h = str10; this.f22636i = str11; this.f22637j = str12; this.f22638k = str7; JSONObject jSONObject = new JSONObject(); try { jSONObject.put("0", d.f22561e); jSONObject.put("a", this.f22633f); jSONObject.put("b", this.f22634g); jSONObject.put("c", this.f22635h); jSONObject.put("d", this.f22636i); jSONObject.put("e", this.f22637j); jSONObject.put(f.f156778k, this.f22638k); } catch (Throwable th3) { ak.e("saveKeySecret new json error", th3); } h.a().a(2, jSONObject.toString()); if (!b(this.f22633f, this.f22634g, this.f22635h, this.f22636i, this.f22637j, this.f22638k)) { ak.e("saveKeySecret, not hasKeySecret"); } else if (this.f22629b.compareAndSet(false, true)) { aj.a("初始化运营商SDK saveKeySecret 开始"); if (z14 && (oVar3 = this.f22630c) != null) { oVar3.a(this.f22633f, this.f22634g); } if (z15 && (oVar2 = this.f22631d) != null) { oVar2.a(this.f22635h, this.f22636i); } if (z16 && (oVar = this.f22632e) != null) { oVar.a(this.f22637j, this.f22638k); } aj.a("初始化运营商SDK saveKeySecret 结束"); ak.a("saveKeySecret, elogin inited"); } else { ak.c("saveKeySecret, elogin inited before, will use new in next start up"); } } else { ak.a("saveKeySecret, no change"); } } public void a(boolean z14) { o oVar = this.f22630c; if (oVar != null) { oVar.a(z14); } o oVar2 = this.f22631d; if (oVar2 != null) { oVar2.a(z14); } o oVar3 = this.f22632e; if (oVar3 != null) { oVar3.a(z14); } } public void b() { am.a(am.b.Work, new Runnable() { /* class com.g.gysdk.a.s.AnonymousClass5 */ public void run() { y.b a14 = y.a(); if (a14 != null) { s.this.a(a14.a(), a14.b(), a14.e(), a14.f(), a14.c(), a14.d()); } } }); } public void b(long j14, int i10, final r rVar) { int a14 = a(j14, i10); try { if (!d()) { rVar.a(new com.g.gysdk.a(GyCode.LOGIN_ERROR, GyErrorCode.INVALID_PRELOGIN, "预登录无效").a("eLogin", "", null)); return; } try { a(false, -1).a(a14, new o.a() { /* class com.g.gysdk.a.s.AnonymousClass2 */ @Override // com.g.gysdk.a.o.a public void a(u uVar) { rVar.a(uVar.i()); if (uVar.b()) { aa.a(uVar.f(), uVar.c(), uVar.d(), uVar.e().f22610f, uVar.h()); } } }); } catch (Throwable th3) { GyErrorCode gyErrorCode = GyErrorCode.UNSUPPORT_OPERATOR; if (!ar.c(d.f22558b)) { gyErrorCode = GyErrorCode.NO_SIM_CARD; } rVar.a(new com.g.gysdk.a(GyCode.LOGIN_ERROR, gyErrorCode, an.a(th3)).a("eLogin", "", null)); } } catch (Throwable th4) { ak.e(th4); rVar.a(new com.g.gysdk.a(GyCode.LOGIN_ERROR, GyErrorCode.UNKOWN_ERROR, an.a(th4)).a("eLogin", "", null)); } } public boolean b(boolean z14) { try { return a(z14, -1).a(); } catch (Throwable th3) { ak.a(th3); return false; } } public void c() { long currentTimeMillis = System.currentTimeMillis(); String a14 = h.a().a(2); aj.a("查询DB缓存的运营商APPID,cost:" + (System.currentTimeMillis() - currentTimeMillis)); try { if (!TextUtils.isEmpty(a14)) { JSONObject jSONObject = new JSONObject(a14); if (TextUtils.equals(jSONObject.getString("0"), d.f22561e)) { this.f22633f = jSONObject.optString("a"); this.f22634g = jSONObject.optString("b"); this.f22635h = jSONObject.optString("c"); this.f22636i = jSONObject.optString("d"); this.f22637j = jSONObject.optString("e"); this.f22638k = jSONObject.optString(f.f156778k); } else { throw new IllegalStateException("not to init elogin, appid changed"); } } if (TextUtils.isEmpty(this.f22635h)) { boolean z14 = f22628a; this.f22635h = z14 ? "300012143830" : "300011971923"; this.f22636i = z14 ? "DF03A772A3F0571A9B602AE7EB0043E8" : "701C041FEF31606E4EC7A762B172CEAD"; aj.a("设置移动运营商SDK APPID"); } if (TextUtils.isEmpty(this.f22637j)) { boolean z15 = f22628a; this.f22637j = z15 ? "99166000000000112737" : "99166000000000000342"; this.f22638k = z15 ? "9acb94bc70ffe5cda71ff3fc43361843" : "81d52e8f408eec32997b9cadcfb8a4b4"; aj.a("设置联通运营商SDK APPID"); } if (!b(this.f22633f, this.f22634g, this.f22635h, this.f22636i, this.f22637j, this.f22638k)) { ak.e("elogin init error, not hasKeySecret"); return; } aj.a("cmLogin init"); o oVar = this.f22630c; if (oVar != null) { oVar.a(this.f22633f, this.f22634g); } long currentTimeMillis2 = System.currentTimeMillis(); o oVar2 = this.f22631d; if (oVar2 != null) { oVar2.a(this.f22635h, this.f22636i); } long currentTimeMillis3 = System.currentTimeMillis(); aj.a("初始化 CM:" + (currentTimeMillis3 - currentTimeMillis2)); o oVar3 = this.f22632e; if (oVar3 != null) { oVar3.a(this.f22637j, this.f22638k); } aj.a("初始化 CU:" + (System.currentTimeMillis() - currentTimeMillis3)); this.f22629b.set(true); ak.a("elogin init success"); } catch (Throwable th3) { ak.e("elogin init error", th3); } } public boolean d() { return b(false); } public String e() { if (d.a(d.a.DEBUG_UI)) { return "proc***id"; } try { return a(false, -1).f22597g.f(); } catch (Throwable th3) { ak.a(th3); return ""; } } public String f() { if (d.a(d.a.DEBUG_UI)) { return "888***999"; } try { return a(false, -1).f22597g.h(); } catch (Throwable th3) { ak.a(th3); return ""; } } public String g() { if (d.a(d.a.DEBUG_UI)) { return "DEBUG_UI服务"; } int i10 = AnonymousClass6.f22648a[ar.a(false, -1).ordinal()]; return i10 != 1 ? i10 != 2 ? i10 != 3 ? "Unkown服务" : "认证服务由联通统一认证提供" : "中国移动提供认证服务" : "天翼账号提供认证服务"; } public String[] h() { String str; String str2; if (d.a(d.a.DEBUG_UI)) { str = "DEBUG_UI条款"; str2 = "https://www.getui.com/verification"; } else { int i10 = AnonymousClass6.f22648a[ar.a(false, -1).ordinal()]; if (i10 == 1) { str = "天翼账号服务与隐私协议"; str2 = "https://e.189.cn/sdk/agreement/detail.do?hidetop=true"; } else if (i10 == 2) { str = "中国移动认证服务条款"; str2 = "https://wap.cmpassport.com/resources/html/contract.html"; } else if (i10 != 3) { str = "Unkown条款"; str2 = "https://unkown"; } else { str = "联通统一认证服务条款"; str2 = "https://opencloud.wostore.cn/authz/resource/html/disclaimer.html?fromsdk=true"; } } return new String[]{str, str2}; } }