package com.tencent.bugly.crashreport.common.strategy; import android.content.Context; import com.google.android.exoplayer2.metadata.icy.IcyHeaders; import com.tencent.bugly.a; import com.tencent.bugly.crashreport.biz.f; import com.tencent.bugly.proguard.J; import com.tencent.bugly.proguard.L; import com.tencent.bugly.proguard.W; import com.tencent.bugly.proguard.X; import com.tencent.bugly.proguard.ca; import com.tencent.bugly.proguard.ra; import com.tencent.bugly.proguard.sa; import java.util.List; import java.util.Map; /* compiled from: BUGLY */ public class c { public static int a = 1000; private static c b; private static String c; private final List<a> d; private final W e; private final StrategyBean f; private StrategyBean g = null; private Context h; protected c(Context context, List<a> list) { this.h = context; a(context); this.f = new StrategyBean(); this.d = list; this.e = W.c(); } public StrategyBean c() { StrategyBean strategyBean = this.g; if (strategyBean != null) { if (!ca.c(strategyBean.q)) { this.g.q = StrategyBean.a; } if (!ca.c(this.g.r)) { this.g.r = StrategyBean.b; } return this.g; } if (!ca.b(c) && ca.c(c)) { StrategyBean strategyBean2 = this.f; String str = c; strategyBean2.q = str; strategyBean2.r = str; } return this.f; } public synchronized boolean d() { return this.g != null; } public StrategyBean e() { byte[] bArr; List<L> a2 = J.a().a(2); if (a2 == null || a2.size() <= 0 || (bArr = a2.get(0).g) == null) { return null; } return (StrategyBean) ca.a(bArr, StrategyBean.CREATOR); } public static synchronized c b() { c cVar; synchronized (c.class) { cVar = b; } return cVar; } public static synchronized c a(Context context, List<a> list) { c cVar; synchronized (c.class) { if (b == null) { b = new c(context, list); } cVar = b; } return cVar; } public void a(long j) { this.e.a(new b(this), j); } /* access modifiers changed from: protected */ public void a(StrategyBean strategyBean, boolean z) { X.a("[Strategy] Notify %s", f.class.getName()); f.a(strategyBean, z); for (a aVar : this.d) { try { X.a("[Strategy] Notify %s", aVar.getClass().getName()); aVar.onServerStrategyChanged(strategyBean); } catch (Throwable th) { if (!X.b(th)) { th.printStackTrace(); } } } } public static void a(String str) { if (ca.b(str) || !ca.c(str)) { X.e("URL user set is invalid.", new Object[0]); } else { c = str; } } public void a(sa saVar) { if (saVar != null) { StrategyBean strategyBean = this.g; if (strategyBean == null || saVar.k != strategyBean.o) { StrategyBean strategyBean2 = new StrategyBean(); strategyBean2.f = saVar.d; strategyBean2.h = saVar.f; strategyBean2.g = saVar.e; if (ca.b(c) || !ca.c(c)) { if (ca.c(saVar.g)) { X.a("[Strategy] Upload url changes to %s", saVar.g); strategyBean2.q = saVar.g; } if (ca.c(saVar.h)) { X.a("[Strategy] Exception upload url changes to %s", saVar.h); strategyBean2.r = saVar.h; } } ra raVar = saVar.i; if (raVar != null && !ca.b(raVar.a)) { strategyBean2.s = saVar.i.a; } long j = saVar.k; if (j != 0) { strategyBean2.o = j; } Map<String, String> map = saVar.j; if (map != null && map.size() > 0) { Map<String, String> map2 = saVar.j; strategyBean2.t = map2; String str = map2.get("B11"); if (str == null || !str.equals(IcyHeaders.REQUEST_HEADER_ENABLE_METADATA_VALUE)) { strategyBean2.i = false; } else { strategyBean2.i = true; } String str2 = saVar.j.get("B3"); if (str2 != null) { strategyBean2.w = Long.valueOf(str2).longValue(); } long j2 = (long) saVar.o; strategyBean2.p = j2; strategyBean2.v = j2; String str3 = saVar.j.get("B27"); if (str3 != null && str3.length() > 0) { try { int parseInt = Integer.parseInt(str3); if (parseInt > 0) { strategyBean2.u = parseInt; } } catch (Exception e2) { if (!X.b(e2)) { e2.printStackTrace(); } } } String str4 = saVar.j.get("B25"); if (str4 == null || !str4.equals(IcyHeaders.REQUEST_HEADER_ENABLE_METADATA_VALUE)) { strategyBean2.k = false; } else { strategyBean2.k = true; } } X.c("[Strategy] enableCrashReport:%b, enableQuery:%b, enableUserInfo:%b, enableAnr:%b, enableBlock:%b, enableSession:%b, enableSessionTimer:%b, sessionOverTime:%d, enableCocos:%b, strategyLastUpdateTime:%d", Boolean.valueOf(strategyBean2.f), Boolean.valueOf(strategyBean2.h), Boolean.valueOf(strategyBean2.g), Boolean.valueOf(strategyBean2.i), Boolean.valueOf(strategyBean2.j), Boolean.valueOf(strategyBean2.m), Boolean.valueOf(strategyBean2.n), Long.valueOf(strategyBean2.p), Boolean.valueOf(strategyBean2.k), Long.valueOf(strategyBean2.o)); this.g = strategyBean2; if (!ca.c(saVar.g)) { X.a("[Strategy] download url is null", new Object[0]); this.g.q = ""; } if (!ca.c(saVar.h)) { X.a("[Strategy] download crashurl is null", new Object[0]); this.g.r = ""; } J.a().b(2); L l = new L(); l.b = 2; l.a = strategyBean2.d; l.e = strategyBean2.e; l.g = ca.a(strategyBean2); J.a().c(l); a(strategyBean2, true); } } } private static void a(Context context) { if (com.tencent.bugly.crashreport.common.info.a.a(context) != null) { String str = com.tencent.bugly.crashreport.common.info.a.a(context).fa; if ("oversea".equals(str)) { StrategyBean.a = "https://astat.bugly.qcloud.com/rqd/async"; StrategyBean.b = "https://astat.bugly.qcloud.com/rqd/async"; } else if ("na_https".equals(str)) { StrategyBean.a = "https://astat.bugly.cros.wr.pvp.net/:8180/rqd/async"; StrategyBean.b = "https://astat.bugly.cros.wr.pvp.net/:8180/rqd/async"; } } } }