WeChat.apk(点击下载) / a.java


package ob;

import android.content.Context;
import android.view.WindowManager;
import androidx.camera.core.FocusMeteringAction;
import bw3.vm5;
import com.tencent.luggage.sdk.config.AppBrandSysConfigLU;
import com.tencent.luggage.sdk.jsapi.component.webaudio.WxAudioNativeInstallHelper;
import com.tencent.mars.cdn.CronetLogic;
import com.tencent.mm.appbrand.v8.IJSRuntime;
import com.tencent.mm.appbrand.v8.j;
import com.tencent.mm.plugin.appbrand.AppBrandRuntime;
import com.tencent.mm.plugin.appbrand.debugger.a0;
import com.tencent.mm.plugin.appbrand.debugger.h0;
import com.tencent.mm.plugin.appbrand.debugger.t;
import com.tencent.mm.plugin.appbrand.debugger.v;
import com.tencent.mm.plugin.appbrand.i5;
import com.tencent.mm.plugin.appbrand.jsapi.l;
import com.tencent.mm.plugin.appbrand.jsruntime.n;
import com.tencent.mm.plugin.appbrand.jsruntime.r;
import com.tencent.mm.plugin.appbrand.t2;
import com.tencent.mm.plugin.appbrand.ui.q4;
import com.tencent.mm.plugin.appbrand.utils.m1;
import com.tencent.mm.plugin.appbrand.utils.q1;
import com.tencent.mm.sdk.platformtools.BuildInfo;
import com.tencent.mm.sdk.platformtools.Log;
import com.tencent.mm.sdk.platformtools.MMHandlerThread;
import gc.c;
import gc.d;
import gc.e;
import gc.g;
import gc.h;
import gc.j;
import gc.k;
import ib.b;
import java.lang.ref.WeakReference;
import java.util.List;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import jc.f;
import jc.i;
import lh4.m;
import org.json.JSONArray;
import org.json.JSONObject;
import t2.a;
import xv0.e;
import yv0.x;

public class a<Service extends f> extends i<Service> implements e {
    public CronetLogic.CronetTaskNetworkStateCallback A = null;

    /* renamed from: j  reason: collision with root package name */
    public volatile boolean f275784j = false;

    /* renamed from: n  reason: collision with root package name */
    public boolean f275785n = false;

    /* renamed from: o  reason: collision with root package name */
    public v f275786o = null;

    /* renamed from: p  reason: collision with root package name */
    public jc.v f275787p;

    /* renamed from: q  reason: collision with root package name */
    public boolean f275788q = false;

    /* renamed from: r  reason: collision with root package name */
    public t f275789r = null;

    /* renamed from: s  reason: collision with root package name */
    public boolean f275790s = false;

    /* renamed from: t  reason: collision with root package name */
    public b f275791t = null;

    /* renamed from: u  reason: collision with root package name */
    public j f275792u;

    /* renamed from: v  reason: collision with root package name */
    public gc.i f275793v;

    /* renamed from: w  reason: collision with root package name */
    public g f275794w;

    /* renamed from: x  reason: collision with root package name */
    public k f275795x;

    /* renamed from: y  reason: collision with root package name */
    public WxAudioNativeInstallHelper f275796y;

    /* renamed from: z  reason: collision with root package name */
    public mb.i f275797z = null;

    public a(Service service) {
        super(service);
        a0(e.class, this);
        W0();
    }

    @Override // ob.e
    public mb.i A() {
        if (this.f275797z == null) {
            synchronized (this) {
                if (this.f275797z == null) {
                    this.f275797z = new mb.i();
                }
            }
        }
        return this.f275797z;
    }

    @Override // jc.i
    public void A0() {
        super.A0();
        b bVar = this.f275791t;
        if (bVar != null) {
            Log.i("MicroMsg.MagicBrush", "awaitDestroyDone");
            if (!bVar.f231146e.a(FocusMeteringAction.DEFAULT_AUTOCANCEL_DURATION) && BuildInfo.DEBUG) {
                throw new IllegalStateException("WAGame destroy timeout");
            }
        }
        v vVar = this.f275786o;
        if (vVar != null) {
            vVar.f86171h.e();
            a0 a0Var = vVar.f86171h;
            a0Var.getClass();
            Log.i("MicroMsg.RemoteDebugMsgMrg", "onClose");
            Future<?> future = a0Var.f85968j;
            if (future != null) {
                future.cancel(false);
            }
        }
    }

