package com.tencent.mm.model;

import com.tencent.matrix.trace.core.AppMethodBeat;
import com.tencent.mm.ai.p;
import com.tencent.mm.ai.t;
import com.tencent.mm.compatible.b.g;
import com.tencent.mm.g.a.aa;
import com.tencent.mm.kernel.b;
import com.tencent.mm.model.c.a;
import com.tencent.mm.modelstat.o;
import com.tencent.mm.network.n;
import com.tencent.mm.plugin.report.service.h;
import com.tencent.mm.sdk.platformtools.ab;
import com.tencent.mm.sdk.platformtools.ah;
import com.tencent.mm.sdk.platformtools.al;
import com.tencent.mm.sdk.platformtools.bo;
import com.tencent.mm.storage.ad;
import com.tencent.mm.storage.bd;
import com.tencent.mm.storage.be;
import com.tencent.mm.storage.y;
import junit.framework.Assert;

public final class aw {
    private static aw flB = null;
    private static final bw flD = new bw();
    private final am flA;
    private g flC = null;
    private final int flE = 1;
    final a flF;
    private ca flG = new ca();
    private bs flH = new bs();
    private e flI = new e();
    private cd flJ = new cd();
    private w flK = new w();
    private bd.a flL = new bd.a() {
        public final void a(bd bdVar, ad adVar) {
            AppMethodBeat.i(16279);
            String str = adVar.field_username;
            if (ad.mR(adVar.field_username)) {
                adVar.setUsername(ad.aoC(adVar.field_username));
            }
            if (bo.isNullOrNil(adVar.Ht())) {
                adVar.iC(com.tencent.mm.platformtools.g.vp(adVar.field_nickname));
            }
            if (bo.isNullOrNil(adVar.Hu())) {
                adVar.iD(com.tencent.mm.platformtools.g.vo(adVar.field_nickname));
            }
            if (bo.isNullOrNil(adVar.field_conRemarkPYShort)) {
                adVar.iG(com.tencent.mm.platformtools.g.vp(adVar.field_conRemark));
            }
            if (bo.isNullOrNil(adVar.field_conRemarkPYFull)) {
                adVar.iF(com.tencent.mm.platformtools.g.vo(adVar.field_conRemark));
            }
            if (t.e(adVar)) {
                adVar.hu(43);
                adVar.iC(com.tencent.mm.platformtools.g.vp(adVar.Oi()));
                adVar.iD(com.tencent.mm.platformtools.g.vo(adVar.Oi()));
                adVar.iF(com.tencent.mm.platformtools.g.vo(adVar.Oj()));
                adVar.iG(adVar.Oj());
                AppMethodBeat.o(16279);
                return;
            }
            if (t.nI(str)) {
                ad adVar2;
                adVar.NB();
                adVar.hz(4);
                adVar.hu(33);
                if (adVar == null) {
                    adVar2 = new ad();
                } else {
                    adVar2 = adVar;
                }
                adVar2.setUsername(str);
                adVar2.NB();
                ab.y(adVar2);
                adVar2.NK();
            }
            if (adVar.Oc()) {
                adVar.hu(adVar.Ny());
            }
            if (t.ny(str)) {
                ab.i("MicroMsg.MMCore", "update official account helper showhead %d", new Object[]{Integer.valueOf(31)});
                adVar.hu(31);
            }
            if (adVar.Oa()) {
                aw.ZK();
                c.XR().c(new String[]{str}, "@blacklist");
            }
            ab.d("MicroMsg.MMCore", "onPreInsertContact2: %s, %s", new Object[]{adVar.field_username, adVar.Ht()});
            AppMethodBeat.o(16279);
        }
    };
    private be.a flM = new 5(this);
    private be.a flN = new 6(this);
    private f flO = new f();
    private final c flr;

    static /* synthetic */ aw ZO() {
        AppMethodBeat.i(16313);
        aw ZH = ZH();
        AppMethodBeat.o(16313);
        return ZH;
    }

    static {
        AppMethodBeat.i(16314);
        AppMethodBeat.o(16314);
    }

    public static boolean ZD() {
        return flB == null;
    }

    public static void a(n nVar) {
        AppMethodBeat.i(16285);
        com.tencent.mm.kernel.g.RQ();
        com.tencent.mm.kernel.g.RO().a(nVar);
        AppMethodBeat.o(16285);
    }

    public static void b(n nVar) {
        AppMethodBeat.i(16286);
        com.tencent.mm.kernel.g.RQ();
        com.tencent.mm.kernel.g.RO().b(nVar);
        AppMethodBeat.o(16286);
    }

    public static void a(al alVar) {
        AppMethodBeat.i(16287);
        b.a(alVar);
        AppMethodBeat.o(16287);
    }

    public static void lE(String str) {
        AppMethodBeat.i(16288);
        com.tencent.mm.kernel.a.lE(str);
        AppMethodBeat.o(16288);
    }

    public static bw ZE() {
        AppMethodBeat.i(16289);
        ZH();
        bw bwVar = flD;
        AppMethodBeat.o(16289);
        return bwVar;
    }

    public static boolean ZF() {
        AppMethodBeat.i(16290);
        boolean QS = com.tencent.mm.kernel.a.QS();
        AppMethodBeat.o(16290);
        return QS;
    }

