package com.tencent.mm.plugin.appbrand;

import com.tencent.luggage.sdk.config.AppBrandSysConfigLU;
import com.tencent.matrix.trace.core.AppMethodBeat;
import com.tencent.mm.g.b.a.cg;
import com.tencent.mm.plugin.appbrand.config.AppBrandSysConfigWC;
import com.tencent.mm.plugin.appbrand.config.d;
import com.tencent.mm.plugin.appbrand.i.10;
import com.tencent.mm.plugin.appbrand.jsapi.miniprogram_navigator.i;
import com.tencent.mm.plugin.appbrand.keepalive.b.1;
import com.tencent.mm.plugin.appbrand.launching.AppBrandLaunchErrorAction;
import com.tencent.mm.plugin.appbrand.launching.AppBrandPrepareTask.b;
import com.tencent.mm.plugin.appbrand.launching.AppStartupPerformanceReportBundle;
import com.tencent.mm.plugin.appbrand.performance.c;
import com.tencent.mm.plugin.appbrand.report.model.kv_14609;
import com.tencent.mm.plugin.appbrand.report.quality.QualitySessionRuntime;
import com.tencent.mm.plugin.appbrand.report.quality.a;
import com.tencent.mm.plugin.appbrand.task.e;
import com.tencent.mm.sdk.platformtools.ab;
import com.tencent.mm.ui.MMActivity;

class o$6 implements b<AppBrandSysConfigWC> {
    final /* synthetic */ long fEG;
    final /* synthetic */ i.b gPA;
    final /* synthetic */ o gPy;

    o$6(o oVar, long j, i.b bVar) {
        this.gPy = oVar;
        this.fEG = j;
        this.gPA = bVar;
    }

    public final /* synthetic */ void a(AppBrandSysConfigLU appBrandSysConfigLU, AppBrandLaunchErrorAction appBrandLaunchErrorAction, AppStartupPerformanceReportBundle appStartupPerformanceReportBundle) {
        AppMethodBeat.i(128991);
        AppBrandSysConfigWC appBrandSysConfigWC = (AppBrandSysConfigWC) appBrandSysConfigLU;
        ab.i("MicroMsg.AppBrandRuntimeWC", "AppBrandPrepareTask.onPrepareDone appId[%s] type[%d] activityFinishing[%b], runtimeFinishing[%b %b]", new Object[]{this.gPy.mAppId, Integer.valueOf(this.gPy.gNB.gVs), Boolean.valueOf(this.gPy.atM().isFinishing()), Boolean.valueOf(this.gPy.Pf), Boolean.valueOf(this.gPy.mFinished)});
        if (this.gPy.atM().isFinishing() || r1 || r2) {
            AppMethodBeat.o(128991);
            return;
        }
        a.aLz();
        String str = this.gPy.mAppId;
        if (appStartupPerformanceReportBundle == null) {
            ab.i("MicroMsg.AppBrandQualitySystem", "reportAppStartupPerformanceReportBundle, but bundle == null");
        } else {
            QualitySessionRuntime DG = a.DG(str);
            if (DG != null) {
                for (kv_14609 kv_14609 : appStartupPerformanceReportBundle.igV) {
                    kv_14609.igT = DG.igT;
                    kv_14609.IF();
                }
                for (cg cgVar : appStartupPerformanceReportBundle.igU) {
                    cgVar.hc(DG.appId);
                    cgVar.hb(DG.igT);
                    cgVar.dfQ = cg.a.hg(DG.iCZ);
                    cgVar.ddz = (long) DG.apptype;
                    cgVar.cVR = (long) DG.scene;
                    cgVar.ddd = (long) DG.iDa;
                    cgVar.ajK();
                }
            }
        }
        if (appBrandSysConfigWC == null) {
            this.gPy.atM().runOnUiThread(new 1(this, appBrandLaunchErrorAction));
            i.b(this.gPy.mAppId, this.gPy.atc(), this.gPy.ya().bQn);
            AppMethodBeat.o(128991);
            return;
        }
        d.a(appBrandSysConfigWC);
        this.gPy.gNI.add(appBrandSysConfigWC);
        this.gPy.gNI.add(appStartupPerformanceReportBundle);
        try {
            a.a(this.gPy.mAppId, appBrandSysConfigWC, appStartupPerformanceReportBundle, this.gPy);
        } catch (Throwable th) {
            ab.w("MicroMsg.AppBrandRuntimeWC", "onPrepareDone [%s] reportResourceReady e = %s", new Object[]{this.gPy.mAppId, th});
        }
        o.d(this.gPy).y(1, System.currentTimeMillis() - this.fEG);
        c.a(this.gPy.mAppId, "ResourcePrepare", this.fEG, System.currentTimeMillis());
        this.gPy.a(o.e(this.gPy));
        this.gPy.gNI.add(appBrandSysConfigWC.bQt);
        o.f(this.gPy);
        this.gPy.asY();
        this.gPy.atO();
        o.g(this.gPy);
        com.tencent.mm.plugin.appbrand.keepalive.b bVar = com.tencent.mm.plugin.appbrand.keepalive.b.ifu;
        MMActivity atM = this.gPy.atM();
        o oVar = this.gPy;
        ab.i("MicroMsg.AppBrandKeepAliveManager", "set up contextUIName:%s", new Object[]{atM.getClass().getName()});
        oVar.gNN.a(new 1(bVar));
        if (bVar.ifv != null) {
            ab.i("MicroMsg.AppBrandKeepAliveManager", "already set up mAppBrandUIClassName");
        } else {
            bVar.ifv = atM.getClass().getName();
        }
        this.gPy.atM().runOnUiThread(new 2(this));
        AppMethodBeat.o(128991);
    }

    public final void nm(int i) {
        AppMethodBeat.i(128986);
        this.gPy.nm(i);
        AppMethodBeat.o(128986);
    }

    public final void atT() {
        AppMethodBeat.i(128987);
        if (this.gPy.mFinished) {
            AppMethodBeat.o(128987);
            return;
        }
        j h = o.h(this.gPy);
        if (h != null) {
            h.a(e.b.iEC);
        }
        AppMethodBeat.o(128987);
    }

    public final void gf(long j) {
        AppMethodBeat.i(128988);
        if (this.gPy.mFinished) {
            AppMethodBeat.o(128988);
            return;
        }
        this.gPy.gPs = true;
        if (o.j(this.gPy) != null) {
            o.j(this.gPy).iCc = true;
        }
        o.dv(this.gPy.gPs);
        j h = o.h(this.gPy);
        if (h != null) {
            h.a(e.b.iED);
        }
        AppMethodBeat.o(128988);
    }

    public final void nn(int i) {
        AppMethodBeat.i(128989);
        ab.i("MicroMsg.AppBrandRuntimeWC", "appId[%s] onDownloadProgress %d", new Object[]{this.gPy.mAppId, Integer.valueOf(i)});
        o oVar = this.gPy;
        oVar.getContext().runOnUiThread(new 10(oVar, i));
        AppMethodBeat.o(128989);
    }

    public final void a(com.tencent.mm.plugin.appbrand.jsapi.version.a aVar) {
        AppMethodBeat.i(128990);
        this.gPy.A(new 3(this, aVar));
        AppMethodBeat.o(128990);
    }
}
