package com.bytedance.android.livesdk.chatroom.ui;

import X.0HH;
import X.0UO;
import X.0Uz;
import X.0VN;
import X.0VO;
import X.0VP;
import X.0Vi;
import X.0Vk;
import X.0Vl;
import X.0Vm;
import X.0W8;
import X.0WE;
import X.0WT;
import X.0Wd;
import X.0XQ;
import X.0Xi;
import X.0Xm;
import X.0Xo;
import X.0YC;
import X.0aP;
import X.0b0;
import X.0bT;
import X.0bX;
import X.0bg;
import X.0bh;
import X.0c0;
import X.0cm;
import X.0zp;
import X.10H;
import X.10Y;
import X.142;
import X.158;
import X.1JZ;
import X.1Jy;
import X.1K6;
import X.1K7;
import X.1KB;
import X.1KC;
import X.1Mn;
import X.1Ol;
import X.1hK;
import X.1jk;
import X.1rH;
import X.1rI;
import X.1sP;
import X.2Pr;
import X.2cN;
import X.2sR;
import X.2us;
import X.3i8;
import X.7AW;
import X.7vl;
import X.88r;
import X.C1393G1a;
import X.C1430G2l;
import X.C1781GFy;
import X.C1856GIv;
import X.C2027GPk;
import X.C2028GPl;
import X.C2030GPn;
import X.C2034GPr;
import X.C2037GPu;
import X.C2038GPv;
import X.C2039GPw;
import X.C2040GPx;
import X.C2052GQj;
import X.C2053GQk;
import X.C2385GbK;
import X.C2409Gbi;
import X.C3028Glh;
import X.C3318GqN;
import X.C3491GtA;
import X.C3905Gzq;
import X.C4100H7d;
import X.C4307HFc;
import X.C4453HKs;
import X.C5112HeD;
import X.Crj;
import X.DBT;
import X.GMD;
import X.GP5;
import X.GPL;
import X.GPU;
import X.GPZ;
import X.GQ5;
import X.GQA;
import X.GQE;
import X.GQJ;
import X.GQK;
import X.GQN;
import X.GQO;
import X.GQP;
import X.GQR;
import X.GSE;
import X.HEP;
import X.HEY;
import X.HFO;
import X.HIR;
import X.LsC;
import X.M12;
import X.Mjy;
import X.Mk2;
import X.Mk3;
import X.PgU;
import android.animation.Animator;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.app.Dialog;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.ServiceConnection;
import android.content.res.Configuration;
import android.graphics.drawable.Drawable;
import android.media.projection.MediaProjectionManager;
import android.os.Build;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.ImageView;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import com.bytedance.android.live.base.model.user.User;
import com.bytedance.android.live.broadcast.BaseBroadcastFragment;
import com.bytedance.android.live.broadcast.api.IBroadcastService;
import com.bytedance.android.live.publicscreen.api.IPublicScreenService;
import com.bytedance.android.livesdk.game.model.AccessRecallMessage;
import com.bytedance.android.livesdk.livesetting.broadcast.BroadcastInteractionLibraSetting;
import com.bytedance.android.livesdk.livesetting.broadcast.EnableTTCaptureSetting;
import com.bytedance.android.livesdk.livesetting.game.ExceptionInfo;
import com.bytedance.android.livesdk.livesetting.game.GameBgInterruptServiceRestart;
import com.bytedance.android.livesdk.livesetting.game.GameBroadcastExceptionConfig;
import com.bytedance.android.livesdk.livesetting.game.GameBroadcastExceptionConfigSetting;
import com.bytedance.android.livesdk.livesetting.game.GameBroadcastInterruptErrorResumeSetting;
import com.bytedance.android.livesdk.livesetting.game.GameBroadcastOnStopUnbindServiceSetting;
import com.bytedance.android.livesdk.livesetting.game.GameLiveBgContentSafetyExp;
import com.bytedance.android.livesdk.livesetting.other.LiveImageLoaderModuleSetting;
import com.bytedance.android.livesdkapi.depend.model.live.Room;
import com.bytedance.android.livesdkapi.host.IHostApp;
import com.bytedance.android.livesdkapi.message.LiveMessageID;
import com.bytedance.android.livesdkapi.message.LiveMessageSEI;
import com.bytedance.android.message.IMessageService;
import com.bytedance.bpea.basics.Cert;
import com.bytedance.bpea.basics.PrivacyCert$Builder;
import com.bytedance.bpea.cert.token.TokenCert;
import com.bytedance.bpea.store.policy.PrivacyPolicyStore;
import com.bytedance.covode.number.Covode;
import com.bytedance.ies.sdk.datachannel.DataChannel;
import com.bytedance.ies.sdk.datachannel.DataChannelGlobal;
import com.bytedance.ies.sdk.widgets.LiveWidgetProvider;
import com.ss.avframework.livestreamv2.core.LiveCore;
import com.ss.ugc.live.sdk.message.interfaces.IMessageManager;
import com.ss.ugc.live.sdk.message.interfaces.OnMessageListener;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.Map;
import java.util.concurrent.CancellationException;
import java.util.concurrent.TimeUnit;
import kotlin.h.b.n;
import org.json.JSONException;
import org.json.JSONObject;

public final class GameBroadcastFragment extends BaseBroadcastFragment implements 0VO, 0Vl, C3905Gzq, GSE {
    public static final GQJ LJIL = new GQJ((byte) 0);
    public GP5 LJ;
    public boolean LJFF;
    public boolean LJI = true;
    public 0Vk LJII;
    public 0XQ LJIIIIZZ;
    public 0Xm LJIIIZ;
    public 0Xo LJIIJ;
    public 1KC LJIIJJI;
    public 1Jy LJIIL;
    public 142 LJIILIIL;
    public long LJIILJJIL;
    public AccessRecallMessage LJIILL;
    public Intent LJIILLIIL;
    public DBT LJIIZILJ;
    public DBT LJIJ;
    public boolean LJIJI;
    public GQN LJIJJ;
    public Mjy LJIJJLI = new Mjy();
    public boolean LJJ;
    public boolean LJJI;
    public boolean LJJIFFI;
    public 0Vm LJJII;
    public 0Vi LJJIII;
    public IMessageManager LJJIIJ;
    public OnMessageListener LJJIIJZLJL;
    public final Crj LJJIIZ = 7vl.LIZ(GQA.LIZ);
    public final Runnable LJJIIZI = new GQE(this);
    public final Crj LJJIJ = 7vl.LIZ(new GQK(this));
    public final ServiceConnection LJJIJIIJI = new GPL(this);
    public HashMap LJJIJIIJIL;

    static {
        Covode.recordClassIndex(13910);
    }

    private final BroadcastReceiver LJJ() {
        return (BroadcastReceiver) this.LJJIJ.getValue();
    }

    public final View LIZ(int i) {
        if (this.LJJIJIIJIL == null) {
            this.LJJIJIIJIL = new HashMap();
        }
        View view = (View) this.LJJIJIIJIL.get(Integer.valueOf(i));
        if (view != null) {
            return view;
        }
        View view2 = getView();
        if (view2 == null) {
            return null;
        }
        View findViewById = view2.findViewById(i);
        this.LJJIJIIJIL.put(Integer.valueOf(i), findViewById);
        return findViewById;
    }

    public final void LIZ(double d, double d2, double d3) {
    }

    public final void LIZ(LiveCore liveCore) {
    }

    public final void LIZJ() {
    }

    public final void LIZLLL() {
    }

    public final void LJIILL() {
        HashMap hashMap = this.LJJIJIIJIL;
        if (hashMap != null) {
            hashMap.clear();
        }
    }

    public final void LJIILLIIL() {
    }

    public final void LJIIZILJ() {
    }

    public final void LJIJ() {
    }

    public final void LJIJI() {
    }

    public final LinkedList<Runnable> LJIJJ() {
        return (LinkedList) this.LJJIIZ.getValue();
    }

    public final /* synthetic */ void onDestroyView() {
        GameBroadcastFragment.super.onDestroyView();
        LJIILL();
    }

