package com.ss.android.ugc.aweme.ug.appstart;

import X.2GO;
import X.2HZ;
import X.4Cy;
import X.7he;
import X.9Hj;
import X.C0295Crj;
import X.C4836EnQ;
import X.CuL;
import X.EMX;
import X.FB6;
import X.FDA;
import X.FDB;
import X.FDC;
import X.ISm;
import X.M12;
import X.RTW;
import X.Rc9;
import X.SNU;
import android.app.Activity;
import android.content.Intent;
import android.content.res.Configuration;
import android.os.Bundle;
import android.os.SystemClock;
import com.bytedance.covode.number.Covode;
import com.ss.android.ugc.aweme.base.MainBusinessAbility;
import com.ss.android.ugc.aweme.feed.model.Aweme;
import com.ss.android.ugc.aweme.main.IPerformanceAbility;
import java.util.HashMap;
import java.util.Map;
import kotlin.h.b.n;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.ThreadMode;

public final class MainActivityHelperAssem extends C4836EnQ implements 2HZ, 2GO {
    public final C0295Crj LJFF = 7he.LIZ(new FDB(this));

    static {
        Covode.recordClassIndex(120889);
    }

    public final Activity LJIJJ() {
        return (Activity) this.LJFF.getValue();
    }

    public final Map<Integer, Object> getSubscriberEventTypes() {
        HashMap hashMap = new HashMap();
        hashMap.put(30, new Rc9(MainActivityHelperAssem.class, "onPublishMessage", FB6.class, ThreadMode.MAIN, -1, true));
        return hashMap;
    }

    public final void LJIILLIIL() {
        super.LJIILLIIL();
        EventBus.LIZ().LIZIZ(this);
    }

    public final void LJIIJ() {
        super.LJIIJ();
        Activity LJIJJ = LJIJJ();
        if (!(LJIJJ instanceof SNU)) {
            LJIJJ = null;
        }
        SNU snu = (SNU) LJIJJ;
        if (snu != null) {
            if (!EMX.LIZJ(EMX.LIZ((CuL) this), MainBusinessAbility.class).LIZ()) {
                9Hj.LJ.LIZ(snu, false, "");
            }
            FDC.LIZJ.LIZ(snu);
        }
    }

    public final void LIZ(Intent intent) {
        M12.LIZ(intent);
        super.LIZ(intent);
        FDC.LIZJ.LIZ(intent);
    }

    public final void LIZ(Configuration configuration) {
        M12.LIZ(configuration);
        super.LIZ(configuration);
        Activity LJIJJ = LJIJJ();
        if (!(LJIJJ instanceof SNU)) {
            LJIJJ = null;
        }
        SNU snu = (SNU) LJIJJ;
        if (snu != null) {
            FDC.LIZJ.LIZIZ(snu);
        }
    }

    public final void LIZ(Bundle bundle) {
        long uptimeMillis = SystemClock.uptimeMillis();
        super.LIZ(bundle);
        Activity LJIJJ = LJIJJ();
        if (!(LJIJJ instanceof SNU)) {
            LJIJJ = null;
        }
        SNU snu = (SNU) LJIJJ;
        if (snu != null) {
            FDC.LIZJ.LIZ(snu, bundle);
            EventBus.LIZ(EventBus.LIZ(), this);
            EMX.LIZJ(EMX.LIZ((CuL) this), IPerformanceAbility.class).LIZ(new FDA(this));
        }
        4Cy.LIZ(getClass().getCanonicalName(), SystemClock.uptimeMillis() - uptimeMillis, "ON_CREATE_WITH_BUNDLE", (String) null);
    }

    @ISm(LIZ = ThreadMode.MAIN, LIZIZ = true, LIZJ = -1)
    public final void onPublishMessage(FB6 fb6) {
        M12.LIZ(fb6);
        int i = fb6.LIZ;
        if (i == -1) {
            EMX.LIZJ(EMX.LIZ((CuL) this), MainBusinessAbility.class).LIZIZ("page_feed");
            RTW.LIZIZ.LIZ("start_upload", (String) null);
        } else if (i != 1) {
            if (i == 2) {
                RTW rtw = RTW.LIZIZ;
                Aweme aweme = fb6.LIZLLL;
                n.LIZIZ(aweme, "");
                rtw.LIZIZ(aweme.getAid());
            }
        } else if (fb6.LJ) {
            EMX.LIZJ(EMX.LIZ((CuL) this), MainBusinessAbility.class).LIZIZ("page_feed");
            RTW.LIZIZ.LIZ("start_upload", (String) null);
        }
        EventBus.LIZ().LJFF(fb6);
    }

    public final void LIZ(boolean z, boolean z2) {
        super.LIZ(z, z2);
        Activity LJIJJ = LJIJJ();
        if (!(LJIJJ instanceof SNU)) {
            LJIJJ = null;
        }
        SNU snu = (SNU) LJIJJ;
        if (snu != null) {
            FDC.LIZJ.LIZ(snu, z);
        }
    }

    public final boolean LIZ(int i, int i2, Intent intent) {
        super.LIZ(i, i2, intent);
        Activity LJIJJ = LJIJJ();
        if (!(LJIJJ instanceof SNU)) {
            LJIJJ = null;
        }
        SNU snu = (SNU) LJIJJ;
        if (snu == null) {
            return false;
        }
        FDC.LIZJ.LIZ(snu, i, i2, intent);
        return false;
    }
}