    @Override // jc.i
    public void B0() {
        super.B0();
        j jVar = new j();
        this.f275792u = jVar;
        jVar.a(((f) Z()).getJsRuntime(), Z());
        gc.i iVar = new gc.i();
        this.f275793v = iVar;
        iVar.a(((f) Z()).getJsRuntime(), Z());
        g gVar = new g();
        this.f275794w = gVar;
        com.tencent.mm.plugin.appbrand.jsruntime.j jsRuntime = ((f) Z()).getJsRuntime();
        com.tencent.mm.plugin.appbrand.jsapi.g Z = Z();
        Log.i("Luggage.LockStepNativeInstallHelper", "createLockStepBinding");
        if (jsRuntime == null) {
            Log.e("Luggage.LockStepNativeInstallHelper", "createLockStepBinding jsruntime is null");
        } else {
            gVar.f220059b = String.valueOf(1004);
            t20.a.f309132a.loadLibrary("mmlockstep");
            r rVar = (r) jsRuntime.q0(r.class);
            if (rVar == null) {
                Log.e("Luggage.LockStepNativeInstallHelper", "createLockStepBinding jsThreadHandler is null");
            } else {
                h hVar = (h) Z.m(h.class);
                if (hVar != null) {
                    boolean fN = hVar.fN();
                    gVar.f220060c = fN;
                    Log.i("Luggage.LockStepNativeInstallHelper", "createLockStepBinding xLibUVSwitch:%b ", Boolean.valueOf(fN));
                }
                rVar.post(new e(gVar, jsRuntime, new c(gVar, new WeakReference(rVar)), new d(gVar)));
            }
        }
        k kVar = new k();
        this.f275795x = kVar;
        kVar.a(((f) Z()).getJsRuntime(), Z(), 1);
        WxAudioNativeInstallHelper wxAudioNativeInstallHelper = new WxAudioNativeInstallHelper(true);
        this.f275796y = wxAudioNativeInstallHelper;
        wxAudioNativeInstallHelper.a(((f) Z()).getJsRuntime(), Z());
        if (j0() != null && j0().F1()) {
            Log.i("Luggage.AppBrandGameServiceLogicImp", "add MPRemoteDebugJSContextInterface");
            com.tencent.mm.plugin.appbrand.jsruntime.j jsRuntime2 = ((f) Z()).getJsRuntime();
            jc.v vVar = new jc.v((f) Z());
            this.f275787p = vVar;
            jsRuntime2.addJavascriptInterface(vVar, "DebuggerConnection");
            v vVar2 = this.f275786o;
            if (vVar2 != null) {
                this.f275787p.f238874a = vVar2;
            }
        }
    }