    /* JADX WARNING: Removed duplicated region for block: B:63:0x0221  */
    /* JADX WARNING: Removed duplicated region for block: B:76:0x02ae  */
    /* JADX WARNING: Removed duplicated region for block: B:83:? A[RETURN, SYNTHETIC] */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public final void LIZ(android.os.Bundle r14) {
        /*
            r13 = this;
            com.bytedance.android.livesdk.chatroom.ui.GameBroadcastFragment.super.LIZ(r14)
            android.content.Context r0 = r13.getContext()
            r5 = 0
            if (r0 == 0) goto L_0x02c9
            X.06Q r0 = X.06Q.LIZ(r0)
            boolean r0 = r0.LIZ()
            java.lang.Boolean r0 = java.lang.Boolean.valueOf(r0)
        L_0x0016:
            java.lang.String r1 = java.lang.String.valueOf(r0)
            java.lang.String r0 = "onLiveCreate , isNoticationEnable = "
            java.lang.String r0 = r0.concat(r1)
            r13.LIZ((java.lang.String) r0)
            long r0 = java.lang.System.currentTimeMillis()
            r13.LJIILJJIL = r0
            X.M12.LIZ(r13)
            X.DBT r0 = r13.LJIIZILJ
            if (r0 == 0) goto L_0x0033
            r0.LIZ(r5)
        L_0x0033:
            com.bytedance.ies.sdk.datachannel.DataChannelGlobal r1 = com.bytedance.ies.sdk.datachannel.DataChannelGlobal.LIZLLL
            java.lang.Class<X.HEa> r0 = X.C4279HEa.class
            java.lang.Object r0 = r1.LIZIZ(r0)
            X.0Yn r0 = (X.0Yn) r0
            r9 = 0
            if (r0 == 0) goto L_0x02c6
            java.lang.Boolean r0 = r0.LIZIZ
            if (r0 == 0) goto L_0x02c6
            boolean r12 = r0.booleanValue()
        L_0x0048:
            com.bytedance.ies.sdk.datachannel.DataChannelGlobal r1 = com.bytedance.ies.sdk.datachannel.DataChannelGlobal.LIZLLL
            java.lang.Class<X.HEQ> r0 = X.HEQ.class
            java.lang.Object r0 = r1.LIZIZ(r0)
            java.lang.Integer r0 = (java.lang.Integer) r0
            if (r0 == 0) goto L_0x02c3
            int r0 = r0.intValue()
        L_0x0058:
            r4 = 1
            if (r0 != r4) goto L_0x02c0
            r11 = 1
        L_0x005c:
            com.bytedance.android.livesdk.livesetting.broadcast.LiveNewGameBroadcastTeachToastSetting r0 = com.bytedance.android.livesdk.livesetting.broadcast.LiveNewGameBroadcastTeachToastSetting.INSTANCE
            boolean r2 = r0.enableNewGameBroadcastTeachToast()
            X.2sR<java.lang.Boolean> r0 = X.C1781GFy.LJJJJL
            java.lang.String r3 = ""
            kotlin.h.b.n.LIZIZ(r0, r3)
            java.lang.Object r1 = r0.LIZ()
            java.lang.Boolean r1 = (java.lang.Boolean) r1
            boolean r0 = X.C2409Gbi.LJFF
            r8 = 4
            java.lang.String r10 = ", enableTeachToast="
            java.lang.String r7 = "GameBroadcastFragment"
            if (r0 == 0) goto L_0x009f
            java.lang.StringBuilder r6 = new java.lang.StringBuilder
            java.lang.String r0 = "tryShowWeakDeviceTips. hadGameLive="
            r6.<init>(r0)
            r6.append(r12)
            java.lang.String r0 = ", isWeakDevice="
            r6.append(r0)
            r6.append(r11)
            r6.append(r10)
            r6.append(r2)
            java.lang.String r0 = ", hadShow="
            r6.append(r0)
            r6.append(r1)
            java.lang.String r0 = r6.toString()
            X.0aP.LIZ(r8, r7, r0)
        L_0x009f:
            r6 = 2
            if (r2 == 0) goto L_0x00bb
            if (r11 == 0) goto L_0x00bb
            if (r12 != 0) goto L_0x00bb
            boolean r0 = r1.booleanValue()
            if (r0 != 0) goto L_0x00bb
            X.3SC r2 = X.3SC.LIZ
            X.4VH r1 = X.8pz.LIZIZ
            X.28S r0 = new X.28S
            r0.<init>(r5)
            X.DBT r0 = X.DAe.LIZ(r2, r1, r0, r6)
            r13.LJIIZILJ = r0
        L_0x00bb:
            X.M12.LIZ(r13)
            X.DBT r0 = r13.LJIJ
            if (r0 == 0) goto L_0x00c5
            r0.LIZ(r5)
        L_0x00c5:
            com.bytedance.ies.sdk.datachannel.DataChannelGlobal r1 = com.bytedance.ies.sdk.datachannel.DataChannelGlobal.LIZLLL
            java.lang.Class<X.HEa> r0 = X.C4279HEa.class
            java.lang.Object r0 = r1.LIZIZ(r0)
            X.0Yn r0 = (X.0Yn) r0
            if (r0 == 0) goto L_0x00d9
            java.lang.Boolean r0 = r0.LIZIZ
            if (r0 == 0) goto L_0x00d9
            boolean r9 = r0.booleanValue()
        L_0x00d9:
            com.bytedance.android.livesdk.livesetting.broadcast.LiveNewGameBroadcastTeachToastSetting r0 = com.bytedance.android.livesdk.livesetting.broadcast.LiveNewGameBroadcastTeachToastSetting.INSTANCE
            boolean r2 = r0.enableNewGameBroadcastTeachToast()
            boolean r0 = X.C2409Gbi.LJFF
            if (r0 == 0) goto L_0x00fa
            java.lang.StringBuilder r1 = new java.lang.StringBuilder
            java.lang.String r0 = "tryShowStartGameLive2MinTipsTask. hadGameLive2min="
            r1.<init>(r0)
            r1.append(r9)
            r1.append(r10)
            r1.append(r2)
            java.lang.String r0 = r1.toString()
            X.0aP.LIZ(r8, r7, r0)
        L_0x00fa:
            if (r2 == 0) goto L_0x010d
            if (r9 != 0) goto L_0x010d
            X.3SC r2 = X.3SC.LIZ
            X.4VH r1 = X.8pz.LIZIZ
            X.28R r0 = new X.28R
            r0.<init>(r13, r5)
            X.DBT r0 = X.DAe.LIZ(r2, r1, r0, r6)
            r13.LJIJ = r0
        L_0x010d:
            com.bytedance.android.livesdk.log.monitor.IPerformanceManager r0 = com.bytedance.android.livesdk.performance.LivePerformanceManager.getInstance()
            r0.setIsAnchor(r4)
            X.1KC r6 = new X.1KC
            com.bytedance.android.livesdkapi.depend.model.live.Room r1 = r13.q_()
            com.bytedance.ies.sdk.datachannel.DataChannel r0 = r13.p_()
            r6.<init>(r1, r13, r0)
            X.GJ2 r0 = X.GJ2.GAME
            r0.config()
            com.bytedance.ies.sdk.datachannel.DataChannel r2 = r6.LJJIJ
            java.lang.Class<X.2Cf> r1 = X.2Cf.class
            X.1rJ r0 = new X.1rJ
            r0.<init>(r6)
            r2.LIZ((java.lang.Object) r6, r1, r0)
            com.bytedance.ies.sdk.datachannel.DataChannel r2 = r6.LJJIJ
            java.lang.Class<X.2Cd> r1 = X.2Cd.class
            X.1rK r0 = new X.1rK
            r0.<init>(r6)
            r2.LIZ((java.lang.Object) r6, r1, r0)
            com.bytedance.ies.sdk.datachannel.DataChannel r2 = r6.LJJIJ
            java.lang.Class<X.Fx4> r1 = X.C1185Fx4.class
            X.1rL r0 = new X.1rL
            r0.<init>(r6)
            r2.LIZ((java.lang.Object) r6, r1, r0)
            com.bytedance.ies.sdk.datachannel.DataChannel r2 = r6.LJJIJ
            java.lang.Class<X.GcS> r1 = X.C2455GcS.class
            X.1rM r0 = new X.1rM
            r0.<init>(r6)
            r2.LIZ((java.lang.Object) r6, r1, r0)
            X.0WV r7 = r6.LJJII
            com.bytedance.ies.sdk.datachannel.DataChannel r2 = r6.LJJIJ
            X.M12.LIZ(r2)
            java.lang.Class<X.GQV> r1 = X.GQV.class
            X.1r6 r0 = new X.1r6
            r0.<init>(r7)
            r2.LIZ((java.lang.Object) r7, r1, r0)
            com.bytedance.android.livesdk.livesetting.broadcast.LiveEnableGiftRecordFilter r0 = com.bytedance.android.livesdk.livesetting.broadcast.LiveEnableGiftRecordFilter.INSTANCE
            boolean r0 = r0.isEnable()
            if (r0 == 0) goto L_0x0188
            java.lang.Class<com.bytedance.android.live.publicscreen.api.IPublicScreenService> r0 = com.bytedance.android.live.publicscreen.api.IPublicScreenService.class
            X.0UT r1 = X.0cm.LIZ(r0)
            com.bytedance.android.live.publicscreen.api.IPublicScreenService r1 = (com.bytedance.android.live.publicscreen.api.IPublicScreenService) r1
            com.bytedance.ies.sdk.datachannel.DataChannel r0 = r6.LJJIJ
            X.10H r2 = r1.getGiftHistoryManager(r0)
            if (r2 == 0) goto L_0x02bd
            com.bytedance.ies.sdk.datachannel.DataChannel r1 = r6.LJJIJ
            java.lang.Class<X.2CY> r0 = X.2CY.class
            r1.LIZIZ(r0, r2)
        L_0x0186:
            r6.LJJIII = r2
        L_0x0188:
            boolean r0 = r6.LIZIZ
            if (r0 == 0) goto L_0x01a3
            java.lang.Class<com.bytedance.android.live.publicscreen.api.IPublicScreenService> r0 = com.bytedance.android.live.publicscreen.api.IPublicScreenService.class
            X.0UT r1 = X.0cm.LIZ(r0)
            com.bytedance.android.live.publicscreen.api.IPublicScreenService r1 = (com.bytedance.android.live.publicscreen.api.IPublicScreenService) r1
            com.bytedance.ies.sdk.datachannel.DataChannel r0 = r6.LJJIJ
            X.10Y r0 = r1.getNewMessageListener(r0)
            r6.LIZ = r0
            X.10Y r0 = r6.LIZ
            if (r0 == 0) goto L_0x01a3
            r0.LIZ()
        L_0x01a3:
            r13.LJIIJJI = r6
            X.1Jy r2 = new X.1Jy
            android.content.Context r1 = r13.getContext()
            com.bytedance.android.livesdkapi.depend.model.live.Room r0 = r13.q_()
            r2.<init>(r1, r0)
            r13.LJIIL = r2
            r0 = r13
            r2.LIZJ = r0
            java.lang.Class<com.bytedance.android.live.broadcast.api.IBroadcastService> r0 = com.bytedance.android.live.broadcast.api.IBroadcastService.class
            X.0UT r1 = X.0cm.LIZ(r0)
            com.bytedance.android.live.broadcast.api.IBroadcastService r1 = (com.bytedance.android.live.broadcast.api.IBroadcastService) r1
            com.bytedance.android.livesdkapi.depend.model.live.Room r0 = r13.q_()
            X.0Vi r1 = r1.createStatusReporter(r0)
            X.GPN r0 = new X.GPN
            r0.<init>(r13)
            r1.LIZ(r0)
            kotlin.h.b.n.LIZIZ(r1, r3)
            r13.LJJIII = r1
            X.0Xo r1 = new X.0Xo
            X.0Vi r0 = r13.LJJIII
            if (r0 != 0) goto L_0x01dd
            kotlin.h.b.n.LIZ(r3)
        L_0x01dd:
            r1.<init>(r0)
            r13.LJIIJ = r1
            com.bytedance.ies.sdk.datachannel.DataChannel r1 = r13.p_()
            java.lang.Class<X.HGo> r0 = X.C4345HGo.class
            java.lang.Object r2 = r1.LIZIZ(r0)
            com.ss.ugc.live.sdk.message.interfaces.IMessageManager r2 = (com.ss.ugc.live.sdk.message.interfaces.IMessageManager) r2
            if (r2 != 0) goto L_0x0213
            java.lang.Class<com.bytedance.android.message.IMessageService> r0 = com.bytedance.android.message.IMessageService.class
            X.0UT r3 = X.0cm.LIZ(r0)
            com.bytedance.android.message.IMessageService r3 = (com.bytedance.android.message.IMessageService) r3
            com.bytedance.android.livesdkapi.depend.model.live.Room r0 = r13.q_()
            long r1 = r0.getId()
            android.content.Context r0 = r13.getContext()
            com.ss.ugc.live.sdk.message.interfaces.IMessageManager r2 = r3.messageManagerProvider(r1, r4, r0)
            if (r2 == 0) goto L_0x0214
            com.bytedance.ies.sdk.datachannel.DataChannel r1 = r13.p_()
            java.lang.Class<X.HGo> r0 = X.C4345HGo.class
            r1.LIZ(r0, r2)
        L_0x0213:
            r5 = r2
        L_0x0214:
            r13.LJJIIJ = r5
            X.GPO r0 = new X.GPO
            r0.<init>(r13)
            r13.LJJIIJZLJL = r0
            com.ss.ugc.live.sdk.message.interfaces.IMessageManager r2 = r13.LJJIIJ
            if (r2 == 0) goto L_0x022c
            X.HKs r0 = X.C4453HKs.ACCESS_RECALL_MESSAGE
            int r1 = r0.getIntType()
            com.ss.ugc.live.sdk.message.interfaces.OnMessageListener r0 = r13.LJJIIJZLJL
            r2.addMessageListener(r1, r0)
        L_0x022c:
            com.bytedance.ies.sdk.datachannel.DataChannelGlobal r2 = com.bytedance.ies.sdk.datachannel.DataChannelGlobal.LIZLLL
            r4 = r13
            java.lang.Class<X.HGS> r1 = X.HGS.class
            X.GKN r0 = new X.GKN
            r0.<init>(r13)
            r2.LIZ(r13, r4, r1, r0)
            com.bytedance.ies.sdk.datachannel.DataChannelGlobal r3 = com.bytedance.ies.sdk.datachannel.DataChannelGlobal.LIZLLL
            java.lang.Class<X.HFy> r2 = X.C4329HFy.class
            long r0 = java.lang.System.currentTimeMillis()
            java.lang.Long r0 = java.lang.Long.valueOf(r0)
            r3.LIZIZ(r2, r0)
            java.lang.Class<com.bytedance.android.live.livepullstream.api.IPullStreamService> r0 = com.bytedance.android.live.livepullstream.api.IPullStreamService.class
            X.0UT r0 = X.0cm.LIZ(r0)
            com.bytedance.android.live.livepullstream.api.IPullStreamService r0 = (com.bytedance.android.live.livepullstream.api.IPullStreamService) r0
            if (r0 == 0) goto L_0x025b
            X.145 r0 = r0.getLiveStreamStrategy()
            if (r0 == 0) goto L_0x025b
            r0.LIZ()
        L_0x025b:
            com.bytedance.ies.sdk.datachannel.DataChannel r2 = r13.p_()
            java.lang.Class<X.Gcg> r1 = X.C2469Gcg.class
            X.GQ0 r0 = new X.GQ0
            r0.<init>(r13)
            r2.LIZ((X.0CH) r4, r1, r0)
            java.lang.Class<X.Gcu> r1 = X.C2483Gcu.class
            X.GPW r0 = new X.GPW
            r0.<init>(r13)
            r2.LIZ((X.0CH) r4, r1, r0)
            r13.LJJIIJZLJL()
            X.0Xm r0 = new X.0Xm
            r0.<init>()
            r13.LJIIIZ = r0
            X.GQN r1 = new X.GQN
            X.0Xm r0 = r13.LJIIIZ
            r1.<init>(r0)
            r13.LJIJJ = r1
            com.bytedance.android.livesdk.livesetting.game.GameBgInterruptServiceRestart r0 = com.bytedance.android.livesdk.livesetting.game.GameBgInterruptServiceRestart.INSTANCE
            boolean r0 = r0.getValue()
            if (r0 == 0) goto L_0x02a6
            android.content.Context r0 = r13.getContext()
            if (r0 == 0) goto L_0x02a6
            androidx.localbroadcastmanager.content.LocalBroadcastManager r3 = androidx.localbroadcastmanager.content.LocalBroadcastManager.getInstance(r0)
            android.content.BroadcastReceiver r2 = r13.LJJ()
            android.content.IntentFilter r1 = new android.content.IntentFilter
            java.lang.String r0 = "ACTION_SERVICE_START_FOREGROUND_END"
            r1.<init>(r0)
            r3.registerReceiver(r2, r1)
        L_0x02a6:
            com.bytedance.android.livesdk.livesetting.game.GameLiveBgContentSafetyExp r0 = com.bytedance.android.livesdk.livesetting.game.GameLiveBgContentSafetyExp.INSTANCE
            boolean r0 = r0.enable()
            if (r0 == 0) goto L_0x02bc
            com.bytedance.ies.sdk.datachannel.DataChannel r2 = r13.p_()
            java.lang.Class<X.GQW> r1 = X.GQW.class
            X.GPP r0 = new X.GPP
            r0.<init>(r13)
            r2.LIZ((java.lang.Object) r13, r1, r0)
        L_0x02bc:
            return
        L_0x02bd:
            r2 = r5
            goto L_0x0186
        L_0x02c0:
            r11 = 0
            goto L_0x005c
        L_0x02c3:
            r0 = 0
            goto L_0x0058
        L_0x02c6:
            r12 = 0
            goto L_0x0048
        L_0x02c9:
            r0 = r5
            goto L_0x0016
        */
        throw new UnsupportedOperationException("Method not decompiled: com.bytedance.android.livesdk.chatroom.ui.GameBroadcastFragment.LIZ(android.os.Bundle):void");
    }

