package com.tencent.bugly.crashreport.common.strategy; import android.content.Context; import com.tencent.bugly.crashreport.biz.b; import com.tencent.bugly.proguard.ab; import com.tencent.bugly.proguard.ap; import com.tencent.bugly.proguard.aq; import com.tencent.bugly.proguard.n; import com.tencent.bugly.proguard.o; import com.tencent.bugly.proguard.q; import com.tencent.bugly.proguard.x; import com.tencent.bugly.proguard.y; import java.util.List; import java.util.Map; /* compiled from: BUGLY */ public final class a { /* renamed from: a reason: collision with root package name */ public static int f40869a = 1000; /* renamed from: b reason: collision with root package name */ private static a f40870b; /* renamed from: h reason: collision with root package name */ private static String f40871h; /* renamed from: c reason: collision with root package name */ private final List<com.tencent.bugly.a> f40872c; /* renamed from: d reason: collision with root package name */ private final x f40873d; /* renamed from: e reason: collision with root package name */ private final StrategyBean f40874e; /* renamed from: f reason: collision with root package name */ private StrategyBean f40875f = null; /* renamed from: g reason: collision with root package name */ private Context f40876g; private a(Context context, List<com.tencent.bugly.a> list) { String str; this.f40876g = context; if (com.tencent.bugly.crashreport.common.info.a.a(context) != null) { String str2 = com.tencent.bugly.crashreport.common.info.a.a(context).f40841x; if ("oversea".equals(str2)) { str = "https://astat.bugly.qcloud.com/rqd/async"; } else { str = "na_https".equals(str2) ? "https://astat.bugly.cros.wr.pvp.net/:8180/rqd/async" : str; } StrategyBean.f40847a = str; StrategyBean.f40848b = str; } this.f40874e = new StrategyBean(); this.f40872c = list; this.f40873d = x.a(); } public static StrategyBean d() { byte[] bArr; List<q> a10 = o.a().a(2); if (a10 == null || a10.size() <= 0 || (bArr = a10.get(0).f41300g) == null) { return null; } return (StrategyBean) ab.a(bArr, StrategyBean.CREATOR); } public final StrategyBean c() { StrategyBean strategyBean = this.f40875f; if (strategyBean != null) { if (!ab.c(strategyBean.f40862p)) { this.f40875f.f40862p = StrategyBean.f40847a; } if (!ab.c(this.f40875f.f40863q)) { this.f40875f.f40863q = StrategyBean.f40848b; } return this.f40875f; } if (!ab.a(f40871h) && ab.c(f40871h)) { StrategyBean strategyBean2 = this.f40874e; String str = f40871h; strategyBean2.f40862p = str; strategyBean2.f40863q = str; } return this.f40874e; } public final synchronized boolean b() { return this.f40875f != null; } public static synchronized a a(Context context, List<com.tencent.bugly.a> list) { a aVar; synchronized (a.class) { if (f40870b == null) { f40870b = new a(context, list); } aVar = f40870b; } return aVar; } public final void a(long j10) { this.f40873d.a(new Thread() { /* class com.tencent.bugly.crashreport.common.strategy.a.AnonymousClass1 */ public final void run() { try { Map<String, byte[]> a10 = o.a().a(a.f40869a, (n) null, true); if (a10 != null) { byte[] bArr = a10.get("device"); byte[] bArr2 = a10.get("gateway"); if (bArr != null) { com.tencent.bugly.crashreport.common.info.a.a(a.this.f40876g).f(new String(bArr)); } if (bArr2 != null) { com.tencent.bugly.crashreport.common.info.a.a(a.this.f40876g).e(new String(bArr2)); } } a.this.f40875f = a.d(); if (a.this.f40875f != null) { if (ab.a(a.f40871h) || !ab.c(a.f40871h)) { a.this.f40875f.f40862p = StrategyBean.f40847a; a.this.f40875f.f40863q = StrategyBean.f40848b; } else { a.this.f40875f.f40862p = a.f40871h; a.this.f40875f.f40863q = a.f40871h; } } } catch (Throwable th2) { if (!y.a(th2)) { th2.printStackTrace(); } } a aVar = a.this; aVar.a(aVar.f40875f, false); } }, j10); } public static synchronized a a() { a aVar; synchronized (a.class) { aVar = f40870b; } return aVar; } public final void a(StrategyBean strategyBean, boolean z10) { y.c("[Strategy] Notify %s", b.class.getName()); b.a(strategyBean, z10); for (com.tencent.bugly.a aVar : this.f40872c) { try { y.c("[Strategy] Notify %s", aVar.getClass().getName()); aVar.onServerStrategyChanged(strategyBean); } catch (Throwable th2) { if (!y.a(th2)) { th2.printStackTrace(); } } } } public static void a(String str) { if (ab.a(str) || !ab.c(str)) { y.d("URL user set is invalid.", new Object[0]); } else { f40871h = str; } } public final void a(aq aqVar) { if (aqVar != null) { StrategyBean strategyBean = this.f40875f; if (strategyBean == null || aqVar.f41204h != strategyBean.f40860n) { StrategyBean strategyBean2 = new StrategyBean(); strategyBean2.f40851e = aqVar.f41197a; strategyBean2.f40853g = aqVar.f41199c; strategyBean2.f40852f = aqVar.f41198b; if (ab.a(f40871h) || !ab.c(f40871h)) { if (ab.c(aqVar.f41200d)) { y.c("[Strategy] Upload url changes to %s", aqVar.f41200d); strategyBean2.f40862p = aqVar.f41200d; } if (ab.c(aqVar.f41201e)) { y.c("[Strategy] Exception upload url changes to %s", aqVar.f41201e); strategyBean2.f40863q = aqVar.f41201e; } } ap apVar = aqVar.f41202f; if (apVar != null && !ab.a(apVar.f41192a)) { strategyBean2.f40864r = aqVar.f41202f.f41192a; } long j10 = aqVar.f41204h; if (j10 != 0) { strategyBean2.f40860n = j10; } Map<String, String> map = aqVar.f41203g; if (map != null && map.size() > 0) { Map<String, String> map2 = aqVar.f41203g; strategyBean2.f40865s = map2; String str = map2.get("B11"); strategyBean2.f40854h = str != null && str.equals("1"); String str2 = aqVar.f41203g.get("B3"); if (str2 != null) { strategyBean2.f40868v = Long.parseLong(str2); } int i10 = aqVar.f41205i; strategyBean2.f40861o = (long) i10; strategyBean2.f40867u = (long) i10; String str3 = aqVar.f41203g.get("B27"); if (str3 != null && str3.length() > 0) { try { int parseInt = Integer.parseInt(str3); if (parseInt > 0) { strategyBean2.f40866t = parseInt; } } catch (Exception e10) { if (!y.a(e10)) { e10.printStackTrace(); } } } String str4 = aqVar.f41203g.get("B25"); strategyBean2.f40856j = str4 != null && str4.equals("1"); } y.a("[Strategy] enableCrashReport:%b, enableQuery:%b, enableUserInfo:%b, enableAnr:%b, enableBlock:%b, enableSession:%b, enableSessionTimer:%b, sessionOverTime:%d, enableCocos:%b, strategyLastUpdateTime:%d", Boolean.valueOf(strategyBean2.f40851e), Boolean.valueOf(strategyBean2.f40853g), Boolean.valueOf(strategyBean2.f40852f), Boolean.valueOf(strategyBean2.f40854h), Boolean.valueOf(strategyBean2.f40855i), Boolean.valueOf(strategyBean2.f40858l), Boolean.valueOf(strategyBean2.f40859m), Long.valueOf(strategyBean2.f40861o), Boolean.valueOf(strategyBean2.f40856j), Long.valueOf(strategyBean2.f40860n)); this.f40875f = strategyBean2; if (!ab.c(aqVar.f41200d)) { y.c("[Strategy] download url is null", new Object[0]); this.f40875f.f40862p = ""; } if (!ab.c(aqVar.f41201e)) { y.c("[Strategy] download crashurl is null", new Object[0]); this.f40875f.f40863q = ""; } o.a().b(2); q qVar = new q(); qVar.f41295b = 2; qVar.f41294a = strategyBean2.f40849c; qVar.f41298e = strategyBean2.f40850d; qVar.f41300g = ab.a(strategyBean2); o.a().a(qVar); a(strategyBean2, true); } } } }