package com.tencent.mm.plugin.nfc_open;

import android.content.ComponentName;
import android.os.Process;
import com.tencent.matrix.trace.core.AppMethodBeat;
import com.tencent.mm.cd.h.d;
import com.tencent.mm.kernel.g;
import com.tencent.mm.model.at;
import com.tencent.mm.model.aw;
import com.tencent.mm.model.bw;
import com.tencent.mm.model.c;
import com.tencent.mm.plugin.nfc_open.a.b;
import com.tencent.mm.sdk.platformtools.ab;
import com.tencent.mm.sdk.platformtools.ah;
import com.tencent.mm.sdk.platformtools.bo;
import java.util.HashMap;

public final class a implements at {
    private com.tencent.mm.plugin.nfc_open.b.a oTu;

    private static a bVB() {
        AppMethodBeat.i(23054);
        aw.ZE();
        a aVar = (a) bw.oJ("plugin.nfc_open");
        if (aVar == null) {
            ab.w("MicroMsg.SubCoreCpuCard", "[NFC]not found in MMCore, new one");
            aVar = new a();
            aw.ZE().a("plugin.nfc_open", aVar);
        }
        AppMethodBeat.o(23054);
        return aVar;
    }

    public final HashMap<Integer, d> Jx() {
        return null;
    }

    public final void iy(int i) {
    }

    public final void bA(boolean z) {
    }

    public final void bz(boolean z) {
        AppMethodBeat.i(23055);
        ab.i("MicroMsg.SubCoreCpuCard", "alvinluo process: %s", new Object[]{bo.aw(ah.getContext(), Process.myPid())});
        g.RN().QU();
        if (bVB().oTu == null) {
            bVB().oTu = new com.tencent.mm.plugin.nfc_open.b.a();
        }
        com.tencent.mm.plugin.nfc_open.b.a aVar = bVB().oTu;
        if (aVar.bGv()) {
            ab.i("MicroMsg.CpuCardConfigManager", "do update cpu card config");
            aw.Rg().a(1561, aVar);
            aw.Rg().a(new b(aVar.oTw.version), 0);
        }
        aw.ZK();
        int intValue = ((Integer) c.Ry().get(com.tencent.mm.storage.ac.a.xLb, Integer.valueOf(0))).intValue();
        if (intValue == 0) {
            aw.ZK();
            if (((Integer) c.Ry().get(com.tencent.mm.storage.ac.a.xLc, Integer.valueOf(0))).intValue() == 1) {
                jC(true);
            } else {
                jC(false);
            }
        } else if (intValue == 1) {
            jC(true);
        } else {
            jC(false);
        }
        ab.i("MicroMsg.SubCoreCpuCard", "doNFCReport start");
        com.tencent.mm.sdk.g.d.post(new 1(this), getClass().getName());
        AppMethodBeat.o(23055);
    }

    private static void jC(boolean z) {
        AppMethodBeat.i(23056);
        if (z) {
            ah.getContext().getPackageManager().setComponentEnabledSetting(new ComponentName(ah.getPackageName(), "com.tencent.mm.plugin.nfc_open.ui.NfcWebViewUI"), 1, 1);
            AppMethodBeat.o(23056);
            return;
        }
        ah.getContext().getPackageManager().setComponentEnabledSetting(new ComponentName(ah.getPackageName(), "com.tencent.mm.plugin.nfc_open.ui.NfcWebViewUI"), 2, 1);
        AppMethodBeat.o(23056);
    }

    public final void onAccountRelease() {
    }
}