    public final void LIZ(View view, Bundle bundle) {
        int i;
        1sP r0;
        int i2;
        M12.LIZ(view);
        GameBroadcastFragment.super.LIZ(view, bundle);
        Room q_ = q_();
        if (q_ != null) {
            0cm.LIZ(IPublicScreenService.class).onStartStreaming(q_.getId());
        }
        1KC r6 = this.LJIIJJI;
        if (r6 != null) {
            1hK r1 = r6.LIZJ;
            r6.LJIJI = r1 != null ? (1sP) r1.findViewById(2131362589) : null;
            float LIZ = (float) (C5112HeD.LIZ((Context) r6.LIZJ) / C5112HeD.LIZIZ(r6.LIZJ));
            1hK r12 = r6.LIZJ;
            ImageView imageView = r12 != null ? (ImageView) r12.findViewById(2131366559) : null;
            if (imageView != null) {
                boolean isExperimentGroup = BroadcastInteractionLibraSetting.INSTANCE.isExperimentGroup();
                if (isExperimentGroup) {
                    i2 = 0;
                } else if (!isExperimentGroup) {
                    i2 = 8;
                } else {
                    throw new 7AW();
                }
                imageView.setVisibility(i2);
            }
            if (r6.LJJIIZ.background != null) {
                if (Build.VERSION.SDK_INT >= 23 && (r0 = r6.LJIJI) != null) {
                    r0.setForeground((Drawable) null);
                }
                C2385GbK LIZ2 = 0bg.LIZ();
                0bh.LIZ(LIZ2, r6.LJJIIZ.background);
                LIZ2.LIZ((View) r6.LJIJI);
                return;
            }
            boolean isExperimentGroup2 = BroadcastInteractionLibraSetting.INSTANCE.isExperimentGroup();
            if (isExperimentGroup2) {
                i = 80;
            } else if (!isExperimentGroup2) {
                i = 5;
            } else {
                throw new 7AW();
            }
            if (LiveImageLoaderModuleSetting.useImageModule()) {
                C2385GbK LIZ3 = 0bg.LIZ();
                User owner = r6.LJJIIZ.getOwner();
                n.LIZIZ(owner, "");
                0bh.LIZ(LIZ3, owner.getAvatarThumb());
                LIZ3.LIZ(i, LIZ);
                LIZ3.LIZ((View) r6.LJIJI);
                return;
            }
            1sP r2 = r6.LJIJI;
            User owner2 = r6.LJJIIZ.getOwner();
            n.LIZIZ(owner2, "");
            0bX.LIZ(r2, owner2.getAvatarThumb(), new HIR(i, LIZ));
        }
    }