    /* JADX WARNING: Removed duplicated region for block: B:21:0x00c1  */
    @Override // jc.i
    public void C0(JSONObject jSONObject) {
        boolean z15;
        AppBrandSysConfigLU C1 = ((f) Z()).getRuntime().k0();
        JSONObject optJSONObject = jSONObject.optJSONObject("wxAppInfo");
        if (optJSONObject == null) {
            optJSONObject = new JSONObject();
        }
        try {
            JSONArray jSONArray = new JSONArray();
            int i15 = 0;
            while (true) {
                String[] strArr = C1.Z.F;
                if (i15 >= strArr.length) {
                    break;
                }
                jSONArray.put(strArr[i15]);
                i15++;
            }
            ((f) Z()).g0(optJSONObject, "subContextImgDomain", jSONArray);
        } catch (Exception unused) {
        }
        ((f) Z()).g0(jSONObject, "wxAppInfo", optJSONObject);
        Log.i("Luggage.AppBrandGameServiceLogicImp", "dm.widthPixels %d, dm.heightPixels %d", Integer.valueOf(V().f56105i.c()), Integer.valueOf(V().f56105i.b()));
        pc.g N0 = ((f) Z()).getRuntime();
        if (N0.m0() instanceof x) {
            Context context = ((x) N0.m0()).f349116d;
            Object obj = t2.a.f309129a;
            if (am4.a.a(new int[]{0, 1}, ((WindowManager) a.d.b(context, WindowManager.class)).getDefaultDisplay().getRotation()) != (e.b.b(N0.Q().f85783q.f85793a) == e.b.PORTRAIT)) {
                z15 = false;
                if (!z15) {
                    Log.e("Luggage.AppBrandGameServiceLogicImp", "hy: orientation judge failed! maybe because onConfigurationChange judgement and surface degree judgement not match");
                    ((dw0.a) bb.e.d(dw0.a.class, true)).idkeyStat(808, 4, 1, false);
                    ((dw0.b) bb.e.d(dw0.b.class, true)).g(18284, 1);
                }
                ((f) Z()).g0(jSONObject, "screenWidth", Integer.valueOf(V().f56105i.c()));
                ((f) Z()).g0(jSONObject, "screenHeight", Integer.valueOf(V().f56105i.b()));
                ((f) Z()).g0(jSONObject, "devicePixelRatio", Float.valueOf(V().f56105i.d()));
            }
        }
        z15 = true;
        if (!z15) {
        }
        ((f) Z()).g0(jSONObject, "screenWidth", Integer.valueOf(V().f56105i.c()));
        ((f) Z()).g0(jSONObject, "screenHeight", Integer.valueOf(V().f56105i.b()));
        ((f) Z()).g0(jSONObject, "devicePixelRatio", Float.valueOf(V().f56105i.d()));
    }

    @Override // jc.i
    public void D0(AppBrandRuntime appBrandRuntime) {
        super.D0(appBrandRuntime);
        K0();
        b bVar = this.f275791t;
        if (bVar != null) {
            bVar.getClass();
            m.g(appBrandRuntime, "runtime");
            bVar.b(appBrandRuntime);
        }
        k kVar = this.f275795x;
        if (kVar != null) {
            kVar.c(((f) Z()).getJsRuntime(), (l) Z());
        }
        g gVar = this.f275794w;
        if (gVar != null) {
            com.tencent.mm.plugin.appbrand.jsruntime.j jsRuntime = ((f) Z()).getJsRuntime();
            com.tencent.mm.plugin.appbrand.jsapi.g Z = Z();
            gVar.getClass();
            Log.i("Luggage.LockStepNativeInstallHelper", "initConfigLockStep");
            if (jsRuntime == null) {
                Log.e("Luggage.LockStepNativeInstallHelper", "initConfigLockStep jsruntime is null");
            } else {
                r rVar = (r) jsRuntime.q0(r.class);
                if (rVar == null) {
                    Log.e("Luggage.LockStepNativeInstallHelper", "initConfigLockStep jsThreadHandler is null");
                } else {
                    rVar.post(new gc.f(gVar, Z));
                }
            }
        }
        WxAudioNativeInstallHelper wxAudioNativeInstallHelper = this.f275796y;
        if (wxAudioNativeInstallHelper != null) {
            wxAudioNativeInstallHelper.c(((f) Z()).getJsRuntime(), (l) Z());
        }
        X0();
        appBrandRuntime.S0(q4.class, new vb.a(appBrandRuntime));
        V().f56108l.addSurfaceListenerForAllViews(new a$$d(this));
        this.f275796y.d(Z());
        a$$e a__e = new a$$e(this);
        this.A = a__e;
        CronetLogic.addCronetTaskNetworkStateCallback(a__e);
        CronetLogic.setGoodNetNotifyInterval(pg1.d.f().h("clicfg_android_cronet_weak_net_notify_interval", 5000, true, true));
    }

    @Override // com.tencent.mm.plugin.appbrand.debugger.p
    public void J(String str) {
        vm5 vm5 = new vm5();
        vm5.f40083e = ((f) Z()).q0().getComponentId();
        vm5.f40082d = str;
        this.f275786o.f86171h.f(h0.d(vm5, this.f275789r, "domEvent"));
    }

