package com.tencent.mm.plugin.fingerprint.b;

import com.tencent.matrix.trace.core.AppMethodBeat;
import com.tencent.mm.g.a.lv;
import com.tencent.mm.kernel.g;
import com.tencent.mm.plugin.fingerprint.a;
import com.tencent.mm.pluginsdk.l;
import com.tencent.mm.pluginsdk.wallet.k;
import com.tencent.mm.sdk.b.b;
import com.tencent.mm.sdk.b.c;
import com.tencent.mm.sdk.platformtools.ab;
import com.tencent.ytcommon.BuildConfig;

public final class j extends c<lv> {
    private String czZ;
    private a mrO;
    lv mrP;
    private k mrQ;
    private Runnable mrR;
    boolean mru;

    public j() {
        AppMethodBeat.i(41491);
        this.mrQ = null;
        this.mrR = null;
        this.mru = false;
        this.czZ = BuildConfig.FLAVOR;
        this.xxI = lv.class.getName().hashCode();
        AppMethodBeat.o(41491);
    }

    public final /* synthetic */ boolean a(b bVar) {
        AppMethodBeat.i(41496);
        lv lvVar = (lv) bVar;
        if (g.RK()) {
            this.mru = false;
            if (lvVar instanceof lv) {
                ab.i("MicroMsg.OpenFingerPrintAuthEventListener", "handle OpenFingerPrintAuthEventListener");
                if (e.bxs()) {
                    this.mrP = lvVar;
                    if (this.mrP == null) {
                        ab.e("MicroMsg.OpenFingerPrintAuthEventListener", null, new Object[]{"mEvent is null !!!"});
                    } else {
                        this.mrR = this.mrP.cHD.cHH;
                        this.czZ = lvVar.cHD.cBT;
                        a.bwM();
                        if (a.bwN() != null) {
                            a.bwM();
                            a.bwN();
                            boolean bxl = c.bxl();
                            if (this.mrO == null) {
                                this.mrO = new a(this);
                            }
                            a.bwM();
                            a.bwN();
                            this.mrQ = ((l) g.K(l.class)).bxx();
                            if (this.mrQ != null) {
                                this.mrQ.a(new 1(this));
                                AppMethodBeat.o(41496);
                                return bxl;
                            }
                            boolean hv = hv(false);
                            AppMethodBeat.o(41496);
                            return hv;
                        }
                        AppMethodBeat.o(41496);
                        return true;
                    }
                }
                ab.e("MicroMsg.OpenFingerPrintAuthEventListener", "device is not support FingerPrintAuth");
                this.mru = true;
                R(1, BuildConfig.FLAVOR);
                AppMethodBeat.o(41496);
                return true;
            }
        }
        ab.e("MicroMsg.OpenFingerPrintAuthEventListener", "OpenFingerPrintAuthEvent account is not ready");
        AppMethodBeat.o(41496);
        return false;
    }

    public final void release() {
        AppMethodBeat.i(41492);
        a.bwM();
        if (a.bwN() != null) {
            a.bwM();
            a.bwN();
            c.release();
        }
        this.mrP = null;
        AppMethodBeat.o(41492);
    }

    public static void bxK() {
        AppMethodBeat.i(41493);
        a.bwM();
        if (a.bwN() != null) {
            boolean z;
            a.bwM();
            a.bwN();
            c.abort();
            a.bwM();
            a.bwN();
            c.release();
            String str = "MicroMsg.OpenFingerPrintAuthEventListener";
            String str2 = "stopIdentify() isSoter: %b";
            Object[] objArr = new Object[1];
            a.bwM();
            a.bwN();
            if (((l) g.K(l.class)).type() == 2) {
                z = true;
            } else {
                z = false;
            }
            objArr[0] = Boolean.valueOf(z);
            ab.i(str, str2, objArr);
        }
        AppMethodBeat.o(41493);
    }

    /* Access modifiers changed, original: final */
    public final boolean hv(boolean z) {
        AppMethodBeat.i(41494);
        bxK();
        a.bwM();
        a.bwN();
        if (c.bxl()) {
            a.bwM();
            a.bwN();
            if (c.a(this.mrO, z) != 0) {
                ab.e("MicroMsg.OpenFingerPrintAuthEventListener", "failed to start identify");
                release();
                this.mru = true;
                R(1, BuildConfig.FLAVOR);
                AppMethodBeat.o(41494);
                return false;
            }
            ab.i("MicroMsg.OpenFingerPrintAuthEventListener", "startIdentify()");
            AppMethodBeat.o(41494);
            return true;
        }
        ab.e("MicroMsg.OpenFingerPrintAuthEventListener", "no fingerprints enrolled, use settings to enroll fingerprints first");
        release();
        this.mru = true;
        R(1, BuildConfig.FLAVOR);
        AppMethodBeat.o(41494);
        return false;
    }

    /* Access modifiers changed, original: final */
    public final void R(int i, String str) {
        AppMethodBeat.i(41495);
        ab.i("MicroMsg.OpenFingerPrintAuthEventListener", "onFail()");
        a.bwM();
        a.bwN();
        c.a(this.mrP, i, str);
        if (this.mru) {
            this.mrP = null;
        }
        ab.i("MicroMsg.OpenFingerPrintAuthEventListener", "callback OpenFingerPrintAuthEvent onFail()");
        AppMethodBeat.o(41495);
    }
}