    public final void LIZ(Intent intent, boolean z, boolean z2, DataChannel dataChannel) {
        if (GameBroadcastInterruptErrorResumeSetting.INSTANCE.getValue()) {
            if (z2) {
                0Xo r0 = this.LJIIJ;
                if (r0 == null) {
                    n.LIZ("");
                }
                r0.LIZIZ(2);
                1Jy r2 = this.LJIIL;
                if (r2 == null) {
                    n.LIZ("");
                }
                r2.LIZIZ(TokenCert.Companion.with("bpea-interrupt_exception_stop_stream"));
                1Jy r02 = this.LJIIL;
                if (r02 == null) {
                    n.LIZ("");
                }
                r02.LJFF();
                return;
            }
            LIZ(intent, z, dataChannel);
            1Jy r22 = this.LJIIL;
            if (r22 == null) {
                n.LIZ("");
            }
            if (C1430G2l.LIZ(Boolean.valueOf(r22.LIZ(TokenCert.Companion.with("bpea-interrupt_exception_start_stream"))))) {
                0Xm r1 = this.LJIIIZ;
                if (r1 != null) {
                    r1.LIZ("succeeded");
                }
                0Xo r03 = this.LJIIJ;
                if (r03 == null) {
                    n.LIZ("");
                }
                r03.LIZ(2);
                return;
            }
            0Xm r12 = this.LJIIIZ;
            if (r12 != null) {
                r12.LIZ("failed");
            }
            C2053GQk.LJIIIZ.LIZ((LsC<? super C2052GQj, 2Pr>) C2028GPl.LIZ);
            LIZLLL(1);
        }
    }

    public final void LIZ(int i, Cert cert) {
        M12.LIZ(cert);
        0aP.LIZIZ("stopLive , stopReason = ".concat(String.valueOf(i)));
        LIZ(cert);
        LIZLLL(i);
    }

    public final void LIZ(boolean z) {
        2sR<Boolean> r0 = C1781GFy.LLJJL;
        n.LIZIZ(r0, "");
        Object LIZ = r0.LIZ();
        n.LIZIZ(LIZ, "");
        if (((Boolean) LIZ).booleanValue()) {
            if (LJIJJ().size() == 0 || z) {
                2sR<Boolean> r1 = C1781GFy.LLJJL;
                n.LIZIZ(r1, "");
                r1.LIZ(false);
                FrameLayout frameLayout = (FrameLayout) LIZ(2131366090);
                n.LIZIZ(frameLayout, "");
                frameLayout.setClickable(true);
                FrameLayout frameLayout2 = (FrameLayout) LIZ(2131366090);
                n.LIZIZ(frameLayout2, "");
                frameLayout2.setVisibility(0);
                0bT r4 = new 0bT();
                0bT r12 = new 0bT();
                2us r02 = new 2us();
                r02.element = 2;
                C2034GPr gPr = new C2034GPr(r02, r4, r12);
                1sP LIZ2 = LIZ(2131365467);
                n.LIZIZ(LIZ2, "");
                r4.LIZ(LIZ2);
                r4.LIZ("tiktok_live_broadcast_resource");
                r4.LIZIZ = false;
                r4.LIZLLL = 3;
                r4.LIZ(new GPU(this, r12, gPr));
                1sP LIZ3 = LIZ(2131370575);
                n.LIZIZ(LIZ3, "");
                r12.LIZ(LIZ3);
                r12.LIZ("tiktok_live_broadcast_resource");
                r12.LIZIZ = false;
                r12.LIZLLL = 3;
                r12.LIZJ = true;
                r12.LIZ(new GPZ(this, gPr));
                if (0b0.LJI()) {
                    r4.LIZIZ("ttlive_livecenter_guide_hand.webp");
                    r12.LIZIZ("ttlive_livecenter_guide_black_line.webp");
                    0bX.LIZ(r4);
                    0bX.LIZ(r12);
                } else {
                    r4.LIZIZ("ttlive_livecenter_guide_hand_rtl.webp");
                    r12.LIZIZ("ttlive_livecenter_guide_black_line_rtl.webp");
                    0bX.LIZ(r4);
                    0bX.LIZ(r12);
                }
                LIZ(2131365473).LIZ(2131886883);
                1jk LIZ4 = LIZ(2131365473);
                n.LIZIZ(LIZ4, "");
                LIZ4.setText(0b0.LIZ(2131828451));
                ObjectAnimator duration = ObjectAnimator.ofFloat(LIZ(2131365473), View.ALPHA, new float[]{0.0f, 1.0f}).setDuration(180);
                n.LIZIZ(duration, "");
                ObjectAnimator duration2 = ObjectAnimator.ofFloat(LIZ(2131365473), View.ALPHA, new float[]{1.0f, 0.0f}).setDuration(180);
                n.LIZIZ(duration2, "");
                duration2.setStartDelay(2808);
                AnimatorSet animatorSet = new AnimatorSet();
                animatorSet.playSequentially(new Animator[]{duration, duration2});
                animatorSet.start();
                FrameLayout frameLayout3 = (FrameLayout) LIZ(2131366090);
                n.LIZIZ(frameLayout3, "");
                frameLayout3.setClickable(true);
                ((FrameLayout) LIZ(2131366090)).setOnClickListener(new C2027GPk(this, animatorSet, r4));
                C3491GtA LIZ5 = C3491GtA.LJFF.LIZ("livesdk_extended_comment_filed_guidence");
                LIZ5.LJII(String.valueOf(q_().getOwnerUserId()));
                LIZ5.LJIIIIZZ(String.valueOf(s_()));
                C1856GIv streamType = q_().getStreamType();
                LIZ5.LIZIZ(streamType != null ? C1393G1a.LIZ(streamType) : null);
                LIZ5.LIZLLL();
            }
            if (!LJIJJ().contains(this.LJJIIZI) && !z) {
                LJIJJ().add(this.LJJIIZI);
            }
        }
    }