    public com.tencent.mm.plugin.appbrand.jsruntime.j J0(String str, byte[] bArr) {
        IJSRuntime.Config config = new IJSRuntime.Config(str, bArr);
        config.f61627g = true;
        config.f61626f = "1";
        config.f61629i = true;
        config.f61634n = new WeakReference<>((com.tencent.mm.plugin.appbrand.jsapi.h) Z());
        return new com.tencent.mm.plugin.appbrand.jsruntime.c(config);
    }

    public final void K0() {
        boolean z15;
        Object[] objArr = new Object[1];
        if (this.f275791t != null) {
            z15 = true;
        } else {
            z15 = false;
        }
        objArr[0] = Boolean.valueOf(z15);
        Log.i("Luggage.AppBrandGameServiceLogicImp", "setup magicbrush. loaded?[%b]", objArr);
        if (this.f275791t != null) {
            Boolean valueOf = Boolean.valueOf(Y0());
            boolean booleanValue = valueOf.booleanValue();
            boolean z16 = this.f275788q;
            if (booleanValue != z16) {
                Log.i("Luggage.AppBrandGameServiceLogicImp", "update useCommandBuffer before %b now %b", Boolean.valueOf(z16), valueOf);
                com.tencent.magicbrush.a aVar = this.f275791t.f231144c;
                m.d(aVar);
                boolean booleanValue2 = valueOf.booleanValue();
                aVar.f56065b.use_command_buffer = booleanValue2;
                aVar.nativeUpdateParams(aVar.f56064a, booleanValue2);
                this.f275788q = valueOf.booleanValue();
                return;
            }
            return;
        }
        ((f) Z()).O();
        this.f275788q = Y0();
        this.f275790s = Z0();
        b L0 = L0(this.f275788q, this.f275790s, O0(), a1());
        this.f275791t = L0;
        L0.a();
        a$$j a__j = new a$$j(this, null);
        com.tencent.magicbrush.a aVar2 = this.f275791t.f231144c;
        m.d(aVar2);
        aVar2.f56107k.a(a__j);
        com.tencent.magicbrush.a aVar3 = this.f275791t.f231144c;
        m.d(aVar3);
        aVar3.f56106j.a(a__j);
        com.tencent.magicbrush.a aVar4 = this.f275791t.f231144c;
        m.d(aVar4);
        aVar4.f56108l.addListener(new a$$g(this));
    }

    public b L0(boolean z15, boolean z16, int i15, boolean z17) {
        return new a$$f(this, ((f) Z()).getContext(), ((f) Z()).getJsRuntime(), z15, z16, i15, z17);
    }

    public final void M0() {
        int i15;
        q1.e eVar = q1.e.LIB;
        if (!this.f275785n) {
            this.f275785n = true;
            Log.i("Luggage.AppBrandGameServiceLogicImp", "Inject WAGame to MainContext");
            m1.b(((f) Z()).getJsRuntime(), null, Q0(), new c(this));
            a$$i N0 = N0();
            i5.b((com.tencent.mm.plugin.appbrand.j) Z(), ((f) Z()).getJsRuntime());
            ((dw0.a) bb.e.d(dw0.a.class, true)).idkeyStat(778, 13, 1, false);
            long currentTimeMillis = System.currentTimeMillis();
            boolean f05 = ((f) Z()).f0();
            String str = N0.f275815b;
            if (str == null) {
                i15 = 0;
            } else {
                i15 = str.length();
            }
            a$$c a__c = new a$$c(this, N0.f275814a, N0.f275815b, currentTimeMillis, i15, f05);
            if (((f) Z()).getRuntime() == null || !((f) Z()).getRuntime().F1()) {
                q1.g((t2) Z(), ((f) Z()).getJsRuntime(), N0.f275814a, N0.f275816c, N0.f275817d, S0(), N0.f275815b, eVar, a__c);
                return;
            }
            N0.f275815b = ";(function(global) { var protectedConsole = global.console; Object.defineProperty(global, 'console', { get() { return protectedConsole; }, set() { } }); })(this);" + N0.f275815b;
            q1.h((t2) Z(), ((f) Z()).getJsRuntime(), N0.f275814a, N0.f275815b, eVar, a__c);
        }
    }

