package com.tencent.mm.plugin.appbrand.service; import android.text.TextUtils; import com.tencent.mm.appbrand.v8.j; import com.tencent.mm.autogen.mmdata.rpt.WeAppQualityLibInjectStruct; import com.tencent.mm.plugin.appbrand.AppBrandRuntimeWC; import com.tencent.mm.plugin.appbrand.appcache.c2; import com.tencent.mm.plugin.appbrand.config.AppBrandSysConfigWC; import com.tencent.mm.plugin.appbrand.jsruntime.h; import com.tencent.mm.plugin.appbrand.jsruntime.v; import com.tencent.mm.plugin.appbrand.jsruntime.x; import com.tencent.mm.plugin.appbrand.keylogger.n; import com.tencent.mm.plugin.appbrand.report.quality.QualitySessionRuntime; import com.tencent.mm.plugin.appbrand.report.quality.b; import com.tencent.mm.plugin.appbrand.report.t; import com.tencent.mm.plugin.appbrand.step.KSProcessWeAppLaunch; import com.tencent.mm.plugin.appbrand.v8_snapshot.WxaPkgV8SnapshotInfo; import com.tencent.mm.plugin.appbrand.v8_snapshot.c0; import com.tencent.mm.plugin.appbrand.v8_snapshot.f0; import com.tencent.mm.plugin.appbrand.v8_snapshot.u0; import com.tencent.mm.plugin.report.service.q; import com.tencent.mm.sdk.platformtools.BuildInfo; import com.tencent.mm.sdk.platformtools.Util; import com.tencent.stubs.logger.Log; import ec.f; import gx0.e; import ie1.h; import java.net.URL; import java.util.List; import java.util.Objects; import java.util.UUID; import jc.u; import lh4.m; import nh.r0; public class a extends u<h> { /* renamed from: h reason: collision with root package name */ public b f94602h; public a(h hVar, v vVar) { super(hVar, vVar); this.f94602h = (b) hVar.H; } @Override // jc.b public void A(String str) { q.INSTANCE.idkeyStat(370, 39, 1, false); t.i(((h) this.f238726d).getAppId(), ((h) this.f238726d).getRuntime().k0().f227330r.pkgVersion, ((h) this.f238726d).getRuntime().k0().f227330r.f83818d, 370, 39, 1); } @Override // jc.b public h b(String str, int i15) { if (this.f94602h.H == null) { return null; } return super.b(str, i15); } @Override // jc.b public void c(String str, boolean z15, f.a[] aVarArr, boolean[] zArr, Object[] objArr, long j15, long j16) { String str2; j.g gVar; long j17; int i15; j.g gVar2; long j18; if (!TextUtils.isEmpty(str) || !BuildInfo.DEBUG) { str2 = str; } else { str2 = UUID.randomUUID().toString(); } if (!(TextUtils.isEmpty(str2) || aVarArr.length == 0 || zArr.length == 0)) { AppBrandRuntimeWC U0 = ((h) this.f238726d).getRuntime(); if (aVarArr.length == 1) { Object obj = objArr[0]; if (obj instanceof j.g) { gVar2 = (j.g) obj; } else { gVar2 = null; } if (gVar2 != null) { j18 = (long) gVar2.sourceLength; } else { f.a aVar = aVarArr[0]; if (aVar != null) { j18 = aVar.f206712k; } else { return; } } gVar = gVar2; j17 = j18; } else { int i16 = 0; int i17 = 0; long j19 = 0; long j25 = 0; long j26 = 0; for (int i18 = 0; i18 < aVarArr.length; i18++) { Object obj2 = objArr[i18]; if (obj2 instanceof j.g) { j.g gVar3 = (j.g) obj2; j26 += (long) gVar3.sourceLength; j25 += gVar3.flatJSCompileCost; j19 += gVar3.flatJSRunCost; i16 = gVar3.codeCacheStatus; i17 = gVar3.f61708c; } else { f.a aVar2 = aVarArr[i18]; if (aVar2 != null) { j26 += aVar2.f206712k; } } } if (j19 > 0) { j.g gVar4 = new j.g(); gVar4.f61706a = j15; gVar4.f61707b = j16; gVar4.codeCacheStatus = i16; gVar4.f61708c = i17; gVar4.flatJSCompileCost = j25; gVar4.flatJSRunCost = j19; gVar4.sourceLength = (int) j26; gVar = gVar4; j17 = j26; } else { j17 = j26; gVar = null; } } SERVICE service = this.f238726d; Objects.requireNonNull(str2); if (U0 != null) { i15 = U0.hashCode(); } else { i15 = -1; } b.f(service, str2, j17, "", 0, j15, i15, gVar, z15); } } @Override // jc.b public void d(jc.f fVar, h hVar) { h hVar2 = (h) fVar; m.g(hVar2, "<this>"); m.g(hVar, "context"); if (hVar2.getRuntime().r2() || BuildInfo.DEBUG || BuildInfo.IS_FLAVOR_RED) { Log.i("MicroMsg.AppBrand.WXNativeInjector", "evaluate wxNative.js start. appId:" + hVar2.getAppId() + ", contextId:" + hVar.getContextId()); long currentTicks = Util.currentTicks(); URL url = new URL("https://lib/wxNative.js"); hVar.W0(url, e.e("wxNative.js") + "\n;(function() { return injectNativateRet; })()", new o1(hVar2, hVar, currentTicks)); } } @Override // jc.b public int e() { return ((ie1.h) yz3.j.c(ie1.h.class)).Xj0(h.c.Pu, 0); } @Override // jc.b public String f(jc.f fVar, String str) { try { return super.f((h) fVar, str); } catch (c2 e15) { q.INSTANCE.idkeyStat(370, 48, 1, false); t.i(((h) this.f238726d).getAppId(), ((h) this.f238726d).getRuntime().k0().f227330r.pkgVersion, ((h) this.f238726d).getRuntime().k0().f227330r.f83818d, 370, 48, 1); throw e15; } } @Override // jc.b public void i(com.tencent.mm.plugin.appbrand.jsruntime.h hVar) { SERVICE service = this.f238726d; if (service != null) { if (!((h) service).Q) { if (!(((h) service).getRuntime() == null || ((h) this.f238726d).getRuntime().f83310h2 == null)) { return; } } else { return; } } super.i(hVar); } @Override // jc.b public Object m(int i15) { b bVar = this.f94602h; WxaPkgV8SnapshotInfo wxaPkgV8SnapshotInfo = bVar.H; if (wxaPkgV8SnapshotInfo == null) { com.tencent.mm.sdk.platformtools.Log.e("MicroMsg.AppBrandJSContextInterfaceWC", "onAllocContextFromSnapshotStart, commLibSnapshotInfo is null"); return null; } bVar.c1(new b$$c(c0.f96539d)); return wxaPkgV8SnapshotInfo; } @Override // jc.b public void n(int i15, Object obj) { if (obj != null) { b bVar = this.f94602h; bVar.getClass(); bVar.c1(new b$$b(c0.f96539d)); } } @Override // jc.b public void o(boolean z15) { u0.f96641a.e(z15, this.f238726d); } @Override // jc.b public void p() { u0 u0Var = u0.f96641a; f0.f96544a.getClass(); if (f0.f96546c) { com.tencent.mm.sdk.platformtools.Log.i("MicroMsg.WxaCommLibV8SnapshotStats", "onAllocEmptySubContextStart"); } u0Var.d(u0.a.AllocEmptySubContext); } @Override // jc.b public void q(String str, int i15, boolean z15) { u0.f96641a.f(this.f94602h.G, str, z15, this.f238726d); } @Override // jc.b public void r(String str, int i15) { u0.f96641a.g(this.f94602h.G, str); } @Override // jc.b public void s(String str, int i15) { u0.f96641a.k(this.f94602h.G, str, this.f238726d); } @Override // jc.b public void t(String str, int i15) { u0.f96641a.l(this.f94602h.G, str); } @Override // jc.b public void v(String str, String str2, String str3) { u0.f96641a.r(this.f94602h.G, str, str2, str3); } @Override // jc.b public void w(int i15, String str, List<Boolean> list, List<j.g> list2) { u0.f96641a.m(this.f94602h.G, str, list, list2, this.f238726d); } @Override // jc.b public void x(int i15, String str) { u0.f96641a.n(this.f94602h.G, str); h hVar = (h) this.f238726d; if ((hVar instanceof l1) && am4.h.a(str, "WASubContext.js")) { this.f238727e.J0(i15).evaluateJavascript("" + Util.nullAsNil(((l1) hVar).W), null); } } @Override // jc.b public boolean y() { return ((ie1.h) yz3.j.c(ie1.h.class)).Xj0(h.c.f232591z8, 1) == 1; } /* JADX DEBUG: Multi-variable search result rejected for r12v0, resolved type: int */ /* JADX WARN: Multi-variable type inference failed */ /* JADX WARN: Type inference failed for: r12v1 */ /* JADX WARN: Type inference failed for: r12v2 */ /* JADX WARNING: Removed duplicated region for block: B:26:0x00b5 */ /* JADX WARNING: Removed duplicated region for block: B:27:0x00b8 */ /* JADX WARNING: Removed duplicated region for block: B:30:0x00bd */ /* JADX WARNING: Removed duplicated region for block: B:31:0x00c1 */ /* JADX WARNING: Removed duplicated region for block: B:56:0x01b2 */ /* JADX WARNING: Removed duplicated region for block: B:78:0x0275 */ /* JADX WARNING: Removed duplicated region for block: B:79:0x0282 */ @Override // jc.b public void z(f.a aVar, boolean z15, long j15, long j16, Object obj) { int i15; String str; j.g gVar; int i16; int i17; AppBrandSysConfigWC m25; long j17; long j18; long j19; int i18; String str2 = aVar.f206710i; com.tencent.mm.sdk.platformtools.Log.i("MicroMsg.AppBrandJSContextInterfaceWC", "reportBootstrapScriptEvaluateResult appId[%s] name[%s] succeed[%b]", ((h) this.f238726d).getAppId(), str2, Boolean.valueOf(z15)); j.g gVar2 = null; if ("WASubContext.js".equals(str2)) { if (((h) this.f238726d).getRuntime() != null) { if (z15) { n.f(((h) this.f238726d).getAppId(), KSProcessWeAppLaunch.stepInjectJSWASubContext, "WASubContext.js", j15, j16); } else { n.d(((h) this.f238726d).getAppId(), KSProcessWeAppLaunch.stepInjectJSWASubContext, "", "WASubContext.js", j15, j16); } } if (z15 && (((h) this.f238726d).f0() || ((h) this.f238726d).isRunning())) { if (obj instanceof j.g) { gVar2 = (j.g) obj; } WeAppQualityLibInjectStruct h15 = b.f94295a.h(this.f238726d); h15.s(str2); h15.f71924p = aVar.f206712k; if (gVar2 != null && (i18 = gVar2.codeCacheStatus) >= 0) { int[] iArr = x.f90957k0; if (i18 < 7) { j17 = (long) iArr[i18]; h15.f71926r = j17; h15.f71927s = 1; if (gVar2 == null) { j18 = gVar2.flatJSCompileCost; } else { j18 = 0; } h15.f71928t = j18; if (gVar2 == null) { j19 = (long) gVar2.f61708c; } else { j19 = 0; } h15.f71930v = j19; h15.f71919k = j15; h15.e("StartTimeStampMs", j15); h15.f71920l = j16; h15.e("EndTimeStampMs", j16); long j25 = h15.f71920l - h15.f71919k; h15.f71917i = j25; h15.c("CostTimeMs", j25); h15.n(); } } j17 = 4; h15.f71926r = j17; h15.f71927s = 1; if (gVar2 == null) { } h15.f71928t = j18; if (gVar2 == null) { } h15.f71930v = j19; h15.f71919k = j15; h15.e("StartTimeStampMs", j15); h15.f71920l = j16; h15.e("EndTimeStampMs", j16); long j252 = h15.f71920l - h15.f71919k; h15.f71917i = j252; h15.c("CostTimeMs", j252); h15.n(); } q qVar = q.INSTANCE; qVar.idkeyStat(370, 40, 1, false); if (z15) { qVar.idkeyStat(370, 41, 1, false); return; } qVar.idkeyStat(370, 42, 1, false); if (aVar.f206712k <= 0) { qVar.t(370, 74); } if (((h) this.f238726d).getRuntime() != null && (m25 = ((h) this.f238726d).getRuntime().k0()) != null) { t.i(((h) this.f238726d).getAppId(), m25.f227330r.pkgVersion, m25.f227330r.f83818d, 370, 42, 1); } } else if (str2.endsWith("app-service.js")) { if (((h) this.f238726d).getRuntime() == null) { str = "MicroMsg.AppBrandJSContextInterfaceWC"; } else if (z15) { str = "MicroMsg.AppBrandJSContextInterfaceWC"; n.f(((h) this.f238726d).getAppId(), KSProcessWeAppLaunch.stepInjectJSAppService, str2, j15, j16); n.e(((h) this.f238726d).getAppId(), KSProcessWeAppLaunch.stepServiceInit); } else { str = "MicroMsg.AppBrandJSContextInterfaceWC"; i15 = 1; n.d(((h) this.f238726d).getAppId(), KSProcessWeAppLaunch.stepInjectJSAppService, "", str2, j15, j16); n.b(((h) this.f238726d).getAppId(), KSProcessWeAppLaunch.stepServiceInit); if (z15) { if (((h) this.f238726d).f0() || ((h) this.f238726d).isRunning()) { AppBrandRuntimeWC U0 = ((h) this.f238726d).getRuntime(); if (obj instanceof j.g) { gVar = (j.g) obj; } else { gVar = null; } Object[] objArr = new Object[i15]; if (U0 != null) { i16 = U0.hashCode(); } else { i16 = -1; } objArr[0] = Integer.valueOf(i16); com.tencent.mm.sdk.platformtools.Log.i(str, "[QualitySystem] app-service.js runtime.hashCode = [%d]", objArr); SERVICE service = this.f238726d; long j26 = aVar.f206712k; if (U0 != null) { i17 = U0.hashCode(); } else { i17 = -1; } b.e(service, str2, j26, "", 0, j15, i17, gVar); } r0.c(1, j16 - j15, ((h) this.f238726d).f94840x ? 1 : 0, ((h) this.f238726d).getAppId(), -1, 0, ((h) this.f238726d).l().n()); QualitySessionRuntime c15 = b.c(((h) this.f238726d).getAppId(), i15); if (c15 != null) { r0.c(7, System.currentTimeMillis() - c15.H, ((h) this.f238726d).f94840x ? 1 : 0, ((h) this.f238726d).getAppId(), -1, 0, ((h) this.f238726d).l().n()); } } q qVar2 = q.INSTANCE; qVar2.idkeyStat(370, 44, 1, false); if (!z15) { qVar2.idkeyStat(370, 45, 1, false); return; } qVar2.idkeyStat(370, 46, 1, false); if (((h) this.f238726d).isRunning()) { t.i(((h) this.f238726d).getAppId(), ((h) this.f238726d).getRuntime().k0().f227330r.pkgVersion, ((h) this.f238726d).getRuntime().k0().f227330r.f83818d, 370, 46, 1); return; } return; } i15 = 1; if (z15) { } q qVar22 = q.INSTANCE; qVar22.idkeyStat(370, 44, 1, false); if (!z15) { } } } }