    public final void LIZ(Intent intent, boolean z, DataChannel dataChannel) {
        this.LJIILLIIL = intent;
        1Jy r0 = this.LJIIL;
        if (r0 == null) {
            n.LIZ("");
        }
        r0.LIZ(intent, z);
        IBroadcastService LIZ = 0cm.LIZ(IBroadcastService.class);
        1Jy r02 = this.LJIIL;
        if (r02 == null) {
            n.LIZ("");
        }
        0VN r1 = r02.LIZIZ;
        0Xo r03 = this.LJIIJ;
        if (r03 == null) {
            n.LIZ("");
        }
        LIZ.createPauseLiveHelper(dataChannel, r1, r03);
    }

    /* JADX WARNING: type inference failed for: r14v0, types: [com.bytedance.android.live.broadcast.BaseBroadcastFragment, com.bytedance.android.livesdk.ui.BaseFragment, com.bytedance.android.livesdk.chatroom.ui.GameBroadcastFragment] */
    public final void LIZ(int i, int i2, String str, boolean z) {
        0Xm r0;
        GQN gqn;
        String str2 = str;
        StringBuilder sb = new StringBuilder("onStreamEnd , code1: ");
        int i3 = i;
        sb.append(i3);
        sb.append(", code2: ");
        int i4 = i2;
        sb.append(i4);
        sb.append(", errorMsg: ");
        sb.append(str2);
        LIZ(sb.toString());
        if (!z || (gqn = this.LJIJJ) == null || !gqn.LIZ(new GQP(i3, i4, str2), new GQR(!this.mStatusActive))) {
            IBroadcastService LIZ = 0cm.LIZ(IBroadcastService.class);
            if (str2 == null) {
                str2 = "";
            }
            LIZ.reportStreamEndForLiveCore(i3, i4, str2, r_(), s_(), this.LJI);
            if (GameBroadcastInterruptErrorResumeSetting.INSTANCE.getValue()) {
                if (0VP.LIZ(i3, i4)) {
                    0c0.LIZ(new Throwable(), "game broadcast live stream end interrupted");
                    Boolean bool = (Boolean) p_().LIZIZ(HFO.class);
                    if ((bool == null || !bool.booleanValue()) && (r0 = this.LJIIIZ) != null) {
                        r0.LIZ(i3, i4);
                    }
                    C2053GQk.LJIIIZ.LIZ((LsC<? super C2052GQj, 2Pr>) new C2038GPv(i3, i4));
                    1KC r1 = this.LJIIJJI;
                    if (r1 != null) {
                        r1.LIZIZ(!this.mStatusActive);
                        return;
                    }
                    return;
                }
                Boolean bool2 = (Boolean) p_().LIZIZ(HFO.class);
                if (bool2 != null && bool2.booleanValue()) {
                    C2053GQk.LJIIIZ.LIZ((LsC<? super C2052GQj, 2Pr>) new C2039GPw(i3, i4));
                    return;
                }
            }
            C2053GQk.LJIIIZ.LIZ((LsC<? super C2052GQj, 2Pr>) new GQO(i3, i4));
            PrivacyCert$Builder with = PrivacyCert$Builder.Companion.with("bpea-414");
            with.usage("");
            with.tag("stop video/audio capture when live ends");
            with.policies(PrivacyPolicyStore.getVideoPrivacyPolicy(), PrivacyPolicyStore.getAudioPrivacyPolicy());
            LIZ(1, (Cert) with.build());
        }
    }

    /* JADX WARNING: type inference failed for: r1v0, types: [com.bytedance.android.livesdk.ui.BaseFragment, com.bytedance.android.livesdk.chatroom.ui.GameBroadcastFragment] */
    public final boolean isViewValid() {
        if (!this.mStatusDestroyed) {
            return true;
        }
        return false;
    }

    public final void LIZIZ() {
        0XQ r2 = this.LJIIIIZZ;
        if (r2 != null) {
            r2.LIZIZ = System.currentTimeMillis();
        }
    }

    public final void LJIIIZ() {
        GameBroadcastFragment.super.LJIIIZ();
        if (GameBroadcastOnStopUnbindServiceSetting.INSTANCE.getValue()) {
            LJJII();
        }
    }

    public final void t_() {
        View view = getView();
        if (view != null) {
            view.post(new C2040GPx(this));
        }
    }

    private final void LJJII() {
        if (this.LJJI) {
            1hK activity = getActivity();
            if (activity != null) {
                activity.unbindService(this.LJJIJIIJI);
            }
            this.LJJI = false;
        }
    }

    public final void LJIJJLI() {
        Context context = getContext();
        if (context != null) {
            LIZ(context, new Intent(getContext(), 0cm.LIZ(IHostApp.class).getHostActivity(6)));
        }
    }

    private void LJJI() {
        Intent intent = null;
        if (Build.VERSION.SDK_INT >= 26) {
            1hK activity = getActivity();
            if (activity != null) {
                Context context = getContext();
                if (context != null) {
                    n.LIZIZ(context, "");
                    intent = LIZ(context);
                }
                activity.startForegroundService(intent);
            }
        } else {
            1hK activity2 = getActivity();
            if (activity2 != null) {
                Context context2 = getContext();
                if (context2 != null) {
                    n.LIZIZ(context2, "");
                    intent = LIZ(context2);
                }
                activity2.startService(intent);
            }
        }
        this.LJFF = true;
    }

    private void LJJIFFI() {
        Intent intent;
        if (!this.LJJ && !this.LJJI) {
            1hK activity = getActivity();
            if (activity != null) {
                Context context = getContext();
                if (context != null) {
                    n.LIZIZ(context, "");
                    intent = LIZ(context);
                } else {
                    intent = null;
                }
                activity.bindService(intent, this.LJJIJIIJI, 1);
            }
            this.LJJI = true;
        }
    }

    private final void LJJIII() {
        LiveMessageSEI liveMessageSEI = new LiveMessageSEI();
        liveMessageSEI.LIZIZ = System.currentTimeMillis();
        LiveMessageID liveMessageID = new LiveMessageID();
        liveMessageID.LIZ = String.valueOf(s_());
        liveMessageID.LIZIZ = "end_room";
        liveMessageSEI.LIZ = liveMessageID;
        1Jy r1 = this.LJIIL;
        if (r1 == null) {
            n.LIZ("");
        }
        0VN r2 = r1.LIZIZ;
        if (r2 != null) {
            r2.LIZ("live_message_sei", 0UO.LIZIZ.LIZIZ(liveMessageSEI));
        }
    }

    private final void LJJIIJ() {
        Bundle bundle = new Bundle();
        this.LJIJI = false;
        if (this.LJIILL != null) {
            bundle.putString("live_access_recall_msg", 0UO.LIZIZ.LIZIZ(this.LJIILL));
        }
        1KC r0 = this.LJIIJJI;
        if (r0 != null) {
            r0.LIZ(bundle);
        }
        GP5 gp5 = this.LJ;
        if (gp5 != null) {
            gp5.LIZ(bundle);
        }
    }

    public final void LJIIIIZZ() {
        boolean z;
        GameBroadcastFragment.super.LJIIIIZZ();
        boolean value = GameBroadcastInterruptErrorResumeSetting.INSTANCE.getValue();
        Boolean bool = (Boolean) p_().LIZIZ(HFO.class);
        if (bool != null) {
            z = bool.booleanValue();
        } else {
            z = false;
        }
        if (!value || !z) {
            LJJIFFI();
        }
    }

    public final void LJIIJJI() {
        try {
            0WE LIZIZ = 0WT.LIZIZ("control_view");
            if (LIZIZ != null) {
                LIZIZ.LIZ();
            }
        } catch (Throwable th) {
            0aP.LIZJ(th.getMessage());
        }
        try {
            0WE LIZIZ2 = 0WT.LIZIZ("msg_view");
            if (LIZIZ2 != null) {
                LIZIZ2.LIZ();
            }
        } catch (Throwable th2) {
            0aP.LIZJ(th2.getMessage());
        }
    }

