package com.ss.android.ugc.aweme.live;

import X.0AP;
import X.0S6;
import X.143;
import X.8gF;
import X.C3901Gzm;
import X.C3905Gzq;
import X.C4286HEh;
import X.GP5;
import X.HD3;
import X.LsC;
import android.app.Activity;
import android.content.BroadcastReceiver;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import com.bytedance.apm.agent.v2.instrumentation.ActivityAgent;
import com.bytedance.covode.number.Covode;
import com.bytedance.ies.sdk.datachannel.DataChannelGlobal;
import com.bytedance.sysoptimizer.EnterTransitionCrashOptimizer;

public class LiveBgBroadcastActivity extends HD3 {
    public C3905Gzq LIZ;
    public 143 LIZIZ;
    public GP5 LIZJ = new GP5() {
        static {
            Covode.recordClassIndex(90945);
        }

        public final void LIZ(BroadcastReceiver broadcastReceiver) {
        }

        public final void LIZ(BroadcastReceiver broadcastReceiver, IntentFilter intentFilter) {
        }

        public final void LIZ(Bundle bundle) {
            LiveBgBroadcastActivity.this.LIZIZ = Live.getService().LIZ(bundle);
            0AP LIZ2 = LiveBgBroadcastActivity.this.getSupportFragmentManager().LIZ();
            LIZ2.LIZIZ(2131365158, LiveBgBroadcastActivity.this.LIZIZ.LIZ());
            LIZ2.LJ();
            LiveBgBroadcastActivity.this.LIZ = null;
        }
    };

    static {
        Covode.recordClassIndex(90944);
    }

    /* JADX WARNING: type inference failed for: r0v0, types: [com.ss.android.ugc.aweme.live.LiveBgBroadcastActivity, android.app.Activity, X.HD3] */
    public void onPause() {
        8gF.LIZJ(this);
        super.onPause();
    }

    /* JADX WARNING: type inference failed for: r3v0, types: [com.ss.android.ugc.aweme.live.LiveBgBroadcastActivity, android.app.Activity, X.HD3] */
    public void onResume() {
        8gF.LIZIZ(this);
        ActivityAgent.onTrace("com.ss.android.ugc.aweme.live.LiveBgBroadcastActivity", "onResume", true);
        super.onResume();
        ActivityAgent.onTrace("com.ss.android.ugc.aweme.live.LiveBgBroadcastActivity", "onResume", false);
    }

    /* JADX WARNING: type inference failed for: r0v0, types: [com.ss.android.ugc.aweme.live.LiveBgBroadcastActivity, X.SNU, android.app.Activity] */
    public void onStart() {
        8gF.LIZ(this);
        LiveBgBroadcastActivity.super.onStart();
    }

    public void onWindowFocusChanged(boolean z) {
        ActivityAgent.onTrace("com.ss.android.ugc.aweme.live.LiveBgBroadcastActivity", "onWindowFocusChanged", true);
        LiveBgBroadcastActivity.super.onWindowFocusChanged(z);
    }

    public void finish() {
        C3905Gzq gzq = this.LIZ;
        if (gzq != null) {
            gzq.LJIIJJI();
        }
        LiveBgBroadcastActivity.super.finish();
    }

    public void onBackPressed() {
        C3905Gzq gzq = this.LIZ;
        if (gzq == null || !gzq.LJIIL()) {
            LiveBgBroadcastActivity.super.onBackPressed();
        }
    }

    /* JADX WARNING: type inference failed for: r3v0, types: [com.ss.android.ugc.aweme.live.LiveBgBroadcastActivity, java.lang.Object, android.app.Activity, X.HD3] */
    public void onDestroy() {
        8gF.LJ(this);
        super.onDestroy();
        Live.getService().LIZ((Activity) null);
        ((LsC) DataChannelGlobal.LIZLLL.LIZIZ(C4286HEh.class)).invoke(0);
        this.LIZJ = null;
        Live.getService().LJIL().LIZIZ(hashCode());
    }

    /* JADX WARNING: type inference failed for: r1v0, types: [com.ss.android.ugc.aweme.live.LiveBgBroadcastActivity, X.SNU, android.app.Activity] */
    public void onStop() {
        8gF.LIZLLL(this);
        LiveBgBroadcastActivity.super.onStop();
        if (EnterTransitionCrashOptimizer.getContext() != null) {
            try {
                getWindow().getDecorView().getViewTreeObserver().dispatchOnPreDraw();
            } catch (Throwable unused) {
            }
        }
        try {
            getWindow().getDecorView().getViewTreeObserver().dispatchOnPreDraw();
        } catch (Throwable unused2) {
        }
    }

    public static Bundle LIZ(Intent intent) {
        try {
            return intent.getExtras();
        } catch (Exception unused) {
            return null;
        }
    }

    public void onSaveInstanceState(Bundle bundle) {
        LiveBgBroadcastActivity.super.onSaveInstanceState(bundle);
        bundle.clear();
    }

    /* JADX WARNING: type inference failed for: r1v0, types: [X.4Qh, com.ss.android.ugc.aweme.live.LiveBgBroadcastActivity, android.app.Activity] */
    public void onNewIntent(Intent intent) {
        LiveBgBroadcastActivity.super.onNewIntent(intent);
        C3901Gzm.LIZ.LIZ((Activity) this, intent);
    }

    /* JADX WARNING: type inference failed for: r7v0, types: [X.0CH, X.1hK, com.ss.android.ugc.aweme.live.LiveBgBroadcastActivity, X.SNU, java.lang.Object, android.app.Activity, X.HD3] */
    public void onCreate(Bundle bundle) {
        8gF.LIZ(this, bundle);
        ActivityAgent.onTrace("com.ss.android.ugc.aweme.live.LiveBgBroadcastActivity", "onCreate", true);
        super.onCreate(bundle);
        if (bundle != null) {
            bundle.remove("android:support:fragments");
        }
        0S6.LJFF.LIZ();
        ((LsC) DataChannelGlobal.LIZLLL.LIZIZ(C4286HEh.class)).invoke(2);
        setContentView(2131560542);
        if (getWindow() != null) {
            getWindow().addFlags(128);
        }
        new Bundle();
        if (getIntent() != null) {
            Bundle LIZ2 = LIZ(getIntent());
            int intExtra = getIntent().getIntExtra("broadcast_type", 0);
            if (intExtra == 2) {
                this.LIZ = Live.getService().LIZJ(this.LIZJ, LIZ2);
            } else if (intExtra == 3) {
                this.LIZ = Live.getService().LIZIZ(this.LIZJ, LIZ2);
            } else if (intExtra == 4) {
                this.LIZ = Live.getService().LIZLLL(this.LIZJ, LIZ2);
            }
        }
        if (this.LIZ != null) {
            0AP LIZ3 = getSupportFragmentManager().LIZ();
            Live.getService().LJIL().LIZ(hashCode(), this);
            LIZ3.LIZIZ(2131365158, this.LIZ.LJIIJ());
            LIZ3.LIZIZ();
            Live.getService().LIZ((Activity) this);
        } else {
            finish();
        }
        ActivityAgent.onTrace("com.ss.android.ugc.aweme.live.LiveBgBroadcastActivity", "onCreate", false);
    }
}
