package jc; import android.text.TextUtils; import android.util.Pair; import com.google.android.gms.dynamite.ProviderConstants; import com.tencent.luggage.sdk.config.AppBrandInitConfigLU; import com.tencent.luggage.sdk.launching.h; import com.tencent.mm.plugin.appbrand.AppBrandRuntime; import com.tencent.mm.plugin.appbrand.appcache.AbsReader; import com.tencent.mm.plugin.appbrand.i; import com.tencent.mm.plugin.appbrand.i5; import com.tencent.mm.plugin.appbrand.jsapi.audio.d; import com.tencent.mm.plugin.appbrand.jsapi.g; import com.tencent.mm.plugin.appbrand.jsapi.h; import com.tencent.mm.plugin.appbrand.jsapi.m7; import com.tencent.mm.plugin.appbrand.jsapi.q; import com.tencent.mm.plugin.appbrand.jsapi.t; import com.tencent.mm.plugin.appbrand.jsapi.v2; import com.tencent.mm.plugin.appbrand.jsruntime.j; import com.tencent.mm.plugin.appbrand.jsruntime.x; import com.tencent.mm.plugin.appbrand.menu.a0; import com.tencent.mm.plugin.appbrand.networking.lib_server_mode.WxAppLibServerMode; import com.tencent.mm.plugin.appbrand.page.f0; import com.tencent.mm.plugin.appbrand.page.f1; import com.tencent.mm.plugin.appbrand.page.g0; import com.tencent.mm.plugin.appbrand.page.o0; import com.tencent.mm.plugin.appbrand.report.quality.s; import com.tencent.mm.plugin.appbrand.t2; import com.tencent.mm.plugin.appbrand.u2; import com.tencent.mm.plugin.appbrand.utils.o2; import com.tencent.mm.plugin.appbrand.w2; import com.tencent.mm.plugin.mmsight.segment.FFmpegMetadataRetriever; import com.tencent.mm.sdk.platformtools.BuildInfo; import com.tencent.mm.sdk.platformtools.ChannelUtil; import com.tencent.mm.sdk.platformtools.LocaleUtil; import com.tencent.mm.sdk.platformtools.Log; import com.tencent.mm.sdk.platformtools.Util; import com.tencent.thumbplayer.tplayer.plugins.report.TPReportKeys; import ec.a; import ec.c; import ec.f; import gx0.k; import java.util.HashMap; import java.util.LinkedList; import java.util.Locale; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import junit.framework.Assert; import ku0.e; import lh4.m; import org.json.JSONException; import org.json.JSONObject; import pc.g; public class f extends t2 implements e, ec.f { public static final String[] L = {g0.NAME, f0.NAME, "onSkylineGlobalReady", "onSkylineWindowReady", "requireRenderContext", a0.c.NAME, "onAppRoute", "onAppRouteDone"}; public final i<? extends f> H; public s I; public y J; public final LinkedList<Runnable> K; public class a extends g0 { public a() { } @Override // com.tencent.mm.plugin.appbrand.page.g0 public void s(AppBrandRuntime appBrandRuntime, boolean z15, JSONObject jSONObject) { com.tencent.mm.plugin.appbrand.report.model.e.b(f.this.getRuntime(), jSONObject, z15); } } public class b extends f0 { public b() { } @Override // com.tencent.mm.plugin.appbrand.jsapi.v2, com.tencent.mm.plugin.appbrand.jsapi.t public /* bridge */ /* synthetic */ v2 o(Map map) { r(map); return this; } @Override // com.tencent.mm.plugin.appbrand.jsapi.t public t r(Map<String, Object> map) { JSONObject jSONObject = new JSONObject(map); g N0 = f.this.getRuntime(); try { Pair<Integer, String> f15 = com.tencent.mm.plugin.appbrand.report.model.e.f((c) N0.g0().getCurrentPage().getCurrentPageView()); jSONObject.put("targetAction", ((Integer) f15.first).intValue()); jSONObject.put("targetPagePath", (String) f15.second); jSONObject.put("usedState", N0.B1().f93946h); jSONObject.put("isEntrance", N0.g0().getReporter().m().j(N0.g0().getCurrentUrl())); } catch (Exception e15) { Log.e("MicroMsg.AppBrandPageVisitStatisticsHelper", "fillEventOnAppEnterBackground ex = %s", e15); } this.f90433f = jSONObject.toString(); return this; } } public f() { this(new d$$m()); } @Override // com.tencent.mm.plugin.appbrand.t2 public boolean A0() { i<? extends f> iVar = this.H; return iVar != null && iVar.q0(); } @Override // com.tencent.mm.plugin.appbrand.t2 public boolean C0() { return !(this.H instanceof w); } @Override // com.tencent.mm.plugin.appbrand.t2 public void D0() { if (this.f94840x) { i5.b(this, getJsRuntime()); } this.H.v0(); } @Override // com.tencent.mm.plugin.appbrand.t2 public final void E0() { new b().s(getRuntime()); this.H.y0(); } @Override // com.tencent.mm.plugin.appbrand.t2 public void F0(AppBrandRuntime appBrandRuntime) { super.F0(appBrandRuntime); this.f88693i = J0(); this.H.D0(appBrandRuntime); } /* JADX WARNING: Removed duplicated region for block: B:18:0x0059 */ /* JADX WARNING: Removed duplicated region for block: B:21:0x0075 A[SYNTHETIC] */ @Override // com.tencent.mm.plugin.appbrand.jsapi.h, com.tencent.mm.plugin.appbrand.t2 public final void G() { wo0.a aVar; w2 w2Var; int indexOfKey; for (q qVar : ((ConcurrentHashMap) this.f88691g).values()) { if (qVar instanceof fq0.b) { ((fq0.b) qVar).f216336g.f334485a.clear(); } } d dVar = d.INSTANCE; String appId = getAppId(); dVar.getClass(); if (!TextUtils.isEmpty(appId)) { int hashCode = appId.hashCode(); synchronized (dVar.f87397d) { int indexOfKey2 = dVar.f87397d.indexOfKey(hashCode); if (indexOfKey2 >= 0) { aVar = dVar.f87397d.valueAt(indexOfKey2); dVar.f87397d.removeAt(indexOfKey2); } } if (aVar != null) { aVar.f334485a.clear(); } this.H.d0(); super.G(); this.H.A0(); w2Var = w2.b.f96749a; w2Var.getClass(); int hashCode2 = hashCode(); synchronized (w2Var) { indexOfKey = w2Var.f96747a.indexOfKey(hashCode2); if (indexOfKey >= 0) { w2Var.f96747a.removeAt(indexOfKey); } } Object[] objArr = new Object[2]; boolean z15 = false; objArr[0] = Integer.valueOf(hashCode2); if (indexOfKey < 0) { z15 = true; } objArr[1] = Boolean.valueOf(z15); Log.i("MicroMsg.AppBrandServiceOnRuntimeReadyListenerMgr", "removeAllListeners, service:%d, already removed:%b", objArr); I0(null); this.f88697p.c(wu0.a.class); return; } aVar = null; if (aVar != null) { } this.H.d0(); super.G(); this.H.A0(); w2Var = w2.b.f96749a; w2Var.getClass(); int hashCode22 = hashCode(); synchronized (w2Var) { } } @Override // com.tencent.mm.plugin.appbrand.t2 public final void G0(boolean z15) { super.G0(z15); this.H.z0(); } @Override // com.tencent.mm.plugin.appbrand.jsapi.h, com.tencent.mm.plugin.appbrand.t2 public final Map<String, q> I() { return this.H.q(); } public g.c J0() { return new i(getRuntime(), this, getRuntime().f282052n1); } @Override // com.tencent.mm.plugin.appbrand.jsapi.h, com.tencent.mm.plugin.appbrand.t2 public j K() { j e05 = this.H.e0(); if (e05 == null) { return super.K(); } return e05; } /* renamed from: K0 */ public dz0.a n0() { return new dz0.a(this); } /* renamed from: L0 */ public c q0() { return (c) r0(c.class); } public final <T> T M0(Class<T> cls) { if (cls.isInstance(this)) { return cls.cast(this); } if (cls.isInstance(this.H)) { return cls.cast(this.H); } return cls.cast(this.H.u(cls)); } /* renamed from: N0 */ public pc.g getRuntime() { return (pc.g) this.A; } public void O0() { this.H.x0(); } public void P0(JSONObject jSONObject) { this.H.C0(jSONObject); JSONObject optJSONObject = jSONObject.optJSONObject("appLaunchInfo"); if (optJSONObject == null) { optJSONObject = new JSONObject(); g0(jSONObject, "appLaunchInfo", optJSONObject); } if (h.HEADLESS == getRuntime().d0().f55425d1) { g0(optJSONObject, "inBackground", Boolean.TRUE); } g0(optJSONObject, "openId", getRuntime().k0().f55457y0); if (getRuntime().d0().f55426e1 != null && getRuntime().d0().f55426e1.f92652d) { WxAppLibServerMode wxAppLibServerMode = getRuntime().d0().f55426e1; wxAppLibServerMode.getClass(); JSONObject jSONObject2 = new JSONObject(); jSONObject2.put(TPReportKeys.LiveExKeys.LIVE_EX_DEFINATION_SWICH, wxAppLibServerMode.f92652d); jSONObject2.put(TPReportKeys.PlayerStep.PLAYER_REASON, wxAppLibServerMode.f92653e.f92657d); g0(jSONObject, "serverMode", jSONObject2); } if (x(dq0.b.NAME) != null) { JSONObject optJSONObject2 = jSONObject.optJSONObject("nativeFeatures"); if (optJSONObject2 == null) { optJSONObject2 = new JSONObject(); g0(jSONObject, "nativeFeatures", optJSONObject2); } g0(optJSONObject2, "batchLoadSubPackage", Boolean.TRUE); } } public final void Q0(s sVar) { this.I = sVar; O(); z0(); d0(c0()); this.f94840x = true; O0(); if (getJsRuntime().q0(com.tencent.mm.plugin.appbrand.jsruntime.s.class) != null) { ((com.tencent.mm.plugin.appbrand.jsruntime.s) getJsRuntime().q0(com.tencent.mm.plugin.appbrand.jsruntime.s.class)).G("https://servicewechat.com/preload/js-engine"); } } public void R0(f.a aVar, boolean z15, long j15, long j16, Object obj) { } public void S0(boolean z15) { i<? extends f> iVar = this.H; if (iVar instanceof d) { ((d) iVar).V0(z15); g.a M = M(); if (M == null || (M instanceof h.d)) { Z(new x((d) this.H)); } else { Assert.assertTrue(M instanceof x); } } } @Override // com.tencent.mm.plugin.appbrand.jsapi.h public final void X() { this.H.B0(); while (!this.K.isEmpty()) { this.K.poll().run(); } } @Override // com.tencent.mm.plugin.appbrand.jsapi.g, com.tencent.mm.plugin.appbrand.jsapi.h public void a(int i15, String str) { if (!this.H.G0(i15, str)) { F(i15, str, null); } } @Override // com.tencent.mm.plugin.appbrand.t2, com.tencent.mm.plugin.appbrand.jsapi.m public void a0(JSONObject jSONObject) { super.a0(jSONObject); this.H.c0(jSONObject); g0(jSONObject, "isIsolateContext", Boolean.valueOf(this.H.r0())); g0(jSONObject, ProviderConstants.API_COLNAME_FEATURE_VERSION, ChannelUtil.formatVersion(null, BuildInfo.CLIENT_VERSION_INT)); g0(jSONObject, FFmpegMetadataRetriever.METADATA_KEY_LANGUAGE, LocaleUtil.getCurrentLanguage(getContext())); if (l() instanceof AbsReader) { fc.a i05 = ((AbsReader) l()).i0(); i05.getClass(); if (!i05.f213971a.isEmpty()) { try { HashMap<String, Object> hashMap = i05.f213971a; m.e(hashMap, "null cannot be cast to non-null type kotlin.collections.Map<kotlin.Any?, kotlin.Any?>"); jSONObject.put("expt", new JSONObject(hashMap)); } catch (JSONException e15) { Log.e("Luggage.ExptMapping", "applyToWxConfig get exception:" + e15, e15); } } } g0(jSONObject, "supportInvokeWithAppId", Boolean.TRUE); } @Override // com.tencent.mm.plugin.appbrand.t2, com.tencent.mm.plugin.appbrand.jsapi.m public void b0(JSONObject jSONObject) { new z().a(jSONObject); } @Override // com.tencent.mm.plugin.appbrand.t2, com.tencent.mm.plugin.appbrand.jsapi.m public JSONObject c0() { JSONObject c05 = super.c0(); g0(c05, "envPreloadType", Integer.valueOf(this.I.ordinal())); return c05; } @Override // com.tencent.mm.plugin.appbrand.jsapi.g, com.tencent.mm.plugin.appbrand.jsapi.h, com.tencent.mm.plugin.appbrand.t2 public final void e(String str, String str2, int i15) { f1 f1Var; o0 g05; boolean b15 = am4.a.b(L, str); AppBrandInitConfigLU appBrandInitConfigLU = null; if (!(i15 == 0 || hashCode() == i15)) { try { pc.g N0 = getRuntime(); if (N0 == null || (g05 = N0.g0()) == null) { f1Var = null; } else { f1Var = g05.q(i15, false); } if (f1Var != null && f1Var.F1()) { int F0 = f1Var.F0(); if (i15 != F0 && b15) { Log.i("MicroMsg.AppBrand.AppBrandServiceLU", "dispatch %s, serviceId:%d, replace src(%d) with pageId(%d)", str, Integer.valueOf(hashCode()), Integer.valueOf(i15), Integer.valueOf(F0)); } i15 = F0; } } catch (Exception e15) { Log.e("MicroMsg.AppBrand.AppBrandServiceLU", "dispatch %s, serviceId:%d, try replace src with pageId, get exception:%s", str, Integer.valueOf(hashCode()), e15); } } if (b15) { if (getRuntime() != null) { appBrandInitConfigLU = getRuntime().d0(); } if (appBrandInitConfigLU != null) { Log.i("MicroMsg.AppBrand.AppBrandServiceLU", "dispatch %s, serviceId:%d, src:%d, appId:%s, instanceId:%s, sessionId:%s, data:%s", str, Integer.valueOf(hashCode()), Integer.valueOf(i15), getAppId(), appBrandInitConfigLU.f55433r, appBrandInitConfigLU.f55432q, str2); } else { Log.i("MicroMsg.AppBrand.AppBrandServiceLU", "dispatch %s, serviceId:%d, src:%d, data:%s", str, Integer.valueOf(hashCode()), Integer.valueOf(i15), str2); } } if (!this.H.H0(str, str2, i15)) { super.e(str, str2, i15); } } @Override // ku0.e public boolean g(String str) { return this.H.g(str); } @Override // com.tencent.mm.plugin.appbrand.t2 public g0 m0() { return new a(); } @Override // com.tencent.mm.plugin.appbrand.t2 public JSONObject p0() { boolean z15; JSONObject p05 = super.p0(); g0(p05, "appType", Integer.valueOf(getRuntime().d0().f55436u)); g0(p05, "debug", Boolean.valueOf(getRuntime().k0().f55453w)); P0(p05); int[] a15 = o2.a(this); g0(p05, "screenWidth", Integer.valueOf(k.e(a15[0]))); g0(p05, "screenHeight", Integer.valueOf(k.e(a15[1]))); g0(p05, "supportAsyncGetSystemInfo", Boolean.TRUE); if (getRuntime().d0().f55425d1 == com.tencent.luggage.sdk.launching.h.PRE_RENDER) { z15 = true; } else { z15 = false; } g0(p05, "prerender", Boolean.valueOf(z15)); g0(p05, "instanceId", getRuntime().d0().f55433r); String str = getRuntime().k0().A.f55461f; if (!TextUtils.isEmpty(str)) { try { g0(p05, "opConfig", new JSONObject(str)); } catch (Exception e15) { Log.e("MicroMsg.AppBrand.AppBrandServiceLU", "generateWxConfig() put wxConfig.opConfig, exception=%s", e15); } } p05.remove("permission"); p05.remove("navigateToMiniProgramAppIdList"); Log.i("MicroMsg.AppBrand.AppBrandServiceLU", "generateWxConfig(%s): %s", getAppId(), p05.toString()); return p05; } @Override // com.tencent.mm.plugin.appbrand.t2 public String s0() { return "https://lib/"; } @Override // com.tencent.mm.plugin.appbrand.t2 public String u0(String str) { String i05 = this.H.i0(str); if (Util.isNullOrNil(i05)) { return ""; } return i05; } @Override // com.tencent.mm.plugin.appbrand.t2 public String v0() { return "https://usr/"; } @Override // com.tencent.mm.plugin.appbrand.t2 public final void y0() { super.y0(); this.H.m0(); Log.i("MicroMsg.AppBrandService", "notifyWxConfigReadyIfNeed, hash=%d", Integer.valueOf(hashCode())); String format = String.format(Locale.US, ";(function(){ if(__wxConfig.preload) { %s; return true; } else { return false; }})();", m7.c("onWxConfigReady", "", 0)); if (getJsRuntime().q0(x.class) != null) { ((x) getJsRuntime().q0(x.class)).T(null, null, null, 0, format, new u2(this)); return; } getJsRuntime().evaluateJavascript(format, new com.tencent.mm.plugin.appbrand.v2(this, Util.nowMilliSecond())); } public f(ec.b bVar) { this.I = s.CreateOnRuntimeInit; this.K = new LinkedList<>(); String name = bVar.getClass().getName(); Class<? extends ComponentLogicImp> cls = g.b().f206679a.get(bVar.getClass().getName()); Object obj = null; if (cls != null) { try { obj = (a.AbstractC2333a) new hm4.a(cls, cls).d(this).f227099b; } catch (Exception e15) { Log.printErrStackTrace("Luggage.AppBrandLogicFactory", e15, "hy: construct failed!", new Object[0]); } } else { Log.w("Luggage.AppBrandLogicFactory", "hy: implement corresponding to type %s not found!", bVar); } i<? extends f> iVar = (i) obj; this.H = iVar; if (iVar != null) { iVar.getClass(); return; } throw new IllegalArgumentException("No logic corresponding implement found with type: " + name); } public f(Class<? extends i<? extends f>> cls) { this.I = s.CreateOnRuntimeInit; this.K = new LinkedList<>(); i<? extends f> iVar = (i) new hm4.a(cls, cls).d(this).f227099b; this.H = iVar; iVar.getClass(); } }