    public a$$i N0() {
        a$$i a__i = new a$$i();
        a__i.f275814a = "WAGame.js";
        a__i.f275815b = ((f) Z()).l().o("WAGame.js");
        a__i.f275816c = "WAGame.js";
        a__i.f275817d = "v" + ((f) Z()).l().n();
        return a__i;
    }

    public int O0() {
        return 1;
    }

    @Override // com.tencent.mm.plugin.appbrand.debugger.p
    public String P() {
        JSONObject p05 = ((f) Z()).p0();
        return String.format("var __wxConfig = %s;\nvar __wxIndexPage = \"%s\"", p05.toString(), ((f) Z()).getRuntime().Q().H);
    }

    public String P0() {
        return null;
    }

    public String Q0() {
        return gx0.e.e("wxa_library/android.js") + gx0.e.e("wxa_library/shared_buffer.js") + gx0.e.e("wxa_library/lazy_load.js") + gx0.e.e("wxa_library/puppet_wrapper.js") + gx0.e.e("wxa_library/NativeGlobal-WAGame.js");
    }

    public j R0(Service service, com.tencent.mm.plugin.appbrand.jsruntime.v vVar) {
        return new j(service, vVar);
    }

    public int S0() {
        return 0;
    }

    public void T0(boolean z15, String str, j.g gVar) {
    }

    public void U0(String str, String str2) {
    }

    @Override // ob.f
    public com.tencent.magicbrush.a V() {
        com.tencent.magicbrush.a aVar = this.f275791t.f231144c;
        m.d(aVar);
        return aVar;
    }

    public void V0(int i15) {
    }

    public void W0() {
        new kb.g().b();
    }

    public final void X0() {
        r rVar;
        try {
            com.tencent.mm.plugin.appbrand.jsruntime.j jsRuntime = ((f) Z()).getJsRuntime();
            if (jsRuntime != null && (rVar = (r) jsRuntime.q0(r.class)) != null) {
                rVar.t(-8);
            }
        } catch (Throwable th5) {
            Log.printErrStackTrace("Luggage.AppBrandGameServiceLogicImp", th5, "[CAPTURED CRASH]", new Object[0]);
        }
    }

    public boolean Y0() {
        Boolean bool;
        if (((f) Z()).getRuntime() == null || (bool = ((f) Z()).getRuntime().Q().f85784r) == null) {
            return true;
        }
        return bool.booleanValue();
    }

    public boolean Z0() {
        return true;
    }

    public boolean a1() {
        return false;
    }