    public static void ZG() {
        AppMethodBeat.i(16291);
        com.tencent.mm.kernel.a.cm(false);
        AppMethodBeat.o(16291);
    }

    public static void a(am amVar, p.a aVar) {
        AppMethodBeat.i(16292);
        flB = new aw(amVar, aVar);
        o.ce(ah.getContext());
        AppMethodBeat.o(16292);
    }

    public static an getNotification() {
        AppMethodBeat.i(16293);
        an notification = ZH().flA.getNotification();
        AppMethodBeat.o(16293);
        return notification;
    }

    public static ae Cc() {
        AppMethodBeat.i(16294);
        ae Cc = ZH().flA.Cc();
        AppMethodBeat.o(16294);
        return Cc;
    }

    private aw(am amVar, p.a aVar) {
        AppMethodBeat.i(16295);
        this.flA = amVar;
        this.flF = new 1(this);
        com.tencent.mm.kernel.g.RQ();
        com.tencent.mm.kernel.g.a(a.class, new a(this));
        com.tencent.mm.kernel.g.RQ().eKp.aD(aVar);
        this.flr = new c();
        h.pYm.a(99, 142, 1, false);
        t.a(new 2(this));
        com.tencent.mm.kernel.g.RQ();
        b RO = com.tencent.mm.kernel.g.RO();
        RO.eJn.aD(new 3(this));
        AppMethodBeat.o(16295);
    }

    private static aw ZH() {
        AppMethodBeat.i(16296);
        Assert.assertNotNull("MMCore not initialized by MMApplication", flB);
        aw awVar = flB;
        AppMethodBeat.o(16296);
        return awVar;
    }

    public static y ZI() {
        AppMethodBeat.i(16297);
        com.tencent.mm.kernel.g.RQ();
        y yVar = com.tencent.mm.kernel.g.RP().eJH;
        AppMethodBeat.o(16297);
        return yVar;
    }

    @Deprecated
    public static al RS() {
        AppMethodBeat.i(16298);
        al RS = com.tencent.mm.kernel.g.RS();
        AppMethodBeat.o(16298);
        return RS;
    }

    public static bz getSysCmdMsgExtension() {
        AppMethodBeat.i(16299);
        bz sysCmdMsgExtension = ((com.tencent.mm.plugin.messenger.foundation.a.p) com.tencent.mm.kernel.g.M(com.tencent.mm.plugin.messenger.foundation.a.p.class)).getSysCmdMsgExtension();
        AppMethodBeat.o(16299);
        return sysCmdMsgExtension;
    }

    public static String Rb() {
        AppMethodBeat.i(16300);
        String Rb = com.tencent.mm.kernel.a.Rb();
        AppMethodBeat.o(16300);
        return Rb;
    }

    public static void ZJ() {
        AppMethodBeat.i(16301);
        com.tencent.mm.sdk.b.a.xxA.m(new aa());
        AppMethodBeat.o(16301);
    }

    public static c ZK() {
        AppMethodBeat.i(16302);
        c cVar = ZH().flr;
        Assert.assertTrue("MMCore has not been initialize ?", cVar != null);
        AppMethodBeat.o(16302);
        return cVar;
    }

    public static p Rg() {
        AppMethodBeat.i(16303);
        com.tencent.mm.kernel.g.RQ();
        p pVar = com.tencent.mm.kernel.g.RO().eJo;
        AppMethodBeat.o(16303);
        return pVar;
    }

    public static g ZL() {
        AppMethodBeat.i(16304);
        g KK = g.KK();
        AppMethodBeat.o(16304);
        return KK;
    }

    public static boolean ZM() {
        AppMethodBeat.i(16305);
        com.tencent.mm.kernel.g.RN();
        boolean QX = com.tencent.mm.kernel.a.QX();
        AppMethodBeat.o(16305);
        return QX;
    }

    public static boolean RK() {
        AppMethodBeat.i(16306);
        if (ah.bqo()) {
            boolean RK = com.tencent.mm.kernel.g.RK();
            AppMethodBeat.o(16306);
            return RK;
        }
        AppMethodBeat.o(16306);
        return false;
    }

    public static boolean QT() {
        AppMethodBeat.i(16307);
        boolean QT = com.tencent.mm.kernel.a.QT();
        AppMethodBeat.o(16307);
        return QT;
    }

    public static void hold() {
        AppMethodBeat.i(16308);
        com.tencent.mm.kernel.a.hold();
        AppMethodBeat.o(16308);
    }

    public static void unhold() {
        AppMethodBeat.i(16309);
        com.tencent.mm.kernel.a.unhold();
        AppMethodBeat.o(16309);
    }

    public static String QH() {
        AppMethodBeat.i(16310);
        com.tencent.mm.kernel.g.RQ();
        com.tencent.mm.kernel.g.RN();
        String QH = com.tencent.mm.kernel.a.QH();
        AppMethodBeat.o(16310);
        return QH;
    }

    public static f ZN() {
        AppMethodBeat.i(16311);
        f fVar = ZH().flO;
        AppMethodBeat.o(16311);
        return fVar;
    }
}
