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

import com.tencent.matrix.trace.core.AppMethodBeat;
import com.tencent.mm.ipcinvoker.a;
import com.tencent.mm.ipcinvoker.c;
import com.tencent.mm.kernel.g;
import com.tencent.mm.plugin.appbrand.launching.AppBrandPrepareTask.PrepareParams;
import com.tencent.mm.plugin.appbrand.launching.AppBrandPrepareTask.PrepareResult;
import com.tencent.mm.plugin.report.service.h;
import com.tencent.mm.sdk.platformtools.ab;

final class AppBrandPrepareTask$a implements a<PrepareParams, PrepareResult> {
    private AppBrandPrepareTask$a() {
    }

    public final /* synthetic */ void a(Object obj, c cVar) {
        AppMethodBeat.i(131748);
        PrepareParams prepareParams = (PrepareParams) obj;
        if (prepareParams == null) {
            ab.w("MicroMsg.AppBrandPrepareTask", "PrepareCall invoke NULL input");
            if (cVar != null) {
                PrepareResult prepareResult = new PrepareResult();
                PrepareResult.a(prepareResult, 2);
                PrepareResult.a(prepareResult, null);
                PrepareResult.a(prepareResult, null);
                PrepareResult.a(prepareResult, null);
                cVar.ao(prepareResult);
            }
            AppMethodBeat.o(131748);
            return;
        }
        String c = PrepareParams.c(prepareParams);
        String a = PrepareParams.a(prepareParams);
        int b = PrepareParams.b(prepareParams);
        int d = PrepareParams.d(prepareParams);
        String e = PrepareParams.e(prepareParams);
        1 1 = new 1(this, cVar, prepareParams);
        g Cg = g.Cg(PrepareParams.h(prepareParams));
        if (Cg == null) {
            Cg = new g(c, a, b, PrepareParams.i(prepareParams), d, e, PrepareParams.j(prepareParams), PrepareParams.h(prepareParams), PrepareParams.k(prepareParams), PrepareParams.g(prepareParams));
            2 2 = new 2(this, cVar, Cg, a, b, d, prepareParams);
            if (g.RQ().eKi.eKC) {
                2.BR();
            } else {
                ab.i("MicroMsg.AppBrandPrepareTask", "prepareCall kernel startup not done yet, wait for it");
                g.RQ().a(2);
            }
        } else {
            h.pYm.k(369, 22, 1);
            long j = Cg.igG;
            if (j > 0 && cVar != null) {
                PrepareResult prepareResult2 = new PrepareResult();
                PrepareResult.a(prepareResult2, 1);
                PrepareResult.a(prepareResult2, j);
                cVar.ao(prepareResult2);
            }
        }
        Cg.igD = 1;
        if (Cg.started && Cg.igF != null) {
            ab.v("MicroMsg.AppBrand.AppLaunchPrepareProcess[applaunch]", "[applaunch] setResultCallback already done %s %d", new Object[]{Cg.appId, Integer.valueOf(Cg.har)});
            Cg.a(Cg.igF);
        }
        if (Cg.igE) {
            Cg.aHg();
        }
        AppMethodBeat.o(131748);
    }
}