    @Override // jc.i
    public void d0() {
        super.d0();
        b bVar = this.f275791t;
        if (bVar != null) {
            Log.i("MicroMsg.MagicBrush", "destroy");
            ((n) bVar.f231143b.q0(n.class)).D0(bVar.f231146e);
        }
        gc.j jVar = this.f275792u;
        if (jVar != null) {
            jVar.b(((f) Z()).getJsRuntime());
        }
        gc.i iVar = this.f275793v;
        if (iVar != null) {
            iVar.b(((f) Z()).getJsRuntime());
        }
        g gVar = this.f275794w;
        if (gVar != null) {
            com.tencent.mm.plugin.appbrand.jsruntime.j jsRuntime = ((f) Z()).getJsRuntime();
            Log.i("Luggage.LockStepNativeInstallHelper", "destroyLockStepBinding");
            if (jsRuntime == null) {
                Log.e("Luggage.LockStepNativeInstallHelper", "destroyLockStepBinding jsruntime is null");
            } else {
                ((n) jsRuntime.q0(n.class)).D0(gVar.f220061d);
            }
        }
        k kVar = this.f275795x;
        if (kVar != null) {
            kVar.b(((f) Z()).getJsRuntime());
        }
        WxAudioNativeInstallHelper wxAudioNativeInstallHelper = this.f275796y;
        if (wxAudioNativeInstallHelper != null) {
            wxAudioNativeInstallHelper.b(((f) Z()).getJsRuntime());
        }
        CronetLogic.CronetTaskNetworkStateCallback cronetTaskNetworkStateCallback = this.A;
        if (cronetTaskNetworkStateCallback != null) {
            CronetLogic.removeCronetTaskNetworkStateCallback(cronetTaskNetworkStateCallback);
        }
        if (j0() != null && j0().s1()) {
            com.tencent.mm.plugin.appbrand.jsruntime.j jsRuntime2 = ((f) Z()).getJsRuntime();
            r rVar = (r) jsRuntime2.q0(r.class);
            com.tencent.mm.plugin.appbrand.j jVar2 = (com.tencent.mm.plugin.appbrand.j) Z();
            List<? extends com.tencent.mm.plugin.appbrand.jsruntime.h> D = ((com.tencent.mm.plugin.appbrand.jsruntime.v) jsRuntime2.q0(com.tencent.mm.plugin.appbrand.jsruntime.v.class)).D(true);
            Log.i("Luggage.AppBrandGameServiceLogicImp", "post report coverage task for appId:%s, contexts.size:%d", g0(), Integer.valueOf(D.size()));
            CountDownLatch countDownLatch = new CountDownLatch(D.size());
            for (com.tencent.mm.plugin.appbrand.jsruntime.h hVar : D) {
                hVar.evaluateJavascript("\n        ;(function() {\n            let data = (globalThis || {}).__coverage__;\n            if (typeof data === 'string' || typeof data === 'undefined') {\n                return data;\n            } else {\n                return JSON.stringify(data);\n            }\n        })();\n    ", new a$$a(jVar2, hVar, countDownLatch));
            }
            try {
                countDownLatch.await(3, TimeUnit.SECONDS);
                Log.i("Luggage.AppBrandGameServiceLogicImp", "post report coverage task for appId:%s latch await end", g0());
            } catch (Exception e15) {
                Log.e("Luggage.AppBrandGameServiceLogicImp", "post report coverage task for appId:%s latch await failed:%s", g0(), e15);
                Log.i("Luggage.AppBrandGameServiceLogicImp", "post report coverage task for appId:%s latch await end", g0());
            } catch (Throwable th5) {
                Log.i("Luggage.AppBrandGameServiceLogicImp", "post report coverage task for appId:%s latch await end", g0());
                throw th5;
            }
        }
    }

    /* JADX DEBUG: Multi-variable search result rejected for r10v0, resolved type: ob.a<Service extends jc.f> */
    /* JADX WARN: Multi-variable type inference failed */
    @Override // jc.i
    public com.tencent.mm.plugin.appbrand.jsruntime.j e0() {
        Log.i("Luggage.AppBrandGameServiceLogicImp", "createJsRuntime");
        long currentTimeMillis = System.currentTimeMillis();
        com.tencent.mm.plugin.appbrand.jsruntime.j J0 = J0(P0(), null);
        j R0 = R0((f) Z(), (com.tencent.mm.plugin.appbrand.jsruntime.v) J0.q0(com.tencent.mm.plugin.appbrand.jsruntime.v.class));
        J0.setJsExceptionHandler(new a$$b(this));
        R0.getClass();
        J0.addJavascriptInterface(R0, "WeixinJSContext");
        m1.b(J0, null, "(function(global) {\n    let loadJsFilesWithOptions = global.WeixinJSContext.loadJsFilesWithOptions\n    global.WeixinJSContext.loadJsFiles = function(contextId, paths, options) {\n        if (!options) {\n            options = '{}'\n        } else if (typeof options !== 'string') {\n            options = JSON.stringify(options)\n        }\n        loadJsFilesWithOptions(contextId, paths, options)\n    }\n})(this);", new h(R0));
        m1.b(J0, null, String.format(";(function(){let interface = %s;let alloc = interface.alloc;let allocNativeGlobal = interface.allocNativeGlobal;interface.alloc = function(injectNativeGlobal) {if(injectNativeGlobal){return allocNativeGlobal();}else{return alloc();}}})();", "WeixinJSContext"), new i(R0));
        R0.u();
        Log.i("Luggage.AppBrandGameServiceLogicImp", "[damonlei] createJsRuntime cost [%d]ms", Long.valueOf(System.currentTimeMillis() - currentTimeMillis));
        return J0;
    }