    public final void LJIL() {
        Intent intent;
        LIZ("stopService");
        try {
            LJJII();
            if (this.LJFF) {
                1hK activity = getActivity();
                if (activity != null) {
                    Context context = getContext();
                    if (context != null) {
                        n.LIZIZ(context, "");
                        intent = LIZ(context);
                    } else {
                        intent = null;
                    }
                    activity.stopService(intent);
                }
                this.LJFF = false;
            }
        } catch (Throwable th) {
            0aP.LIZJ(th.getMessage());
        }
    }

    private final void LJJIIJZLJL() {
        Map exceptionInfo;
        GameBroadcastExceptionConfig value = GameBroadcastExceptionConfigSetting.INSTANCE.getValue();
        if (C2409Gbi.LJFF && value.getEnable() && (exceptionInfo = value.getExceptionInfo()) != null) {
            for (Map.Entry entry : exceptionInfo.entrySet()) {
                if (((ExceptionInfo) entry.getValue()).isActive()) {
                    this.LJIJJLI.LIZ(PgU.LIZIZ(((ExceptionInfo) entry.getValue()).getDelayTime(), TimeUnit.MILLISECONDS).LIZ(Mk2.LIZ(Mk3.LIZ)).LIZ(new C2030GPn(entry, this), C2037GPu.LIZ));
                }
            }
        }
    }

    public final void LJII() {
        GameBroadcastFragment.super.LJII();
        1KC r4 = this.LJIIJJI;
        if (r4 != null) {
            r4.LJI = 88r.LIZ(r4.LIZJ);
            if (r4.LJII) {
                r4.LJIIJJI.LIZ(PgU.LIZIZ(1000, TimeUnit.MILLISECONDS).LIZ(Mk2.LIZ(Mk3.LIZ)).LIZ(new 1K6(r4), 1K7.LIZ));
                10H r0 = r4.LJJIII;
                if (r0 != null) {
                    r0.LIZJ();
                }
                10Y r02 = r4.LIZ;
                if (r02 != null) {
                    r02.LIZIZ();
                }
            }
        }
        0Xm r2 = this.LJIIIZ;
        if (r2 != null && r2.LIZ) {
            r2.LIZIZ = System.currentTimeMillis();
        }
    }

    public final void LIZ() {
        Room room;
        if (this.LJI) {
            C2053GQk.LJIIIZ.LIZ((LsC<? super C2052GQj, 2Pr>) GQ5.LIZ);
        }
        this.LJI = false;
        0XQ r4 = this.LJIIIIZZ;
        if (r4 != null) {
            r4.LIZJ = System.currentTimeMillis();
            JSONObject jSONObject = new JSONObject();
            try {
                C3028Glh LIZIZ = C4100H7d.LIZ().LIZIZ();
                n.LIZIZ(LIZIZ, "");
                jSONObject.put("user_id", LIZIZ.LIZJ());
                C3318GqN gqN = (C3318GqN) DataChannelGlobal.LIZLLL.LIZIZ(HEY.class);
                if (!(gqN == null || (room = gqN.LIZIZ) == null)) {
                    jSONObject.put("room_id", room.getId());
                    jSONObject.put("anchor_id", room.getOwnerUserId());
                    jSONObject.put("live_mode", room.liveRoomMode);
                    jSONObject.put("game_label", room.getLabels());
                }
                jSONObject.put("stream_push_room_success", r4.LIZ);
                jSONObject.put("stream_push_core_start", r4.LIZIZ);
                jSONObject.put("stream_push_accessed", r4.LIZJ);
            } catch (JSONException e) {
                0c0.LIZ(e, String.valueOf(e));
            }
            GMD.LIZ("livesdk_gamelive_spend", (JSONObject) null, (JSONObject) null, jSONObject);
        }
    }

    /* JADX WARNING: Code restructure failed: missing block: B:51:0x00f8, code lost:
        if (r1 == false) goto L_0x013e;
     */
    /* JADX WARNING: Failed to process nested try/catch */
    /* JADX WARNING: Missing exception handler attribute for start block: B:47:0x00ee */
    /* JADX WARNING: Removed duplicated region for block: B:50:0x00f4 A[Catch:{ Exception -> 0x00f8 }] */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public final void LJI() {
        /*
            r7 = this;
            com.bytedance.android.livesdk.chatroom.ui.GameBroadcastFragment.super.LJI()
            X.1KC r5 = r7.LJIIJJI
            if (r5 == 0) goto L_0x00c3
            X.Mjy r0 = r5.LJIIJJI
            if (r0 == 0) goto L_0x000e
            r0.LIZ()
        L_0x000e:
            android.os.Handler r3 = r5.LJIILL
            X.0XB r2 = new X.0XB
            r2.<init>(r5)
            r0 = 100
            r3.postDelayed(r2, r0)
            X.2sR<java.lang.Boolean> r0 = X.C1781GFy.LJJIIJZLJL
            java.lang.String r4 = ""
            kotlin.h.b.n.LIZIZ(r0, r4)
            java.lang.Object r0 = r0.LIZ()
            kotlin.h.b.n.LIZIZ(r0, r4)
            java.lang.Boolean r0 = (java.lang.Boolean) r0
            boolean r0 = r0.booleanValue()
            if (r0 != 0) goto L_0x00c3
            X.1hK r0 = r5.LIZJ
            boolean r1 = X.88r.LIZ(r0)
            r3 = 0
            if (r1 == 0) goto L_0x00df
            boolean r0 = r5.LJI
            if (r0 == 0) goto L_0x00fa
            r5.LJFF()
        L_0x0040:
            X.0Vs r6 = r5.LJJ
            boolean r0 = r6.LJI
            if (r0 == 0) goto L_0x008d
            X.0Vt r1 = X.0Vt.LIZ
            android.content.Context r0 = r6.LIZ
            boolean r0 = r1.LIZ(r0)
            if (r0 == 0) goto L_0x008d
            r6.LJI = r3
            r6.LIZJ()
            X.GJG r1 = r6.LIZ()
            r0 = 5
            r1.LIZ((int) r0)
            java.util.HashMap r2 = new java.util.HashMap
            r2.<init>()
            com.bytedance.android.livesdkapi.depend.model.live.Room r0 = r6.LJIIIIZZ
            long r0 = r0.getOwnerUserId()
            java.lang.String r1 = java.lang.String.valueOf(r0)
            java.lang.String r0 = "anchor_id"
            r2.put(r0, r1)
            com.bytedance.android.livesdkapi.depend.model.live.Room r0 = r6.LJIIIIZZ
            java.lang.String r1 = r0.getIdStr()
            kotlin.h.b.n.LIZIZ(r1, r4)
            java.lang.String r0 = "room_id"
            r2.put(r0, r1)
            X.GtO r1 = X.C3491GtA.LJFF
            java.lang.String r0 = "livesdk_microphone_accessibility_authorize"
            X.GtA r0 = r1.LIZ(r0)
            r0.LIZ((java.util.Map<java.lang.String, java.lang.String>) r2)
            r0.LIZLLL()
        L_0x008d:
            X.10H r0 = r5.LJJIII
            if (r0 == 0) goto L_0x0094
            r0.LIZLLL()
        L_0x0094:
            X.10Y r0 = r5.LIZ
            if (r0 == 0) goto L_0x009b
            r0.LIZIZ()
        L_0x009b:
            com.bytedance.android.livesdk.livesetting.game.GameBroadcastInterruptErrorResumeSetting r0 = com.bytedance.android.livesdk.livesetting.game.GameBroadcastInterruptErrorResumeSetting.INSTANCE
            boolean r0 = r0.getValue()
            if (r0 == 0) goto L_0x00c3
            com.bytedance.ies.sdk.datachannel.DataChannel r1 = r5.LJJIJ
            java.lang.Class<X.HFO> r0 = X.HFO.class
            java.lang.Object r0 = r1.LIZIZ(r0)
            java.lang.Boolean r0 = (java.lang.Boolean) r0
            boolean r0 = X.C1430G2l.LIZ((java.lang.Boolean) r0)
            if (r0 == 0) goto L_0x00c3
            boolean r0 = r5.LJIJJ
            if (r0 == 0) goto L_0x00c3
            int r0 = r5.LJIJJLI
            if (r0 != 0) goto L_0x00be
            r0 = 2
            r5.LJIJJLI = r0
        L_0x00be:
            r5.LJIJJ = r3
            r5.LJ()
        L_0x00c3:
            X.0Xm r5 = r7.LJIIIZ
            if (r5 == 0) goto L_0x00de
            boolean r0 = r5.LIZ
            if (r0 == 0) goto L_0x00de
            long r3 = r5.LIZIZ
            r1 = 0
            int r0 = (r3 > r1 ? 1 : (r3 == r1 ? 0 : -1))
            if (r0 <= 0) goto L_0x00de
            long r0 = java.lang.System.currentTimeMillis()
            r5.LIZ(r0)
            r0 = -1
            r5.LIZIZ = r0
        L_0x00de:
            return
        L_0x00df:
            boolean r0 = r5.LJI
            if (r0 == 0) goto L_0x013e
            r5.LJ = r3
            X.1Jj r0 = r5.LJI()     // Catch:{ Exception -> 0x00ee }
            if (r0 == 0) goto L_0x00ee
            r0.LIZ()     // Catch:{ Exception -> 0x00ee }
        L_0x00ee:
            X.1Jj r0 = r5.LJII()     // Catch:{ Exception -> 0x00f8 }
            if (r0 == 0) goto L_0x013e
            r0.LIZ()     // Catch:{ Exception -> 0x00f8 }
            goto L_0x013e
        L_0x00f8:
            if (r1 == 0) goto L_0x013e
        L_0x00fa:
            boolean r0 = r5.LJI
            if (r0 != 0) goto L_0x013e
            X.2sR<java.lang.Boolean> r1 = X.C1781GFy.LJJIIZI
            kotlin.h.b.n.LIZIZ(r1, r4)
            r2 = 1
            java.lang.Boolean r0 = java.lang.Boolean.valueOf(r2)
            r1.LIZ(r0)
            X.2sR<java.lang.Boolean> r1 = X.C1781GFy.LJJIIZ
            kotlin.h.b.n.LIZIZ(r1, r4)
            java.lang.Boolean r0 = java.lang.Boolean.valueOf(r2)
            r1.LIZ(r0)
            X.2sR<java.lang.Boolean> r1 = X.C1781GFy.LJJIJ
            kotlin.h.b.n.LIZIZ(r1, r4)
            java.lang.Boolean r0 = java.lang.Boolean.valueOf(r2)
            r1.LIZ(r0)
            X.2sR<java.lang.Boolean> r1 = X.C1781GFy.LJJIJIIJI
            kotlin.h.b.n.LIZIZ(r1, r4)
            java.lang.Boolean r0 = java.lang.Boolean.valueOf(r2)
            r1.LIZ(r0)
            X.2sR<java.lang.Boolean> r1 = X.C1781GFy.LJJIJIIJIL
            kotlin.h.b.n.LIZIZ(r1, r4)
            java.lang.Boolean r0 = java.lang.Boolean.valueOf(r2)
            r1.LIZ(r0)
            r5.LJFF()
        L_0x013e:
            X.Gg0 r1 = X.C2675Gg0.LIZ()
            X.GQf r0 = r5.LJIILJJIL
            r1.LIZ((java.lang.Object) r0)
            goto L_0x0040
        */
        throw new UnsupportedOperationException("Method not decompiled: com.bytedance.android.livesdk.chatroom.ui.GameBroadcastFragment.LJI():void");
    }

