package com.tencent.mm.plugin.appbrand.dynamic;

import android.os.Bundle;
import android.support.v4.widget.j;
import com.tencent.matrix.trace.core.AppMethodBeat;
import com.tencent.mm.g.b.a.ad;
import com.tencent.mm.g.b.a.cr;
import com.tencent.mm.ipcinvoker.f;
import com.tencent.mm.modelappbrand.u;
import com.tencent.mm.modelappbrand.v;
import com.tencent.mm.plugin.appbrand.appcache.WxaPkgWrappingInfo;
import com.tencent.mm.plugin.appbrand.dynamic.WxaWidgetInitializer.WxaWidgetContextImpl;
import com.tencent.mm.plugin.appbrand.dynamic.WxaWidgetInitializer.a;
import com.tencent.mm.plugin.appbrand.dynamic.j.a.2;
import com.tencent.mm.plugin.appbrand.dynamic.j.d;
import com.tencent.mm.sdk.platformtools.ab;
import com.tencent.mm.sdk.platformtools.ah;
import com.tencent.mm.sdk.platformtools.at;
import com.tencent.sqlitelint.config.SharePluginInfo;

class WxaWidgetInitializer$1 implements Runnable {
    final /* synthetic */ int fwD;
    final /* synthetic */ int gQG;
    final /* synthetic */ int hlL;
    final /* synthetic */ int hlM;
    final /* synthetic */ String hlN;
    final /* synthetic */ int hlO;
    final /* synthetic */ a hlP;
    final /* synthetic */ String hlQ;
    final /* synthetic */ String hlR;
    final /* synthetic */ String val$appId;
    final /* synthetic */ String val$id;

    WxaWidgetInitializer$1(String str, int i, int i2, String str2, int i3, int i4, String str3, int i5, a aVar, String str4, String str5) {
        this.val$id = str;
        this.gQG = i;
        this.hlL = i2;
        this.val$appId = str2;
        this.hlM = i3;
        this.fwD = i4;
        this.hlN = str3;
        this.hlO = i5;
        this.hlP = aVar;
        this.hlQ = str4;
        this.hlR = str5;
    }

    public final void run() {
        AppMethodBeat.i(10718);
        ab.d("MicroMsg.WxaWidgetInitializer", "initialize(id : %s, pkgType : %s, version : %s)", new Object[]{this.val$id, Integer.valueOf(this.gQG), Integer.valueOf(this.hlL)});
        u.i("MicroMsg.WxaWidgetInitializer", "initialize(id : %s, pkgType : %s, version : %s)", new Object[]{this.val$id, Integer.valueOf(this.gQG), Integer.valueOf(this.hlL)});
        long currentTimeMillis = System.currentTimeMillis();
        v.kT(1);
        d a = com.tencent.mm.plugin.appbrand.dynamic.j.a.a(this.val$appId, this.gQG, this.hlL, this.hlM, this.fwD, this.hlN);
        ad eZ;
        if (a == null) {
            ab.e("MicroMsg.WxaWidgetInitializer", "getLaunchWxaWidgetInfo(id : %s, pkgType : %s, version : %s) return null.", new Object[]{this.val$id, Integer.valueOf(this.gQG), Integer.valueOf(this.hlL)});
            v.kT(3);
            eZ = new ad().eY(this.val$id).eZ(u.pr(this.val$id));
            eZ.cYw = (long) this.hlO;
            eZ.cYs = 2;
            eZ.cYt = System.currentTimeMillis();
            eZ.cYu = 2;
            eZ.fa(at.gB(ah.getContext())).ajK();
            u.i("MicroMsg.WxaWidgetInitializer", "getLaunchWxaWidgetInfo(id : %s, pkgType : %s, version : %s) return null.", new Object[]{this.val$id, Integer.valueOf(this.gQG), Integer.valueOf(this.hlL)});
            if (this.hlP != null) {
                this.hlP.a(this.val$id, this.val$appId, false, null);
            }
            AppMethodBeat.o(10718);
            return;
        }
        u.i("MicroMsg.WxaWidgetInitializer", "get lauch info , replace version %d with %d", new Object[]{Integer.valueOf(this.hlL), Integer.valueOf(a.hoY.vMG)});
        eZ = new ad().eY(this.val$id).eZ(u.pr(this.val$id));
        eZ.cYw = (long) this.hlO;
        eZ.cYs = 2;
        eZ.cYt = System.currentTimeMillis();
        eZ.cYu = 1;
        eZ.fa(at.gB(ah.getContext())).ajK();
        v.kT(2);
        WxaPkgWrappingInfo a2 = com.tencent.mm.plugin.appbrand.dynamic.j.a.a(this.val$id, this.val$appId, this.hlQ, this.gQG, a.hoY.vMG, this.hlR);
        if (a2 != null) {
            u.i("MicroMsg.WxaWidgetInitializer", "get WxaPkgWrapping info", new Object[0]);
            WxaWidgetContextImpl a3 = WxaWidgetInitializer.a(this.val$id, this.val$appId, a2, a);
            if (this.hlP != null) {
                boolean z;
                a aVar = this.hlP;
                String str = this.val$id;
                String str2 = this.val$appId;
                if (a3 != null) {
                    z = true;
                } else {
                    z = false;
                }
                aVar.a(str, str2, z, a3);
            }
            cr crVar = new cr();
            crVar.cTl = 1;
            crVar = crVar.hD(this.val$appId);
            crVar.dhm = System.currentTimeMillis() - currentTimeMillis;
            crVar.ajK();
            AppMethodBeat.o(10718);
            return;
        }
        u.i("MicroMsg.WxaWidgetInitializer", "get widget PkgWrappingInfo(id : %s, pkgType : %s, version : %s) return null.", new Object[]{this.val$id, Integer.valueOf(this.gQG), Integer.valueOf(a.hoY.vMG)});
        if (this.hlP != null) {
            this.hlP.bI(this.val$id, this.val$appId);
        }
        String str3 = this.val$id;
        String str4 = this.val$appId;
        String str5 = this.hlQ;
        int i = this.gQG;
        1 1 = new 1(this, a);
        if (i != j.INVALID_ID && com.tencent.mm.plugin.appbrand.dynamic.j.a.b(str3, str4, str5, i) == null) {
            Bundle bundle = new Bundle();
            bundle.putString(SharePluginInfo.ISSUE_KEY_ID, str3);
            bundle.putString("appId", str4);
            bundle.putInt("debugType", i);
            f.a("com.tencent.mm", bundle, com.tencent.mm.plugin.appbrand.dynamic.j.a.d.class, new 2(1));
        }
        AppMethodBeat.o(10718);
    }
}