    @Override // ku0.e
    public final boolean g(String str) {
        Log.i("Luggage.AppBrandGameServiceLogicImp", "hy: do nothing in game service when called from modularizing helper");
        return false;
    }

    @Override // jc.i
    public void m0() {
        if (((f) Z()).getRuntime() != null && ((f) Z()).getRuntime().F1()) {
            MMHandlerThread.postToMainThread(new d(this));
            com.tencent.mm.plugin.appbrand.jsruntime.m mVar = (com.tencent.mm.plugin.appbrand.jsruntime.m) ((f) Z()).getJsRuntime().q0(com.tencent.mm.plugin.appbrand.jsruntime.m.class);
            if (mVar != null) {
                mVar.w1("xdebug");
            }
            if (((f) Z()).f94840x) {
                com.tencent.mm.plugin.appbrand.jsruntime.j jsRuntime = ((f) Z()).getJsRuntime();
                ((f) Z()).getClass();
                q1.e(jsRuntime, "https://usr/");
            }
        }
    }

    @Override // jc.i
    public boolean r0() {
        return true;
    }

    @Override // jc.i
    public boolean s0(String str, JSONObject jSONObject) {
        if ("Image".equals(str) || "OffscreenCanvas".equals(str) || "MediaToolKit".equals(str) || "Profiler".equals(str)) {
            return true;
        }
        if ("Box2D".equals(str)) {
            com.tencent.magicbrush.a V = V();
            int i15 = com.tencent.magicbrush.a.f56104p;
            V.q("mmbox2d");
            return true;
        } else if (!"Phys3D".equals(str)) {
            return super.s0(str, jSONObject);
        } else {
            com.tencent.magicbrush.a V2 = V();
            int i16 = com.tencent.magicbrush.a.f56104p;
            V2.q("mmphysx");
            return true;
        }
    }

    @Override // jc.i
    public void v0() {
        Log.i("Luggage.AppBrandGameServiceLogicImp", "WAGameAppServiceWC.init");
        this.f275784j = true;
        Log.i("Luggage.AppBrandGameServiceLogicImp", "WAGameAppServiceWC.initImpl mServiceReady = [%b], isRunning[%b]", Boolean.valueOf(this.f275784j), Boolean.valueOf(((f) Z()).isRunning()));
        if (this.f275784j && ((f) Z()).isRunning()) {
            try {
                Log.i("Luggage.AppBrandGameServiceLogicImp", "WAGameAppServiceWC.initImpl start");
                if (!this.f275785n) {
                    ((f) Z()).getJsRuntime().evaluateJavascript(gx0.e.e("wxa_library/android.js"), null);
                }
                ((f) Z()).y0();
                M0();
                ((f) Z()).u(new b(this));
            } catch (NullPointerException e15) {
                if (((f) Z()).isRunning()) {
                    throw e15;
                }
            }
        }
    }

    @Override // jc.i
    public void x0() {
        Log.i("Luggage.AppBrandGameServiceLogicImp", "start preload");
        K0();
        ((f) Z()).N();
        M0();
        Log.i("Luggage.AppBrandGameServiceLogicImp", "WAGameAppService preloaded.");
    }

    @Override // jc.i
    public void y0() {
        super.y0();
        try {
            com.tencent.mm.plugin.appbrand.jsruntime.j jsRuntime = ((f) Z()).getJsRuntime();
            if (jsRuntime != null) {
                r rVar = (r) jsRuntime.q0(r.class);
                if (rVar != null) {
                    rVar.t(10);
                }
            }
        } catch (Throwable th5) {
            Log.printErrStackTrace("Luggage.AppBrandGameServiceLogicImp", th5, "[CAPTURED CRASH]", new Object[0]);
        }
    }

    @Override // jc.i
    public void z0() {
        Log.i("Luggage.AppBrandGameServiceLogicImp", "onRuntimeResume");
        super.z0();
        X0();
        v vVar = this.f275786o;
        if (vVar != null) {
            vVar.f86173j.bringToFront();
        }
    }
}