    public final void LJIILJJIL() {
        Context context;
        Dialog dialog;
        boolean LIZ = 88r.LIZ(0b0.LJ());
        C3491GtA LIZ2 = C3491GtA.LJFF.LIZ("livesdk_live_over_ingame_overlay_permission");
        LIZ2.LIZ("anchor_id", r_());
        LIZ2.LIZ("room_id", s_());
        LIZ2.LIZ("live_type", "screen_share");
        LIZ2.LIZ("overlay_permission", LIZ ? 1 : 0);
        LIZ2.LIZLLL();
        GameBroadcastFragment.super.LJIILJJIL();
        LIZ("onLiveDestroy");
        PrivacyCert$Builder with = PrivacyCert$Builder.Companion.with("bpea-578");
        with.usage("");
        with.tag("stop video/audio capture when live ends");
        with.policies(PrivacyPolicyStore.getVideoPrivacyPolicy(), PrivacyPolicyStore.getAudioPrivacyPolicy());
        LIZ((Cert) with.build());
        1KC r5 = this.LJIIJJI;
        if (r5 != null && !r5.LJIIJJI()) {
            r5.LIZ(0W8.CMD_TRANSITION_TO_DESTROY);
            2sR<Boolean> r0 = C1781GFy.LJJIIJZLJL;
            n.LIZIZ(r0, "");
            if (!((Boolean) r0.LIZ()).booleanValue() && (dialog = r5.LJIIIZ) != null) {
                C1430G2l.LIZIZ(dialog);
            }
            Dialog dialog2 = r5.LJIIJ;
            if (dialog2 != null) {
                C1430G2l.LIZIZ(dialog2);
            }
            Mjy mjy = r5.LJIIJJI;
            if (mjy != null) {
                mjy.dispose();
            }
            r5.LJJIJ.LIZIZ((Object) r5);
            0zp r02 = r5.LJIIZILJ;
            if (r02 != null) {
                r02.LIZIZ();
            }
            1hK r1 = r5.LIZJ;
            if (r1 != null) {
                r1.unregisterReceiver(r5.LJJIIJZLJL);
            }
            0Wd r12 = r5.LJJI;
            if (r12 != null) {
                2cN r03 = r12.LJ;
                if (r03 != null) {
                    r03.dispose();
                }
                r12.LJ = null;
                2cN r04 = r12.LJFF;
                if (r04 != null) {
                    r04.dispose();
                }
                r12.LJFF = null;
            }
            1JZ r3 = r5.LJIL;
            if (C2409Gbi.LJFF) {
                0aP.LIZ(4, "GameBroadcastMessageStationWidget", "GameBroadcastMessageStation. unRegister");
            }
            IMessageManager iMessageManager = r3.LIZIZ;
            if (iMessageManager != null) {
                iMessageManager.removeMessageListener(C4453HKs.HIGHLIGHT_FRAGMENT_READY_MESSAGE.getIntType(), r3);
            }
            IMessageManager iMessageManager2 = r3.LIZIZ;
            if (iMessageManager2 != null) {
                iMessageManager2.removeMessageListener(C4453HKs.ACCESS_RECALL_MESSAGE.getIntType(), r3);
            }
            for (String LIZ3 : 1JZ.LIZLLL) {
                0YC.LIZ(LIZ3, 0, -1, "not receive im message before close");
            }
            10H r05 = r5.LJJIII;
            if (r05 != null) {
                r05.LIZ();
            }
            10Y r06 = r5.LIZ;
            if (r06 != null) {
                r06.LIZJ();
            }
        }
        this.LJIJJLI.dispose();
        DBT dbt = this.LJIIZILJ;
        if (dbt != null) {
            dbt.LIZ((CancellationException) null);
        }
        DBT dbt2 = this.LJIJ;
        if (dbt2 != null) {
            dbt2.LIZ((CancellationException) null);
        }
        DataChannelGlobal.LIZLLL.LIZJ(HEP.class);
        if (GameBgInterruptServiceRestart.INSTANCE.getValue() && (context = getContext()) != null) {
            LocalBroadcastManager.getInstance(context).unregisterReceiver(LJJ());
        }
    }

    public final void LIZJ(int i) {
        142 r0 = this.LJIILIIL;
        if (r0 != null) {
            r0.LIZ(i);
        }
    }

    private final Intent LIZ(Context context) {
        Intent intent = new Intent();
        IHostApp LIZ = 0cm.LIZ(IHostApp.class);
        n.LIZIZ(LIZ, "");
        intent.setComponent(new ComponentName(context, LIZ.getBgBroadcastServiceName()));
        return intent;
    }

    private final void LIZIZ(Cert cert) {
        1Jy r1 = this.LJIIL;
        if (r1 == null) {
            n.LIZ("");
        }
        r1.LIZIZ(cert);
        0Vk r0 = this.LJII;
        if (r0 != null) {
            r0.LIZIZ();
        }
    }

    public final void onConfigurationChanged(Configuration configuration) {
        M12.LIZ(configuration);
        GameBroadcastFragment.super.onConfigurationChanged(configuration);
        LIZ("onConfigurationChanged , orientation = " + configuration.orientation);
    }

    private final void LIZ(String str) {
        0aP.LIZIZ("GameBroadcastFragment , " + str + " ，hasReleaseSource = " + this.LJJIFFI + " , hasStartService = " + this.LJFF + " , hasBindService = " + this.LJJI);
    }

    public final void LIZIZ(int i) {
        0cm.LIZ(IBroadcastService.class).reportStreamEnd(i, r_(), s_(), this.LJI);
    }

    /* JADX WARNING: type inference failed for: r6v0, types: [com.bytedance.android.live.broadcast.BaseBroadcastFragment, com.bytedance.android.livesdk.ui.BaseFragment, androidx.fragment.app.Fragment, com.bytedance.android.livesdk.chatroom.ui.GameBroadcastFragment] */
    public final void LIZLLL(int i) {
        1KC r0;
        1KC r02;
        if (GameLiveBgContentSafetyExp.INSTANCE.enable() && (r02 = this.LJIIJJI) != null) {
            r02.LJJIIJ = i;
        }
        if (!this.mStatusDestroyed || i == 64) {
            0Xo r1 = this.LJIIJ;
            if (r1 == null) {
                n.LIZ("");
            }
            r1.LIZJ(i);
            this.LJJ = true;
            1hK activity = getActivity();
            if (activity != null) {
                activity.setRequestedOrientation(1);
            }
            if (!GameLiveBgContentSafetyExp.INSTANCE.enable() || (r0 = this.LJIIJJI) == null || !r0.LJIIJJI()) {
                LJJIIJ();
                LJIIJJI();
                1KC r03 = this.LJIIJJI;
                if (r03 != null) {
                    r03.LJIIJ();
                    return;
                }
                return;
            }
            this.LJIJI = true;
            1KC r04 = this.LJIIJJI;
            if (r04 != null) {
                r04.LJIIIZ();
            }
            0Xi.LIZ.LIZ(this.LJIILL, r_(), s_());
        }
    }

    private final void LIZ(Cert cert) {
        LIZ("releaseSource");
        if (!this.LJJIFFI) {
            this.LJJIFFI = true;
            LJJIII();
            1Mn.LIZJ();
            LiveWidgetProvider.Companion.getInstance().clear();
            LJIL();
            LIZIZ(cert);
            0Vk r0 = this.LJII;
            if (r0 != null) {
                r0.LIZ();
            }
            0Vm r02 = this.LJJII;
            if (r02 != null) {
                r02.LIZIZ();
            }
            1Jy r1 = this.LJIIL;
            if (r1 == null) {
                n.LIZ("");
            }
            r1.LJ();
            0cm.LIZ(IPublicScreenService.class).clearMockChatMessage();
            0cm.LIZ(IMessageService.class).release(q_().getId());
            1Ol.LLFII.LIZ(q_().getId(), "BgBroadcastFragment_OnDestroy");
            0cm.LIZ(IBroadcastService.class).logLiveOver(q_(), p_());
            0Xm r03 = this.LJIIIZ;
            if (r03 != null) {
                r03.LIZJ();
            }
        }
    }

    public final void LIZIZ(Bundle bundle) {
        Intent intent;
        Object obj;
        Intent intent2;
        GameBroadcastFragment.super.LIZIZ(bundle);
        LIZ("onLiveActivityCreated");
        p_().LIZ(C4307HFc.class, C1856GIv.SCREEN_RECORD);
        1Mn.LIZ();
        1Mn.LIZIZ();
        1Ol.LLFII.LIZ(s_(), p_(), "BgBroadcastFragment_OnActivityCreated");
        this.LJII = 0cm.LIZ(IBroadcastService.class).createLiveIllegalHelper(q_(), getContext(), p_(), this);
        0cm.LIZ(IBroadcastService.class).createCloseRoomHelper(q_(), getContext(), p_(), this, this);
        0Vm createSyncGiftHelper = 0cm.LIZ(IBroadcastService.class).createSyncGiftHelper(q_());
        createSyncGiftHelper.LIZ();
        this.LJJII = createSyncGiftHelper;
        1KC r3 = this.LJIIJJI;
        if (r3 != null) {
            1hK r4 = r3.LIZJ;
            if (r4 != null) {
                BroadcastReceiver broadcastReceiver = r3.LJJIIJZLJL;
                IntentFilter intentFilter = new IntentFilter();
                intentFilter.addAction("android.intent.action.CONFIGURATION_CHANGED");
                1KC.LIZ(r4, broadcastReceiver, intentFilter);
            }
            r3.LJI = 88r.LIZ(r3.LIZJ);
            0b0.LIZJ = false;
            0b0.LIZIZ = new int[]{0, 0};
            1hK r0 = r3.LIZJ;
            Intent intent3 = null;
            if (r0 == null || (intent2 = r0.getIntent()) == null) {
                intent = null;
            } else {
                intent = (Intent) intent2.getParcelableExtra("hotsoon.intent.extra.PROJECTION_INTENT");
            }
            r3.LJIJ = intent;
            if (EnableTTCaptureSetting.INSTANCE.enable()) {
                0cm.LIZ(IBroadcastService.class).initLiveBroadcastContext();
                if (r3.LJIJ == null) {
                    1hK r1 = r3.LIZJ;
                    if (r1 != null) {
                        obj = 1KC.LIZ(r1, "media_projection");
                    } else {
                        obj = null;
                    }
                    if (!(obj instanceof MediaProjectionManager)) {
                        obj = null;
                    }
                    MediaProjectionManager mediaProjectionManager = (MediaProjectionManager) obj;
                    if (mediaProjectionManager != null) {
                        intent3 = 1KC.LIZ(mediaProjectionManager);
                    }
                    r3.LJJIIZI.startActivityForResult(intent3, 1000);
                }
            }
            158.MESSAGE_ALERT.load(r3.LJJIJ, new 1KB(r3));
        }
        LJJI();
        0Uz.LIZ("live_page_load", String.valueOf(System.currentTimeMillis()));
    }

    public static void LIZ(Context context, Intent intent) {
        3i8.LIZ(intent, context);
        context.startActivity(intent);
    }

    public final View LIZ(LayoutInflater layoutInflater, ViewGroup viewGroup) {
        M12.LIZ(layoutInflater);
        return 0HH.LIZ(layoutInflater, 2131561520, viewGroup, false);
    }

    public final void LIZ(int i, int i2, Intent intent) {
        GameBroadcastFragment.super.LIZ(i, i2, intent);
        1KC r3 = this.LJIIJJI;
        if (r3 == null) {
            return;
        }
        if (i == 1000) {
            if (i2 != -1) {
                C2053GQk.LJIIIZ.LIZ((LsC<? super C2052GQj, 2Pr>) 1rH.LIZ);
                GameBroadcastFragment gameBroadcastFragment = r3.LJJIIZI;
                PrivacyCert$Builder with = PrivacyCert$Builder.Companion.with("bpea-1871");
                with.usage("");
                with.tag("stop video/audio capture when live ends");
                with.policies(PrivacyPolicyStore.getVideoPrivacyPolicy(), PrivacyPolicyStore.getAudioPrivacyPolicy());
                gameBroadcastFragment.LIZ(1, (Cert) with.build());
            } else if (intent != null) {
                PrivacyCert$Builder with2 = PrivacyCert$Builder.Companion.with("bpea-576");
                with2.usage("");
                with2.tag("start video/audio capture when live starts");
                with2.policies(PrivacyPolicyStore.getVideoPrivacyPolicy(), PrivacyPolicyStore.getAudioPrivacyPolicy());
                r3.LIZ(intent, with2.build());
            }
        } else if (i != 1001) {
        } else {
            if (i2 == -1) {
                GameBroadcastFragment gameBroadcastFragment2 = r3.LJJIIZI;
                if (GameBroadcastInterruptErrorResumeSetting.INSTANCE.getValue()) {
                    if (!gameBroadcastFragment2.LJFF) {
                        gameBroadcastFragment2.LJJI();
                    }
                    gameBroadcastFragment2.LJJIFFI();
                }
                if (intent != null) {
                    r3.LJIJ = intent;
                }
                C3491GtA LIZ = C3491GtA.LJFF.LIZ("livesdk_live_unexcepted_interruption_allow_screenshare_click");
                LIZ.LIZ("anchor_id", r3.LIZJ());
                LIZ.LIZ("live_type", "screen_share");
                LIZ.LIZ("room_id", r3.LIZIZ());
                LIZ.LIZ("click_type", "allow");
                LIZ.LIZLLL();
                return;
            }
            C3491GtA LIZ2 = C3491GtA.LJFF.LIZ("livesdk_live_unexcepted_interruption_allow_screenshare_click");
            LIZ2.LIZ("anchor_id", r3.LIZJ());
            LIZ2.LIZ("live_type", "screen_share");
            LIZ2.LIZ("room_id", r3.LIZIZ());
            LIZ2.LIZ("click_type", "cancel");
            LIZ2.LIZLLL();
            C2053GQk.LJIIIZ.LIZ((LsC<? super C2052GQj, 2Pr>) 1rI.LIZ);
            r3.LJJIIZI.LIZ(1, (Cert) TokenCert.Companion.with("bpea-interrupt_access_denied"));
        }
    }

    public final void LIZ(int i, int i2, String str) {
        LIZ(i, i2, str, true);
    }
}
