package com.bytedance.android.livesdk.broadcast.video;

import X.006;
import X.0AA;
import X.0AP;
import X.0S6;
import X.0UM;
import X.0UO;
import X.0Uu;
import X.0Uz;
import X.0V3;
import X.0V4;
import X.0VN;
import X.0VO;
import X.0Xg;
import X.0Xh;
import X.0Xk;
import X.0Xo;
import X.0Zr;
import X.0aP;
import X.0b0;
import X.0bT;
import X.0bV;
import X.0bX;
import X.0bv;
import X.0c0;
import X.0cO;
import X.0cP;
import X.0cm;
import X.0ed;
import X.0ez;
import X.0f9;
import X.0fD;
import X.0fN;
import X.145;
import X.1JF;
import X.1Mn;
import X.1Ol;
import X.1Om;
import X.1f0;
import X.1hK;
import X.1jk;
import X.1sP;
import X.28L;
import X.28N;
import X.28n;
import X.28p;
import X.28q;
import X.28s;
import X.28w;
import X.29Y;
import X.2AQ;
import X.2AX;
import X.2Ak;
import X.2BJ;
import X.2Cp;
import X.2cN;
import X.2fU;
import X.2sR;
import X.2us;
import X.7he;
import X.7vl;
import X.86a;
import X.BRR;
import X.C1006FuB;
import X.C1059Fv2;
import X.C1099Fvg;
import X.C1185Fx4;
import X.C1208FxR;
import X.C1313Fz8;
import X.C1393G1a;
import X.C1430G2l;
import X.C1612G9l;
import X.C1642GAp;
import X.C1773GFq;
import X.C1776GFt;
import X.C1777GFu;
import X.C1781GFy;
import X.C1788GGf;
import X.C1822GHn;
import X.C1831GHw;
import X.C1856GIv;
import X.C1873GJm;
import X.C1951GMm;
import X.C1962GMx;
import X.C1965GNa;
import X.C1970GNf;
import X.C1978GNn;
import X.C1980GNp;
import X.C1981GNq;
import X.C1982GNr;
import X.C1983GNs;
import X.C1985GNu;
import X.C1987GNw;
import X.C1988GNx;
import X.C1990GNz;
import X.C1991GOa;
import X.C1992GOb;
import X.C1994GOd;
import X.C1995GOe;
import X.C1996GOf;
import X.C1997GOg;
import X.C1998GOh;
import X.C1U;
import X.C2002GOl;
import X.C2003GOm;
import X.C2005GOo;
import X.C2007GOq;
import X.C2008GOr;
import X.C2010GOt;
import X.C2012GOv;
import X.C2016GOz;
import X.C2017GPa;
import X.C2019GPc;
import X.C2023GPg;
import X.C2024GPh;
import X.C2047GQe;
import X.C2440GcD;
import X.C2449GcM;
import X.C2467Gce;
import X.C2468Gcf;
import X.C2470Gch;
import X.C2483Gcu;
import X.C2564GeD;
import X.C2675Gg0;
import X.C2833GiY;
import X.C3028Glh;
import X.C3491GtA;
import X.C3547Gu4;
import X.C3553GuA;
import X.C3598Gut;
import X.C3935H0u;
import X.C4100H7d;
import X.C4163H9o;
import X.C4329HFy;
import X.C4338HGh;
import X.C4366HHj;
import X.C5097Hdy;
import X.C5098Hdz;
import X.C5099He0;
import X.C5629HmY;
import X.C5633Hmc;
import X.C6455Hzs;
import X.Crj;
import X.DEF;
import X.G9I;
import X.G9Q;
import X.G9W;
import X.GC8;
import X.GC9;
import X.GD1;
import X.GHM;
import X.GHN;
import X.GHO;
import X.GI0;
import X.GJA;
import X.GJB;
import X.GJH;
import X.GJJ;
import X.GK1;
import X.GK9;
import X.GKG;
import X.GMZ;
import X.GO0;
import X.GO2;
import X.GO3;
import X.GO7;
import X.GO8;
import X.GOA;
import X.GOC;
import X.GOD;
import X.GOE;
import X.GOF;
import X.GOI;
import X.GOJ;
import X.GOK;
import X.GOL;
import X.GOM;
import X.GON;
import X.GOO;
import X.GOQ;
import X.GOT;
import X.GOU;
import X.GOV;
import X.GOW;
import X.GOX;
import X.GP0;
import X.GP1;
import X.GP2;
import X.GP3;
import X.GP5;
import X.GPA;
import X.GPB;
import X.GPF;
import X.GPG;
import X.GPI;
import X.GQI;
import X.GQY;
import X.GR4;
import X.GSE;
import X.GSF;
import X.HEM;
import X.HEN;
import X.HEP;
import X.HEU;
import X.HGK;
import X.HGS;
import X.HI7;
import X.HK2;
import X.HK3;
import X.HL0;
import X.K4r;
import X.M12;
import X.Mk2;
import X.Mk3;
import X.PgU;
import X.Pm5;
import X.QW2;
import X.SRf;
import X.TLj;
import X.TLk;
import X.ToV;
import android.animation.Animator;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.app.Dialog;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
import android.net.Uri;
import android.os.Bundle;
import android.os.Message;
import android.os.SystemClock;
import android.telephony.TelephonyManager;
import android.util.Pair;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import androidx.fragment.app.Fragment;
import com.bytedance.android.live.adminsetting.IAdminSettingService;
import com.bytedance.android.live.broadcast.BaseBroadcastFragment;
import com.bytedance.android.live.gift.IGiftService;
import com.bytedance.android.live.liveinteract.api.IInteractService;
import com.bytedance.android.live.livepullstream.api.IPullStreamService;
import com.bytedance.android.live.wallet.IWalletExchange;
import com.bytedance.android.live.wallet.IWalletService;
import com.bytedance.android.livesdk.LiveDialogFragment;
import com.bytedance.android.livesdk.broadcast.interaction.function.illegal.IllegalReviewDialog;
import com.bytedance.android.livesdk.livesetting.broadcast.LiveMaxRetainAlogMessageSizeSetting;
import com.bytedance.android.livesdk.livesetting.broadcast.LivePauseLiveSetting;
import com.bytedance.android.livesdk.livesetting.broadcast.LiveStreamEnableUrlListSetting;
import com.bytedance.android.livesdk.livesetting.broadcast.LiveVboostDurationForStartBroadcastSetting;
import com.bytedance.android.livesdk.livesetting.broadcast.VBoostEnableSetting;
import com.bytedance.android.livesdk.livesetting.linkmic.LiveAnchorOneVnSetting;
import com.bytedance.android.livesdk.log.monitor.IPerformanceManager;
import com.bytedance.android.livesdk.model.Gift;
import com.bytedance.android.livesdk.model.message.ControlMessage;
import com.bytedance.android.livesdk.model.message.PerceptionDialogInfo;
import com.bytedance.android.livesdk.model.message.PunishEventInfo;
import com.bytedance.android.livesdk.performance.LivePerformanceManager;
import com.bytedance.android.livesdk.tunnel.BroadcastTunnelVM;
import com.bytedance.android.livesdkapi.depend.model.live.Room;
import com.bytedance.android.livesdkapi.depend.model.live.StreamUrl;
import com.bytedance.android.livesdkapi.depend.model.live.StreamUrlExtra;
import com.bytedance.android.livesdkapi.message.LiveMessageID;
import com.bytedance.android.livesdkapi.message.LiveMessageSEI;
import com.bytedance.android.widget.WidgetManager;
import com.bytedance.bpea.basics.Cert;
import com.bytedance.bpea.basics.PrivacyCert;
import com.bytedance.bpea.basics.PrivacyCert$Builder;
import com.bytedance.bpea.store.policy.PrivacyPolicyStore;
import com.bytedance.common.utility.collection.WeakHandler;
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.ILiveStream;
import com.ss.avframework.livestreamv2.core.LiveCore;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.TimeUnit;
import kotlin.h.b.n;
import org.json.JSONObject;

public final class LiveBroadcastFragment extends BaseBroadcastFragment implements 0VO, 0Xh, GQY, C2012GOv, C1873GJm, WeakHandler.IHandler, GSE, C5633Hmc {
    public static boolean LJJIIJZLJL;
    public static final GQI LJJIIZ = new GQI((byte) 0);
    public static final int[][] LJJJJZI = {new int[]{200, LiveMaxRetainAlogMessageSizeSetting.DEFAULT, 800, 1}, new int[]{200, 800, 1200, 3}};
    public StreamUrlExtra LJ;
    public GP5 LJFF;
    public C2010GOt LJI;
    public boolean LJII;
    public boolean LJIIIIZZ;
    public boolean LJIIIZ;
    public boolean LJIIJ = true;
    public boolean LJIIJJI;
    public long LJIIL;
    public long LJIILIIL;
    public boolean LJIILJJIL;
    public 0VN LJIILL;
    public VideoWidget LJIILLIIL;
    public 1f0 LJIIZILJ;
    public LiveDialogFragment LJIJ;
    public 0Xo LJIJI;
    public String LJIJJ;
    public CharSequence LJIJJLI;
    public CharSequence LJIL;
    public CharSequence LJJ;
    public GR4 LJJI;
    public 2cN LJJIFFI;
    public HI7 LJJII;
    public boolean LJJIII = true;
    public final Crj LJJIIJ = 7vl.LIZ(new GPF(this));
    public final Crj LJJIIZI = 7vl.LIZ(new GOV(this));
    public final Crj LJJIJ = 7vl.LIZ(new C1995GOe(this));
    public final Crj LJJIJIIJI = 7vl.LIZ(new C1978GNn(this));
    public final Crj LJJIJIIJIL = 7vl.LIZ(new C1994GOd(this));
    public final Crj LJJIJIL = 7vl.LIZ(new GPG(this));
    public final Crj LJJIJL = 7vl.LIZ(C2002GOl.LIZ);
    public GOT LJJIJLIJ;
    public boolean LJJIL;
    public boolean LJJIZ;
    public long LJJJ;
    public boolean LJJJI = true;
    public boolean LJJJIL;
    public boolean LJJJJ;
    public final List<2cN> LJJJJI = new ArrayList();
    public IllegalReviewDialog LJJJJIZL;
    public final Crj LJJJJJ = 7he.LIZ(C1777GFu.LIZ);
    public final C1965GNa LJJJJJL = new GK1(this);
    public final QW2 LJJJJL = new C1980GNp(this);
    public final C1776GFt LJJJJLI = new C1776GFt(this);
    public final Runnable LJJJJLL = new GPB(this);
    public final Runnable LJJJJZ = new GPA(this);
    public HashMap LJJJLIIL;

    private final C1987GNw LJJIIJZLJL() {
        return (C1987GNw) this.LJJIJIIJI.getValue();
    }

    private final C2564GeD LJJIIZ() {
        return (C2564GeD) this.LJJIJIIJIL.getValue();
    }

    private final LinkedList<Runnable> LJJIIZI() {
        return (LinkedList) this.LJJIJL.getValue();
    }

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

    public final void LIZ(LiveCore liveCore) {
    }

    public final void LIZIZ() {
    }

    public final void LIZJ() {
    }

    public final void LJIIJJI() {
    }

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

    public final WeakHandler LJIJJ() {
        return (WeakHandler) this.LJJIJ.getValue();
    }

    public final BroadcastTunnelVM LJIJJLI() {
        return (BroadcastTunnelVM) this.LJJIJIL.getValue();
    }

    public final 0fN LJIL() {
        return (0fN) this.LJJJJJ.getValue();
    }

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

    public final Fragment LJIIJ() {
        return this;
    }

    /* JADX WARNING: Code restructure failed: missing block: B:8:0x001d, code lost:
        r0 = r0.getView();
     */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public final void LIZ(android.view.View r7, android.os.Bundle r8) {
        /*
            r6 = this;
            X.M12.LIZ(r7)
            com.bytedance.android.livesdk.broadcast.video.LiveBroadcastFragment.super.LIZ(r7, r8)
            com.bytedance.android.livesdk.livesetting.broadcast.LiveEnableFixLiveEndSetting r0 = com.bytedance.android.livesdk.livesetting.broadcast.LiveEnableFixLiveEndSetting.INSTANCE
            boolean r0 = r0.enable()
            if (r0 == 0) goto L_0x0039
            com.bytedance.android.livesdk.broadcast.video.VideoWidget r0 = r6.LJIILLIIL
            if (r0 == 0) goto L_0x0039
            android.view.View r3 = r0.getView()
            if (r3 == 0) goto L_0x0039
            com.bytedance.android.livesdk.broadcast.video.VideoWidget r0 = r6.LJIILLIIL
            r2 = 0
            if (r0 == 0) goto L_0x0187
            android.view.View r0 = r0.getView()
            if (r0 == 0) goto L_0x0187
            android.view.ViewGroup$LayoutParams r1 = r0.getLayoutParams()
        L_0x0027:
            boolean r0 = r1 instanceof android.widget.FrameLayout.LayoutParams
            if (r0 != 0) goto L_0x002c
            r1 = r2
        L_0x002c:
            android.widget.FrameLayout$LayoutParams r1 = (android.widget.FrameLayout.LayoutParams) r1
            if (r1 == 0) goto L_0x0036
            r0 = 1
            r1.leftMargin = r0
            r1.rightMargin = r0
            r2 = r1
        L_0x0036:
            r3.setLayoutParams(r2)
        L_0x0039:
            X.0fN r1 = r6.LJIL()
            X.GFt r0 = r6.LJJJJLI
            r1.LIZ(r0)
            X.GJ2 r0 = X.GJ2.VIDEO
            r0.config()
            X.1Mn.LIZ()
            X.1Mn.LIZIZ()
            X.GMX r1 = X.GMZ.LIZ
            com.bytedance.android.livesdkapi.depend.model.live.Room r0 = r6.q_()
            r1.LIZ(r0)
            com.bytedance.android.livesdkapi.depend.model.live.Room r0 = r6.q_()
            long r3 = r0.getId()
            java.util.Map r0 = X.0Xk.LIZJ
            r0.clear()
            java.util.Map r2 = X.0Xk.LIZJ
            java.lang.Class<com.bytedance.android.livesdkapi.host.IHostContext> r0 = com.bytedance.android.livesdkapi.host.IHostContext.class
            X.0UT r0 = X.0cm.LIZ(r0)
            com.bytedance.android.livesdkapi.host.IHostContext r0 = (com.bytedance.android.livesdkapi.host.IHostContext) r0
            int r0 = r0.appId()
            java.lang.String r1 = java.lang.String.valueOf(r0)
            java.lang.String r0 = "aid"
            r2.put(r0, r1)
            java.util.Map r2 = X.0Xk.LIZJ
            X.H7d r0 = X.C4100H7d.LIZ()
            X.Glh r0 = r0.LIZIZ()
            java.lang.String r5 = ""
            kotlin.h.b.n.LIZIZ(r0, r5)
            X.0Uo r0 = r0.LIZ()
            kotlin.h.b.n.LIZIZ(r0, r5)
            long r0 = r0.getId()
            java.lang.String r1 = java.lang.String.valueOf(r0)
            java.lang.String r0 = "uid"
            r2.put(r0, r1)
            java.util.Map r2 = X.0Xk.LIZJ
            java.lang.Class<com.bytedance.android.livesdkapi.host.IHostContext> r0 = com.bytedance.android.livesdkapi.host.IHostContext.class
            X.0UT r0 = X.0cm.LIZ(r0)
            kotlin.h.b.n.LIZIZ(r0, r5)
            com.bytedance.android.livesdkapi.host.IHostContext r0 = (com.bytedance.android.livesdkapi.host.IHostContext) r0
            java.lang.String r1 = r0.getServerDeviceId()
            kotlin.h.b.n.LIZIZ(r1, r5)
            java.lang.String r0 = "did"
            r2.put(r0, r1)
            java.util.Map r2 = X.0Xk.LIZJ
            java.lang.String r1 = java.lang.String.valueOf(r3)
            java.lang.String r0 = "roomid"
            r2.put(r0, r1)
            com.bytedance.ies.sdk.datachannel.DataChannel r2 = r6.p_()
            java.lang.Class<X.Fv7> r1 = X.C1064Fv7.class
            com.bytedance.android.livesdkapi.depend.model.live.Room r0 = r6.q_()
            r2.LIZIZ(r1, r0)
            X.0hy r4 = X.1Ol.LLFII
            long r2 = r6.s_()
            com.bytedance.ies.sdk.datachannel.DataChannel r1 = r6.p_()
            java.lang.String r0 = "LiveBroadcastFragment_OnViewCreated"
            r4.LIZ(r2, r1, r0)
            com.bytedance.android.livesdkapi.depend.model.live.Room r0 = r6.q_()
            com.bytedance.android.livesdkapi.depend.model.live.StreamUrlExtra r0 = r0.getStreamUrlExtraSafely()
            kotlin.h.b.n.LIZIZ(r0, r5)
            r6.LJ = r0
            X.GOt r2 = new X.GOt
            long r0 = r6.s_()
            r6.getContext()
            r2.<init>(r0)
            r6.LJI = r2
            r0 = r6
            r2.LIZ(r0)
            X.GNw r1 = r6.LJJIIJZLJL()
            r0 = r6
            r1.LIZ = r0
            X.0Xo r1 = new X.0Xo
            X.GNw r0 = r6.LJJIIJZLJL()
            r1.<init>(r0)
            r1.LIZ()
            r6.LJIJI = r1
            X.GO6 r1 = new X.GO6
            r1.<init>(r6)
            com.bytedance.ies.sdk.datachannel.DataChannel r0 = r6.p_()
            X.0ed.LIZ(r1, r0)
            long r0 = r6.s_()
            X.C1642GAp.LIZ(r0)
            X.GOT r1 = new X.GOT
            r0 = r6
            r1.<init>(r0)
            r6.LJJIJLIJ = r1
            com.bytedance.android.live.gift.IGiftService r0 = X.GI0.LJIIL()
            r0.resetRoomStatus()
            com.bytedance.ies.sdk.datachannel.DataChannel r0 = r6.p_()
            com.bytedance.android.livesdkapi.depend.model.live.Room r0 = X.C1430G2l.LIZ((com.bytedance.ies.sdk.datachannel.DataChannel) r0)
            boolean r0 = X.0Zr.LIZ(r0)
            if (r0 == 0) goto L_0x015a
            com.bytedance.ies.sdk.datachannel.DataChannel r3 = r6.p_()
            r2 = r6
            java.lang.Class<X.28y> r1 = X.28y.class
            X.GMb r0 = new X.GMb
            r0.<init>(r6)
            r3.LIZ((X.0CH) r2, r1, r0)
            java.lang.Class<X.28o> r1 = X.28o.class
            X.GOi r0 = new X.GOi
            r0.<init>(r6)
            r3.LIZ((X.0CH) r2, r1, r0)
        L_0x015a:
            com.bytedance.android.livesdk.livesetting.performance.LiveBroadcastPoorDeviceDowngradeSetting r0 = com.bytedance.android.livesdk.livesetting.performance.LiveBroadcastPoorDeviceDowngradeSetting.INSTANCE
            boolean r0 = r0.enable()
            if (r0 == 0) goto L_0x0183
            android.os.Handler r3 = X.0ed.LIZ()
            X.GP4 r2 = new X.GP4
            r2.<init>(r6)
            com.bytedance.android.livesdk.livesetting.performance.LiveBroadcastPoorDeviceDelayDurationSetting r0 = com.bytedance.android.livesdk.livesetting.performance.LiveBroadcastPoorDeviceDelayDurationSetting.INSTANCE
            long r0 = r0.value()
            r3.postDelayed(r2, r0)
        L_0x0174:
            X.158 r2 = X.158.BEAUTY
            com.bytedance.ies.sdk.datachannel.DataChannel r1 = r6.p_()
            X.GFp r0 = new X.GFp
            r0.<init>(r6)
            r2.load(r1, r0)
            return
        L_0x0183:
            r6.LJJ()
            goto L_0x0174
        L_0x0187:
            r1 = r2
            goto L_0x0027
        */
        throw new UnsupportedOperationException("Method not decompiled: com.bytedance.android.livesdk.broadcast.video.LiveBroadcastFragment.LIZ(android.view.View, android.os.Bundle):void");
    }

    public final void LIZ(int i, int i2, Intent intent) {
        LiveBroadcastFragment.super.LIZ(i, i2, intent);
        1f0 r0 = this.LJIIZILJ;
        if (r0 != null) {
            r0.LIZIZ().onActivityResult(i, i2, intent);
        }
    }

    /* JADX WARNING: type inference failed for: r15v0, types: [com.bytedance.android.live.broadcast.BaseBroadcastFragment, com.bytedance.android.livesdk.ui.BaseFragment, com.bytedance.android.livesdk.broadcast.video.LiveBroadcastFragment] */
    public final void LIZ(Cert cert) {
        String str;
        String str2;
        String str3;
        String str4;
        String str5;
        String str6;
        GMZ.LIZ.LIZ(q_(), p_());
        0Zr r10 = 0Zr.LIZ;
        DataChannel p_ = p_();
        if (p_ != null && 0Zr.LIZ(C1430G2l.LIZ(p_)) && C1430G2l.LIZ((Boolean) p_.LIZIZ(28q.class))) {
            if (C1430G2l.LIZ((Boolean) p_.LIZIZ(28p.class))) {
                HashMap hashMap = (HashMap) p_.LIZIZ(28w.class);
                if (hashMap == null) {
                    hashMap = new HashMap();
                }
                long uptimeMillis = SystemClock.uptimeMillis();
                Long l = (Long) hashMap.get(r10.LIZIZ(p_));
                long longValue = uptimeMillis - (l != null ? l.longValue() : 0);
                HashMap hashMap2 = (HashMap) p_.LIZIZ(28n.class);
                if (hashMap2 == null) {
                    hashMap2 = new HashMap();
                }
                Long l2 = (Long) hashMap2.get(r10.LIZIZ(p_));
                long longValue2 = l2 != null ? l2.longValue() : 0;
                C3491GtA LIZ = C3491GtA.LJFF.LIZ("livesdk_anchor_pictionary_round_end");
                LIZ.LIZ(p_);
                LIZ.LIZ("pictionary_session_id", (Number) r10.LIZ(p_));
                LIZ.LIZ("pictionary_id", (Number) r10.LIZIZ(p_));
                LIZ.LIZ("correct_ucnt", longValue2);
                LIZ.LIZ("time", Math.min(longValue, 120000));
                LIZ.LIZ("end_reason", "live_end");
                LIZ.LIZLLL();
            }
            Long LIZ2 = r10.LIZ(p_);
            if (LIZ2 != null) {
                long longValue3 = LIZ2.longValue();
                C3491GtA LIZ3 = C3491GtA.LJFF.LIZ("livesdk_anchor_pictionary_end");
                LIZ3.LIZ();
                LIZ3.LIZ("pictionary_session_id", longValue3);
                Integer num = (Integer) p_.LIZIZ(28s.class);
                LIZ3.LIZ("number_cnt", num != null ? num.intValue() : 0);
                LIZ3.LIZ("end_reason", "live_end");
                LIZ3.LIZLLL();
            }
        }
        this.LJJIL = true;
        0VN r0 = this.LJIILL;
        if (r0 != null) {
            r0.LIZ();
        }
        0VN r02 = this.LJIILL;
        Cert cert2 = cert;
        if (r02 != null) {
            r02.LJIIIIZZ(cert2);
        }
        0Xg.LIZ("release_audio");
        0VN r03 = this.LJIILL;
        if (r03 != null) {
            r03.LJ(cert2);
        }
        0Xg.LIZ("release_video");
        2sR<Boolean> r04 = C1781GFy.LJLILLLLZI;
        n.LIZIZ(r04, "");
        Boolean bool = (Boolean) r04.LIZ();
        2sR<Boolean> r05 = C1781GFy.LJLJI;
        n.LIZIZ(r05, "");
        Boolean bool2 = (Boolean) r05.LIZ();
        2sR<Boolean> r06 = C1781GFy.LJLIL;
        n.LIZIZ(r06, "");
        Boolean bool3 = (Boolean) r06.LIZ();
        C3491GtA LIZ4 = C3491GtA.LJFF.LIZ("connection_use_status");
        LIZ4.LIZ(p_());
        n.LIZIZ(bool, "");
        boolean booleanValue = bool.booleanValue();
        String str7 = "open";
        LIZ4.LIZ("connection_status", booleanValue ? str7 : "close");
        n.LIZIZ(bool2, "");
        if (bool2.booleanValue()) {
            str = str7;
        } else {
            str = "close";
        }
        LIZ4.LIZ("recommend_connection_status", str);
        n.LIZIZ(bool3, "");
        if (bool3.booleanValue()) {
            str2 = str7;
        } else {
            str2 = "close";
        }
        LIZ4.LIZ("anchor_live_notification_status", str2);
        if (0cm.LIZ(IInteractService.class).hasMultiCoHostPermission()) {
            2sR<Boolean> r07 = C1781GFy.LJLJJL;
            n.LIZIZ(r07, "");
            Boolean bool4 = (Boolean) r07.LIZ();
            2sR<Boolean> r08 = C1781GFy.LJLJJI;
            n.LIZIZ(r08, "");
            Boolean bool5 = (Boolean) r08.LIZ();
            2sR<Boolean> r09 = C1781GFy.LJLJL;
            n.LIZIZ(r09, "");
            Boolean bool6 = (Boolean) r09.LIZ();
            2sR<Boolean> r010 = C1781GFy.LJLJJLL;
            n.LIZIZ(r010, "");
            Boolean bool7 = (Boolean) r010.LIZ();
            2sR<Boolean> r011 = C1781GFy.LJLL;
            n.LIZIZ(r011, "");
            Boolean bool8 = (Boolean) r011.LIZ();
            n.LIZIZ(bool5, "");
            if (bool5.booleanValue()) {
                str3 = str7;
            } else {
                str3 = "close";
            }
            LIZ4.LIZ("mutual_invitation_receive_status", str3);
            n.LIZIZ(bool7, "");
            if (bool7.booleanValue()) {
                str4 = str7;
            } else {
                str4 = "close";
            }
            LIZ4.LIZ("recommend_invitation_receive_status", str4);
            n.LIZIZ(bool4, "");
            if (bool4.booleanValue()) {
                str5 = str7;
            } else {
                str5 = "close";
            }
            LIZ4.LIZ("mutual_application_receive_status", str5);
            LIZ4 = LIZ4;
            n.LIZIZ(bool6, "");
            if (bool6.booleanValue()) {
                str6 = str7;
            } else {
                str6 = "close";
            }
            LIZ4.LIZ("recommend_application_receive_status", str6);
            n.LIZIZ(bool8, "");
            if (!bool8.booleanValue()) {
                str7 = "close";
            }
            LIZ4.LIZ("anchor_live_notification_status", str7);
        }
        LIZ4.LIZLLL();
        if (isViewValid()) {
            LiveDialogFragment liveDialogFragment = this.LJIJ;
            if (liveDialogFragment != null) {
                liveDialogFragment.dismiss();
            }
            LJIJJ().post(new C1981GNq(this));
            long ownerUserId = q_().getOwnerUserId();
            C3028Glh LIZIZ = C4100H7d.LIZ().LIZIZ();
            n.LIZIZ(LIZIZ, "");
            0cm.LIZ(IGiftService.class).showBroadCaseEndPage(ownerUserId == LIZIZ.LIZJ());
            if (GHN.LJII != 0) {
                C3491GtA LIZ5 = C3491GtA.LJFF.LIZ("livesdk_broadcast_end");
                LIZ5.LIZ("duration", System.currentTimeMillis() - GHN.LJII);
                LIZ5.LIZLLL();
            }
            GHN.LIZJ = 0;
            GHN.LIZLLL = 0;
            GHN.LJ = 0;
            GHN.LJFF = 0;
            GHN.LJI = 0;
            GHN.LJII = 0;
        }
    }

    /* JADX WARNING: Code restructure failed: missing block: B:8:0x0063, code lost:
        if (r7 > 0) goto L_0x0065;
     */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public final void LIZ(int r16, int r17, java.lang.String r18) {
        /*
            r15 = this;
            r9 = r18
            X.M12.LIZ(r9)
            r15.LJJIJ()
            r7 = r16
            boolean r0 = X.0VP.LIZ(r7)
            r4 = 2
            r3 = 1
            r2 = 0
            if (r0 == 0) goto L_0x00a9
            android.content.Context r1 = r15.getContext()
            r0 = 2131834021(0x7f1134a5, float:1.930114E38)
            X.C1313Fz8.LIZ((android.content.Context) r1, (int) r0)
            X.HK2 r6 = new X.HK2
            X.1hK r0 = r15.getActivity()
            r6.<init>(r0)
            r0 = 2131830163(0x7f112593, float:1.9293316E38)
            r6.LIZ((int) r0)
            r0 = 2131830162(0x7f112592, float:1.9293314E38)
            r6.LIZIZ(r0)
            r6.LJIIIZ = r2
            boolean r0 = r15.LJJJI
            r5 = 2131830161(0x7f112591, float:1.9293312E38)
            if (r0 == 0) goto L_0x00a0
            com.bytedance.android.livesdk.livesetting.broadcast.LiveDisconnectRetrySetting r0 = com.bytedance.android.livesdk.livesetting.broadcast.LiveDisconnectRetrySetting.INSTANCE
            boolean r0 = r0.enable()
            if (r0 == 0) goto L_0x00a0
            r15.LJJJI = r2
            X.GO1 r1 = new X.GO1
            r1.<init>(r15)
            r0 = 2131830577(0x7f112731, float:1.9294155E38)
            r6.LIZ((int) r0, (android.content.DialogInterface.OnClickListener) r1, (boolean) r2)
            X.GNy r0 = new X.GNy
            r0.<init>(r15)
            r6.LIZIZ((int) r5, (android.content.DialogInterface.OnClickListener) r0, (boolean) r2)
        L_0x0058:
            X.HK3 r0 = r6.LIZ()
            LIZ((X.HK3) r0)
            r0 = 6
            r15.LIZLLL(r0)
            if (r7 <= 0) goto L_0x0074
        L_0x0065:
            long r10 = r15.r_()
            long r12 = r15.s_()
            boolean r14 = r15.LJIIJ
            r8 = r17
            X.C1970GNf.LIZ(r7, r8, r9, r10, r12, r14)
        L_0x0074:
            X.Cwu[] r4 = new X.Cwu[r4]
            java.lang.String r1 = java.lang.String.valueOf(r7)
            java.lang.String r0 = "errCode"
            X.Cwu r0 = X.CwZ.LIZ(r0, r1)
            r4[r2] = r0
            int r0 = r9.length()
            if (r0 <= 0) goto L_0x008a
            if (r9 != 0) goto L_0x008e
        L_0x008a:
            java.lang.String r9 = X.0VP.LIZIZ(r7)
        L_0x008e:
            java.lang.String r0 = "errMsg"
            X.Cwu r0 = X.CwZ.LIZ(r0, r9)
            r4[r3] = r0
            java.util.HashMap r1 = X.LWw.LIZJ(r4)
            X.0cO r0 = X.0cO.CreateLive
            X.0cP.LIZ(r0, r1)
            return
        L_0x00a0:
            X.GO4 r0 = new X.GO4
            r0.<init>(r15)
            r6.LIZ((int) r5, (android.content.DialogInterface.OnClickListener) r0, (boolean) r2)
            goto L_0x0058
        L_0x00a9:
            if (r7 <= 0) goto L_0x0074
            android.content.Context r1 = r15.getContext()
            r0 = 2131834019(0x7f1134a3, float:1.9301136E38)
            X.C1313Fz8.LIZ((android.content.Context) r1, (int) r0)
            r15.LIZLLL(r3)
            com.bytedance.bpea.basics.PrivacyCert$Builder$Companion r1 = com.bytedance.bpea.basics.PrivacyCert$Builder.Companion
            java.lang.String r0 = "bpea-426"
            com.bytedance.bpea.basics.PrivacyCert$Builder r5 = r1.with(r0)
            java.lang.String r0 = ""
            r5.usage(r0)
            java.lang.String r0 = "stop video/audio capture when connection fail"
            r5.tag(r0)
            X.9qj[] r1 = new X.9qj[r4]
            X.9qj r0 = com.bytedance.bpea.store.policy.PrivacyPolicyStore.getVideoPrivacyPolicy()
            r1[r2] = r0
            X.9qj r0 = com.bytedance.bpea.store.policy.PrivacyPolicyStore.getAudioPrivacyPolicy()
            r1[r3] = r0
            r5.policies(r1)
            com.bytedance.bpea.basics.PrivacyCert r0 = r5.build()
            r15.LIZ((com.bytedance.bpea.basics.Cert) r0)
            goto L_0x0065
        */
        throw new UnsupportedOperationException("Method not decompiled: com.bytedance.android.livesdk.broadcast.video.LiveBroadcastFragment.LIZ(int, int, java.lang.String):void");
    }

    public final void LIZ(double d, double d2, double d3) {
        GD1.LIZIZ.LIZ().LIZ().noticeAutoBrighten(q_().getId()).LIZ(C2007GOq.LIZ, C2008GOr.LIZ);
        C3491GtA LIZ = C3491GtA.LJFF.LIZ("livesdk_brightness_adjust_result");
        LIZ.LIZ(p_());
        LIZ.LIZ("brightness_before", Double.valueOf(d));
        LIZ.LIZ("brightness_after", Double.valueOf(d2));
        LIZ.LIZ("brightness_adjust_duration", Double.valueOf(d3 * 1000.0d));
        LIZ.LIZLLL();
    }

    /* JADX WARNING: type inference failed for: r0v3, types: [android.view.View, X.G9l] */
    public final void LIZ(String str, long j, boolean z, Integer num) {
        if (getContext() != null) {
            ? r0 = (C1612G9l) LIZ(2131367160);
            if (r0 != 0) {
                C1430G2l.LIZ((View) r0, false);
            }
            HK2 hk2 = new HK2(getContext());
            hk2.LIZIZ = str;
            hk2.LIZ(2131828242, (DialogInterface.OnClickListener) new C1988GNx(this, num), false);
            hk2.LIZIZ(2131828241, (DialogInterface.OnClickListener) new GOF(this, num), false);
            hk2.LJIILIIL = new GON(num);
            LIZ(hk2.LIZ());
            int currentTimeMillis = (int) (System.currentTimeMillis() - j);
            C3491GtA LIZ = C3491GtA.LJFF.LIZ("livesdk_close_live_duration");
            LIZ.LIZ(p_());
            LIZ.LIZ("duration", currentTimeMillis);
            LIZ.LIZ("request_succeed", z ? 1 : 0);
            LIZ.LIZLLL();
        }
    }

    /* JADX WARNING: type inference failed for: r1v0, types: [com.bytedance.android.livesdk.ui.BaseFragment, com.bytedance.android.livesdk.broadcast.video.LiveBroadcastFragment] */
    public final void LIZ(CharSequence charSequence) {
        M12.LIZ(charSequence);
        if (isViewValid()) {
            LJJIIZ().LIZ(charSequence);
        }
    }

    /* JADX WARNING: type inference failed for: r1v0, types: [com.bytedance.android.livesdk.ui.BaseFragment, com.bytedance.android.livesdk.broadcast.video.LiveBroadcastFragment] */
    public final void LIZ(boolean z, String str) {
        M12.LIZ(str);
        if (isViewValid()) {
            LJJIIZ().LIZ(z, str);
        }
    }

    /* JADX WARNING: type inference failed for: r2v0, types: [com.bytedance.android.livesdk.ui.BaseFragment, com.bytedance.android.livesdk.broadcast.video.LiveBroadcastFragment] */
    public final void LIZ(boolean z) {
        if (isViewValid()) {
            if (z) {
                C2564GeD LJJIIZ2 = LJJIIZ();
                LJJIIZ2.setCancelable(false);
                LJJIIZ2.show();
                2fU.LIZ.LIZ(LJJIIZ2);
                LJJIIZ2.LIZ((View.OnClickListener) new C2003GOm(LJJIIZ2, this));
                LJJIIZ2.LIZJ = new C1991GOa(LJJIIZ2);
                LJJIIZ2.LIZLLL = new C1992GOb(LJJIIZ2);
                return;
            }
            C1430G2l.LIZIZ((Dialog) LJJIIZ());
        }
    }

    public final void LIZ(String str) {
        0VN r3;
        M12.LIZ(str);
        if (n.LIZ(TelephonyManager.EXTRA_STATE_IDLE, str)) {
            0VN r32 = this.LJIILL;
            if (r32 != null) {
                PrivacyCert$Builder with = PrivacyCert$Builder.Companion.with("bpea-366");
                with.usage("");
                with.tag("Switch to the foreground after making a phone call during the live broadcast");
                with.policies(PrivacyPolicyStore.getVideoPrivacyPolicy(), PrivacyPolicyStore.getAudioPrivacyPolicy());
                r32.LIZ(with.build());
            }
        } else if (n.LIZ(TelephonyManager.EXTRA_STATE_OFFHOOK, str) && (r3 = this.LJIILL) != null) {
            PrivacyCert$Builder with2 = PrivacyCert$Builder.Companion.with("bpea-387");
            with2.usage("");
            with2.tag("Switch to the background when making a phone call during the live broadcast");
            with2.policies(PrivacyPolicyStore.getVideoPrivacyPolicy(), PrivacyPolicyStore.getAudioPrivacyPolicy());
            r3.LIZIZ(with2.build());
        }
    }

    public final void LIZ(BRR brr) {
        String str;
        M12.LIZ(brr);
        String str2 = brr.LIZ;
        if (str2.hashCode() == 1140027691 && str2.equals("ttlive_report_success") && brr.LIZIZ != null) {
            K4r k4r = brr.LIZIZ;
            String str3 = null;
            String LJFF2 = k4r != null ? k4r.LJFF("source") : null;
            K4r k4r2 = brr.LIZIZ;
            if (k4r2 != null) {
                str3 = k4r2.LJFF("action");
            }
            if (n.LIZ(LJFF2, "message") && n.LIZ(str3, "")) {
                K4r k4r3 = brr.LIZIZ;
                if (k4r3 == null || (str = k4r3.LJFF("content")) == null) {
                    str = "";
                }
                0AA fragmentManager = getFragmentManager();
                if (fragmentManager != null) {
                    n.LIZIZ(fragmentManager, "");
                    0cm.LIZ(IAdminSettingService.class).checkFastAddBlockKeywordsDialog(q_().getId(), str, fragmentManager, "LiveFastAddBlockKeywordsDialog");
                }
            }
        }
    }

    /* JADX WARNING: type inference failed for: r9v0, types: [com.bytedance.android.live.broadcast.BaseBroadcastFragment, androidx.fragment.app.Fragment, com.bytedance.android.livesdk.ui.BaseFragment, java.lang.Object, com.bytedance.android.livesdk.broadcast.video.LiveBroadcastFragment] */
    public final void LIZ(Bundle bundle) {
        String str;
        145 liveStreamStrategy;
        List<GP3> liveActivityTasksSetting;
        C4163H9o h9o;
        C1970GNf.LIZ = false;
        GOM gom = GOM.ENTER_BROADCAST_ROOM;
        M12.LIZ(gom);
        if (!VBoostEnableSetting.INSTANCE.isEnable()) {
            int i = 3000;
            if (C2016GOz.LIZ[gom.ordinal()] == 1) {
                i = LiveVboostDurationForStartBroadcastSetting.INSTANCE.getValue();
            }
            006.LIZ(gom.getTargetScene(), i);
        }
        DataChannelGlobal.LIZLLL.LIZ(this, this, HGS.class, new C1990GNz(this));
        C1831GHw LIZ = 0V3.LIZ.LIZ("ttlive_enter_broadcast_all");
        2sR<Float> r0 = C1781GFy.LJIL;
        n.LIZIZ(r0, "");
        LIZ.LIZ("beauty_skin", (Float) r0.LIZ());
        2sR<Float> r02 = C1781GFy.LJJ;
        n.LIZIZ(r02, "");
        LIZ.LIZ("big_eyes", (Float) r02.LIZ());
        2sR<Float> r03 = C1781GFy.LJJI;
        n.LIZIZ(r03, "");
        LIZ.LIZ("face_lift", (Float) r03.LIZ());
        2sR<Integer> r04 = C1781GFy.LJII;
        n.LIZIZ(r04, "");
        Integer num = (Integer) r04.LIZ();
        if (num != null && num.intValue() == 1) {
            str = "front";
        } else {
            str = "back";
        }
        LIZ.LIZ("camera_type", str);
        2sR<Integer> r05 = C1781GFy.LJIJI;
        n.LIZIZ(r05, "");
        LIZ.LIZ("filter_position", (Integer) r05.LIZ());
        LIZ.LIZIZ("duration", Long.valueOf(System.currentTimeMillis() - GHN.LIZ));
        0V4.LIZIZ(LIZ);
        LIZ.LIZ();
        GHN.LIZ = System.currentTimeMillis();
        GHN.LIZIZ = false;
        GHN.LJ = System.currentTimeMillis();
        this.LJJJ = System.currentTimeMillis();
        LiveBroadcastFragment.super.LIZ(bundle);
        C1773GFq.LJIIJ().LIZ(p_());
        ToV.LIZLLL = true;
        Crj crj = (Crj) ToV.LIZIZ.get("broadcast_enter");
        if (!(crj == null || (h9o = (C4163H9o) crj.getValue()) == null)) {
            h9o.LIZJ = true;
            h9o.LIZIZ();
            ToV.LJ.LIZ().postDelayed(new GOU(h9o), ToV.LIZ);
        }
        0S6.LJFF.LIZ(getContext());
        GI0.LJIIIIZZ().preloadWidgetView();
        GI0.LJIIIIZZ().preloadAnchorViewHolder();
        GI0.LJJIII().preloadBroadcastLayout();
        GJH.LiveResource.preload();
        GI0.LJII().getLivePlayController().LIZJ();
        DataChannel p_ = p_();
        p_.LIZIZ(this, 2AX.class, new C2017GPa(this));
        p_.LIZ((Object) this, 2Ak.class, new C2019GPc(this));
        p_.LIZIZ(this, 29Y.class, new GO8(this));
        p_.LIZIZ(this, GPI.class, new GKG(this));
        p_.LIZ(this, G9I.class, new GO0(this));
        p_.LIZ(this, 2AQ.class, new C2024GPh(this));
        p_.LIZ(this, C2468Gcf.class, new GOW(this));
        p_.LIZ(this, C2467Gce.class, new GK9(this));
        p_.LIZ(this, 2BJ.class, new C2023GPg(this));
        p_.LIZ(this, C2440GcD.class, new C1982GNr(this));
        p_.LIZ(this, C1208FxR.class, new C1822GHn(this));
        p_.LIZ(this, C2483Gcu.class, new GO7(this));
        p_.LIZ(this, C2470Gch.class, new GOX(this));
        if (86a.LIZ("referral_task", (String) DataChannelGlobal.LIZLLL.LIZIZ(HEM.class)) && (liveActivityTasksSetting = GI0.LJ().getLiveActivityTasksSetting()) != null && liveActivityTasksSetting.size() > 0) {
            for (GP3 gp3 : liveActivityTasksSetting) {
                n.LIZIZ(gp3, "");
                Integer num2 = gp3.LIZIZ;
                if (num2 != null && num2.intValue() == 4) {
                    Long l = gp3.LIZJ;
                    n.LIZIZ(l, "");
                    2cN LIZLLL = PgU.LIZ(l.longValue(), TimeUnit.SECONDS, Mk2.LIZ(Mk3.LIZ)).LIZLLL(new C1985GNu(gp3));
                    List<2cN> list = this.LJJJJI;
                    n.LIZIZ(LIZLLL, "");
                    list.add(LIZLLL);
                }
            }
        }
        LIZ(C2047GQe.class);
        LIZ(GJB.class);
        register(GI0.LJFF().registerAppEnterForeBackgroundCallback(this.LJJJJL));
        0Uu.LIZJ = true;
        LivePerformanceManager.getInstance().setExtraParams(0Uu.LIZ);
        DataChannelGlobal.LIZLLL.LIZIZ(C4329HFy.class, Long.valueOf(System.currentTimeMillis()));
        IPullStreamService LIZ2 = 0cm.LIZ(IPullStreamService.class);
        if (!(LIZ2 == null || (liveStreamStrategy = LIZ2.getLiveStreamStrategy()) == null)) {
            liveStreamStrategy.LIZ();
        }
        if (!this.LJJJJ) {
            C5629HmY.LIZ("ttlive_report_success", (C5633Hmc) this);
            this.LJJJJ = true;
        }
    }

    public final DataChannel LJ() {
        return p_();
    }

    private final void LJJIJ() {
        if (!this.LJJIZ) {
            LJ(3);
            this.LJJIZ = true;
        }
    }

    private final G9W LJJIJIL() {
        return (G9W) p_().LIZIZ(2Ak.class);
    }

    public final void LJIIZILJ() {
        0V3.LIZ.LIZ("ttlive_low_network").LIZ();
    }

    public final void LJIJ() {
        0Uz.LIZ("capture_first_frame", String.valueOf(System.currentTimeMillis()));
    }

    public final void n_() {
        C1313Fz8.LIZ(getContext(), 2131834054);
    }

    public final void LJIIIIZZ() {
        LiveBroadcastFragment.super.LJIIIIZZ();
        C1831GHw LIZ = 0V3.LIZ.LIZ("ttlive_page_start");
        LIZ.LIZIZ("broadcast");
        LIZ.LIZ();
    }

    public final boolean LJJIII() {
        G9W LJJIJIL2 = LJJIJIL();
        if (LJJIJIL2 != null && LJJIJIL2.LIZ == 0) {
            return true;
        }
        G9W LJJIJIL3 = LJJIJIL();
        if (LJJIJIL3 == null || LJJIJIL3.LIZ != 2) {
            return false;
        }
        return true;
    }

    /* JADX WARNING: type inference failed for: r2v0, types: [com.bytedance.android.livesdk.ui.BaseFragment, com.bytedance.android.livesdk.broadcast.video.LiveBroadcastFragment] */
    public final void m_() {
        if (isViewValid()) {
            C2564GeD LJJIIZ2 = LJJIIZ();
            new GC9(this);
            LJJIIZ2.LIZ();
        }
    }

    static {
        Covode.recordClassIndex(12617);
    }

    private final JSONObject LJJIJIIJI() {
        String str;
        String str2;
        JSONObject jSONObject = new JSONObject();
        1Ol LIZ = 1Ol.LLFII.LIZ();
        if (LIZ.LJIILLIIL) {
            str = "inviter";
        } else {
            str = "invitee";
        }
        jSONObject.put("role_type", str);
        if (LIZ.LJIILIIL) {
            str2 = "random";
        } else {
            str2 = "normal";
        }
        jSONObject.put("from", str2);
        return jSONObject;
    }

    public final void LIZLLL() {
        if (!this.LJJIL) {
            C1313Fz8.LIZ(getContext(), 2131834020);
            C3491GtA LIZ = C3491GtA.LJFF.LIZ("livesdk_anchor_network_error");
            LIZ.LIZ("error_type", "1");
            LIZ.LIZLLL();
            0V3.LIZ.LIZ("ttlive_reconnect_stream").LIZ();
        }
        LJ(2);
    }

    public final void LJIIIZ() {
        0Xo r1;
        LiveBroadcastFragment.super.LJIIIZ();
        C1831GHw LIZ = 0V3.LIZ.LIZ("ttlive_page_stop");
        LIZ.LIZIZ("broadcast");
        LIZ.LIZ();
        if (!this.LJJIL && LJIJJLI().LIZ.getValue() != C1998GOh.STREAM_ON && (r1 = this.LJIJI) != null) {
            r1.LIZIZ(2);
        }
    }

    public final void LJIILLIIL() {
        C1313Fz8.LIZ(getContext(), 2131834052);
        C3491GtA LIZ = C3491GtA.LJFF.LIZ("livesdk_anchor_network_error");
        LIZ.LIZ("error_type", "2");
        LIZ.LIZLLL();
        0V3.LIZ.LIZ("ttlive_reconnect_stream_success").LIZ();
    }

    public final void LJIJI() {
        Message obtain = Message.obtain(0Uz.LIZ, 1);
        obtain.obj = new Pair("live_type", "video");
        0Uz.LIZ.sendMessage(obtain);
        0Uz.LIZ("rtmp_connected", String.valueOf(System.currentTimeMillis()));
        0Uz.LIZ();
    }

    public final void LJJI() {
        1f0 r2 = this.LJIIZILJ;
        if (r2 != null) {
            r2.LIZ();
            0AP LIZ = getChildFragmentManager().LIZ();
            LIZ.LIZ(r2.LIZIZ());
            LIZ.LJ();
            this.LJIIZILJ = null;
            VideoWidget videoWidget = this.LJIILLIIL;
            if (videoWidget != null) {
                videoWidget.LIZ();
            }
            LiveWidgetProvider.Companion.getInstance().clear();
        }
    }

    public final void LJJII() {
        C3491GtA LIZ = C3491GtA.LJFF.LIZ("anchor_close_live_cancel");
        LIZ.LIZ(p_());
        LIZ.LIZ("live_type", "video_live");
        LIZ.LIZLLL();
        C1006FuB.LIZ(getContext());
        s_();
    }

    public final void LJJIIJ() {
        Runnable poll;
        if (!this.LJIILJJIL && LJJIIZI().size() > 0) {
            LJJIIZI().poll();
            if (LJJIIZI().size() > 0 && (poll = LJJIIZI().poll()) != null) {
                poll.run();
            }
        }
    }

    private final void LJJIJIIJIL() {
        String str;
        if (this.LJJJ > 0) {
            long currentTimeMillis = System.currentTimeMillis() - this.LJJJ;
            long j = this.LJIIL;
            this.LJIIL = 0;
            this.LJJJ = 0;
            if (j > 0) {
                C3491GtA LIZ = C3491GtA.LJFF.LIZ("livesdk_gift_effect_show_summary");
                LIZ.LIZ(p_());
                LIZ.LIZ("duration_room", String.valueOf(currentTimeMillis));
                LIZ.LIZ("duration_gift_effect", String.valueOf(j));
                LIZ.LIZ("gift_effect_live_ratio", String.valueOf((((double) j) * 1.0d) / ((double) currentTimeMillis)));
                Object LIZIZ = p_().LIZIZ(C1059Fv2.class);
                if (LIZIZ == null) {
                    n.LIZIZ();
                }
                if (((Boolean) LIZIZ).booleanValue()) {
                    str = "1";
                } else {
                    str = "0";
                }
                LIZ.LIZ("is_anchor", str);
                LIZ.LIZ("room_type", "video");
                LIZ.LIZLLL();
            }
        }
    }

    /* JADX WARNING: type inference failed for: r4v0, types: [com.bytedance.android.livesdk.ui.BaseFragment, androidx.fragment.app.Fragment, com.bytedance.android.livesdk.broadcast.video.LiveBroadcastFragment] */
    public final void LJFF() {
        IllegalReviewDialog illegalReviewDialog;
        if (isViewValid()) {
            HashMap hashMap = new HashMap();
            hashMap.put("show_illegal_review_dialog", true);
            0c0.LIZ("ttlive_broadcast_action_all", 0, hashMap);
            if (this.LJJJJIZL == null) {
                Context context = getContext();
                C2010GOt gOt = this.LJI;
                if (gOt == null) {
                    n.LIZ("");
                }
                this.LJJJJIZL = IllegalReviewDialog.LIZ(context, gOt);
                C2010GOt gOt2 = this.LJI;
                if (gOt2 == null) {
                    n.LIZ("");
                }
                gOt2.LJII = this.LJJJJIZL;
            }
            if (getActivity() != null && (illegalReviewDialog = this.LJJJJIZL) != null) {
                0AA childFragmentManager = getChildFragmentManager();
                n.LIZIZ(childFragmentManager, "");
                illegalReviewDialog.show(childFragmentManager, "IllegalReviewDialog");
            }
        }
    }

    public final boolean LJIIL() {
        0AA supportFragmentManager;
        List<Fragment> LJFF2;
        1hK activity = getActivity();
        if (!(activity == null || (supportFragmentManager = activity.getSupportFragmentManager()) == null || (LJFF2 = supportFragmentManager.LJFF()) == null)) {
            for (Fragment fragment : LJFF2) {
                if (!(fragment instanceof C1U)) {
                    fragment = null;
                }
                C1U c1u = (C1U) fragment;
                if (c1u != null && c1u.LJIIIIZZ()) {
                    return true;
                }
            }
        }
        0AA childFragmentManager = getChildFragmentManager();
        n.LIZIZ(childFragmentManager, "");
        List<Fragment> LJFF3 = childFragmentManager.LJFF();
        n.LIZIZ(LJFF3, "");
        for (Fragment fragment2 : LJFF3) {
            if (!(fragment2 instanceof C1U)) {
                fragment2 = null;
            }
            C1U c1u2 = (C1U) fragment2;
            if (c1u2 != null && c1u2.LJIIIIZZ()) {
                return true;
            }
        }
        return false;
    }

    public final void LJJ() {
        if (q_().getRoomAuthStatus() != null && q_().getRoomAuthStatus().enableGift) {
            1Mn.LIZ.post(new GOJ(this), p_());
            1Mn.LIZ.post(new GOO(this), p_());
            1Mn.LIZ.post(new GOI(this), p_());
        }
    }

    public final void o_() {
        LJJIFFI();
        LIZLLL(8);
        C1970GNf.LIZIZ(10004, r_(), s_(), this.LJIIJ);
        0aP.LIZ(3, "LiveBroadcastFragment", "room close forceEndLive");
        PrivacyCert$Builder with = PrivacyCert$Builder.Companion.with("bpea-422");
        with.usage("");
        with.tag("stop video/audio capture when live ends");
        with.policies(PrivacyPolicyStore.getVideoPrivacyPolicy(), PrivacyPolicyStore.getAudioPrivacyPolicy());
        LIZ((Cert) with.build());
    }

    public final void LJI() {
        LiveBroadcastFragment.super.LJI();
        LIZ(p_(), false);
        ToV.LJ.LJFF();
        LJIJJLI().LIZ.setValue(C1998GOh.STREAM_PAUSE);
        IntentFilter intentFilter = new IntentFilter("android.intent.action.PHONE_STATE");
        GP5 gp5 = this.LJFF;
        if (gp5 == null) {
            n.LIZ("");
        }
        GOT got = this.LJJIJLIJ;
        if (got == null) {
            n.LIZ("");
        }
        gp5.LIZ(got, intentFilter);
        Boolean bool = null;
        if (this.LJJIL) {
            LJIJJ().removeCallbacksAndMessages((Object) null);
            return;
        }
        PrivacyCert$Builder with = PrivacyCert$Builder.Companion.with("bpea-365");
        with.usage("");
        with.tag("Switch from background to foreground during live broadcast");
        with.policies(PrivacyPolicyStore.getVideoPrivacyPolicy(), PrivacyPolicyStore.getAudioPrivacyPolicy());
        PrivacyCert build = with.build();
        if (!LivePauseLiveSetting.INSTANCE.pauseLiveEnabled()) {
            0VN r0 = this.LJIILL;
            if (r0 != null) {
                r0.LIZ(build);
            }
            0Xo r02 = this.LJIJI;
            if (r02 != null) {
                r02.LIZ(2);
            }
        } else if (C1430G2l.LIZIZ((Boolean) p_().LIZIZ(C1185Fx4.class))) {
            0VN r03 = this.LJIILL;
            if (r03 != null) {
                r03.LJIIJ(build);
            }
            0Xo r04 = this.LJIJI;
            if (r04 != null) {
                r04.LIZ(2);
            }
        } else {
            0Xo r1 = this.LJIJI;
            if (r1 != null && r1.LIZIZ) {
                r1.LIZ(3, 0, 1);
            }
        }
        C1831GHw LIZ = 0V3.LIZ.LIZ("ttlive_page_resume");
        LIZ.LIZIZ("broadcast");
        LIZ.LIZ();
        C1773GFq.LJ().LIZJ();
        DataChannel LIZ2 = GSF.LIZ((Fragment) this);
        if (LIZ2 != null) {
            bool = (Boolean) LIZ2.LIZIZ(C1099Fvg.class);
        }
        if (C1430G2l.LIZIZ(bool) && !C1773GFq.LJIIIZ().LIZIZ()) {
            GI0.LJIILJJIL().resumeAccompanimentPlay();
        }
    }

    public final void LJII() {
        LiveBroadcastFragment.super.LJII();
        LIZ(p_(), true);
        if (LJIJJLI().LIZ.getValue() != C1998GOh.STREAM_ON) {
            GP5 gp5 = this.LJFF;
            if (gp5 == null) {
                n.LIZ("");
            }
            GOT got = this.LJJIJLIJ;
            if (got == null) {
                n.LIZ("");
            }
            gp5.LIZ((BroadcastReceiver) got);
            PrivacyCert$Builder with = PrivacyCert$Builder.Companion.with("bpea-386");
            with.usage("");
            with.tag("Switch to background during live broadcast");
            with.policies(PrivacyPolicyStore.getVideoPrivacyPolicy(), PrivacyPolicyStore.getAudioPrivacyPolicy());
            PrivacyCert build = with.build();
            if (LivePauseLiveSetting.INSTANCE.pauseLiveEnabled()) {
                HI7 hi7 = this.LJJII;
                if (hi7 != null) {
                    hi7.LIZ(build);
                }
            } else {
                0VN r0 = this.LJIILL;
                if (r0 != null) {
                    r0.LIZIZ(build);
                }
            }
            C1773GFq.LIZ(false);
        }
        C1831GHw LIZ = 0V3.LIZ.LIZ("ttlive_page_pause");
        LIZ.LIZIZ("broadcast");
        LIZ.LIZ();
        ToV.LJ.LJI();
    }

    public final void LJIILIIL() {
        LiveBroadcastFragment.super.LJIILIIL();
        0ez LJI2 = C1773GFq.LJI();
        LJI2.LIZ(true);
        LJI2.LIZ(p_());
        LJI2.LIZIZ(p_());
        LJI2.LIZ();
        LJI2.LIZIZ();
        0f9 LJII2 = C1773GFq.LJII();
        LJII2.LIZ(true);
        LJII2.LIZ(p_());
        LJII2.LIZIZ(p_());
        LJII2.LIZ();
        LJII2.LIZIZ(true);
        0fD LJIIIIZZ2 = C1773GFq.LJIIIIZZ();
        LJIIIIZZ2.LIZ(true);
        LJIIIIZZ2.LIZ(p_());
        LJIIIIZZ2.LIZIZ(p_());
        LJIIIIZZ2.LIZ();
        LJIIIIZZ2.LIZIZ(false);
        1Mn.LIZJ();
        LJJI();
        0Xo r0 = this.LJIJI;
        if (r0 != null) {
            r0.LIZ.removeCallbacksAndMessages((Object) null);
        }
        0VN r4 = this.LJIILL;
        if (r4 != null) {
            PrivacyCert$Builder with = PrivacyCert$Builder.Companion.with("bpea-487");
            with.usage("");
            with.tag("release when live ends");
            with.policies(PrivacyPolicyStore.getVideoPrivacyPolicy(), PrivacyPolicyStore.getAudioPrivacyPolicy());
            r4.LIZJ(with.build());
        }
        C2010GOt gOt = this.LJI;
        if (gOt == null) {
            n.LIZ("");
        }
        gOt.f_();
        C1430G2l.LIZIZ((Dialog) LJJIIZ());
        GI0.LIZ().release(s_());
        1Ol.LLFII.LIZ(s_(), "LiveBroadcastFragment_OnDestroy");
    }

    public final void LJJIFFI() {
        if (!this.LJJJIL) {
            this.LJJJIL = true;
            LiveMessageSEI liveMessageSEI = new LiveMessageSEI();
            liveMessageSEI.LIZIZ = System.currentTimeMillis();
            LiveMessageID liveMessageID = new LiveMessageID();
            liveMessageID.LIZ = String.valueOf(s_());
            liveMessageID.LIZIZ = "end_room";
            liveMessageSEI.LIZ = liveMessageID;
            0VN r2 = this.LJIILL;
            if (r2 != null) {
                r2.LIZ("live_message_sei", 0UO.LIZIZ.LIZIZ(liveMessageSEI));
            }
        }
        LJIJJ().removeCallbacksAndMessages((Object) null);
        if (this.LJI != null) {
            C2010GOt gOt = this.LJI;
            if (gOt == null) {
                n.LIZ("");
            }
            gOt.LIZJ();
        }
        this.LJJIL = true;
        0cP.LIZJ(0cO.CreateLive);
        LJJIJIIJIL();
        LivePerformanceManager.getInstance().onExitRoom();
        JSONObject LJJIJIIJI2 = LJJIJIIJI();
        0bv.LIZ(LJJIJIIJI2, "end_reason", "user_leave");
        C5097Hdy.LIZ.LIZ(2, LJJIJIIJI2);
        C5099He0.LIZ.LIZ(2, LJJIJIIJI2);
        TLk.LIZIZ.LIZ(2, LJJIJIIJI2);
        TLj.LIZ.LIZ(1, LJJIJIIJI2);
        C5098Hdz.LIZ.LIZ(2, LJJIJIIJI2);
    }

    public final void LJIILJJIL() {
        IWalletExchange walletExchange;
        LiveBroadcastFragment.super.LJIILJJIL();
        C1962GMx.LJ.LIZ();
        LJJIJ();
        IWalletService LIZ = 0cm.LIZ(IWalletService.class);
        if (!(LIZ == null || (walletExchange = LIZ.walletExchange()) == null)) {
            walletExchange.LIZJ();
        }
        2cN r0 = 0Xk.LIZ;
        if (r0 != null) {
            r0.dispose();
        }
        2cN r02 = 0Xk.LIZIZ;
        if (r02 != null) {
            r02.dispose();
        }
        0Xk.LIZ = null;
        0Xk.LIZIZ = null;
        0Xk.LIZJ.clear();
        p_().LIZIZ((Object) this);
        0bV.LIZ().removeCallbacksAndMessages((Object) null);
        0ed.LIZ().removeCallbacksAndMessages((Object) null);
        LJIJJ().removeCallbacksAndMessages((Object) null);
        LivePerformanceManager.getInstance().reportBatteryDrainage();
        LJJIFFI();
        DataChannelGlobal.LIZLLL.LIZJ(HEP.class);
        if (LJJIIJZLJL) {
            DataChannelGlobal.LIZLLL.LIZJ(HEU.class);
            DataChannelGlobal.LIZLLL.LIZJ(2Cp.class);
            LJJIIJZLJL = false;
        }
        DataChannelGlobal.LIZLLL.LIZJ(28L.class);
        GI0.LJII().getLivePlayController().LIZLLL();
        try {
            GI0.LJIIL().clearAssets("effects");
        } catch (IllegalStateException e) {
            0aP.LIZJ(e.toString());
        }
        C1831GHw LIZ2 = 0V3.LIZ.LIZ("ttlive_page_destroy");
        LIZ2.LIZIZ("broadcast");
        LIZ2.LIZ();
        IPerformanceManager instance = LivePerformanceManager.getInstance();
        instance.onModuleStop("stream");
        instance.stopTimerMonitor();
        instance.release();
        instance.setVideoCaptureFps(-1.0f);
        instance.setPreviewFps(-1.0f);
        instance.setStreamFps(-1.0d);
        0Uu.LIZIZ.clear();
        0Uu.LIZ.clear();
        0Uu.LIZJ = false;
        LivePerformanceManager.getInstance().setExtraParams((Map<String, String>) null);
        ToV.LJ.LJIIIIZZ();
        LJIL().LIZIZ(this.LJJJJLI);
        LJIL().LIZIZ();
        0S6.LJFF.LIZ();
        GI0.LJIIZILJ().releaseToolbarView();
        DataChannelGlobal.LIZLLL.LIZJ(HEN.class);
        for (2cN dispose : this.LJJJJI) {
            dispose.dispose();
        }
        2cN r03 = this.LJJIFFI;
        if (r03 != null) {
            r03.dispose();
        }
        GI0.LJIILJJIL().releaseAccompanimentResources();
        C1951GMm.LIZ.clear();
        if (this.LJJJJ) {
            C5629HmY.LIZIZ("ttlive_report_success", (C5633Hmc) this);
            this.LJJJJ = false;
        }
        C1788GGf.LJFF.LIZ();
    }

    public final void LIZ() {
        this.LJIIJ = false;
        1f0 r0 = this.LJIIZILJ;
        if (r0 != null) {
            r0.LJII();
        }
        WeakHandler LJIJJ2 = LJIJJ();
        M12.LIZ(LJIJJ2);
        if (!GHN.LIZIZ) {
            0cP.LIZJ(0cO.CreateLive);
            C1831GHw LIZ = 0V3.LIZ.LIZ("ttlive_start_push_video_stream_all");
            LIZ.LIZIZ("duration", Long.valueOf(System.currentTimeMillis() - GHN.LIZ));
            0V4.LIZIZ(LIZ);
            LIZ.LIZ();
            LJIJJ2.postDelayed(new GHO("ttlive_push_video_stream_five_all"), 300000);
            LJIJJ2.postDelayed(new GHO("ttlive_push_video_stream_fifteen_all"), 900000);
            LJIJJ2.postDelayed(new GHO("ttlive_push_video_stream_twenty_five_all"), 1500000);
            GHN.LIZIZ = true;
            long currentTimeMillis = System.currentTimeMillis();
            if (!(GHN.LIZJ == 0 || GHN.LJI == 0 || GHN.LIZLLL == 0 || GHN.LJI == 0)) {
                C3491GtA LIZ2 = C3491GtA.LJFF.LIZ("livesdk_broadcast_duration");
                LIZ2.LIZ();
                LIZ2.LIZ("first_show_camera_user", GHN.LJI - GHN.LIZJ);
                LIZ2.LIZ("first_push_stream_user", currentTimeMillis - GHN.LIZJ);
                LIZ2.LIZ("first_show_camera_launch", GHN.LJI - GHN.LIZLLL);
                LIZ2.LIZ("first_push_stream_launch", currentTimeMillis - GHN.LIZLLL);
                LIZ2.LIZ("video_broadcast_create_launch", GHN.LJFF - GHN.LIZLLL);
                LIZ2.LIZ("max_bitrate", GHN.LJIIIIZZ);
                LIZ2.LIZ("min_bitrate", GHN.LJIIIZ);
                LIZ2.LIZ("default_bitrate", GHN.LJIIJ);
                LIZ2.LIZ("is_bytevc1", GHN.LJIIJJI ? 1 : 0);
                LIZ2.LIZ("is_hw", GHN.LJIIL ? 1 : 0);
                LIZ2.LIZ("definition", GHN.LJIILIIL);
                LIZ2.LIZLLL();
            }
            GHN.LJII = System.currentTimeMillis();
        }
        LJ(1);
    }

    public static final /* synthetic */ C2010GOt LIZ(LiveBroadcastFragment liveBroadcastFragment) {
        C2010GOt gOt = liveBroadcastFragment.LJI;
        if (gOt == null) {
            n.LIZ("");
        }
        return gOt;
    }

    public static void LIZ(HK3 hk3) {
        hk3.show();
        2fU.LIZ.LIZ(hk3);
    }

    /* JADX WARNING: type inference failed for: r1v0, types: [com.bytedance.android.livesdk.ui.BaseFragment, com.bytedance.android.livesdk.broadcast.video.LiveBroadcastFragment] */
    public final void LIZIZ(CharSequence charSequence) {
        M12.LIZ(charSequence);
        if (isViewValid()) {
            LJJIIZ().LIZIZ(charSequence);
        }
    }

    /* JADX WARNING: type inference failed for: r3v0, types: [com.bytedance.android.live.broadcast.BaseBroadcastFragment, com.bytedance.android.livesdk.ui.BaseFragment, com.bytedance.android.livesdk.broadcast.video.LiveBroadcastFragment] */
    public final void LIZJ(int i) {
        if (isViewValid()) {
            p_().LIZJ(C2449GcM.class, Integer.valueOf(i));
            1f0 r0 = this.LJIIZILJ;
            if (r0 != null) {
                r0.LIZIZ(i);
            }
        }
    }

    public final void LIZLLL(int i) {
        0aP.LIZ(3, "LiveBroadcastFragment", "stopLive: reason=".concat(String.valueOf(i)));
        0Xo r0 = this.LJIJI;
        if (r0 != null) {
            r0.LIZJ(i);
        }
    }

    private final <T> void LIZ(Class<T> cls) {
        ((C4366HHj) C2675Gg0.LIZ().LIZ(cls).LIZ(Mk2.LIZ(Mk3.LIZ)).LIZ(DEF.LIZ(this))).LIZ(new GOK(this), GP0.LIZ);
    }

    private final void LJ(int i) {
        GD1.LIZIZ.LIZ().LIZJ().sendStreamStatus(q_().getId(), i, q_().getStreamId(), System.currentTimeMillis()).LJI(Pm5.LIZ(1, 500)).LIZ(GP1.LIZ, GP2.LIZ);
    }

    public final void onEvent(C2047GQe gQe) {
        M12.LIZ(gQe);
        for (Gift gift : GI0.LJIIL().getStickerGifts()) {
            n.LIZIZ(gift, "");
            if (gift.LJIILIIL == gQe.LIZ) {
                C1642GAp.LIZ(s_());
                return;
            }
        }
    }

    public final void LIZIZ(int i) {
        int i2 = i;
        if (i2 == 30001 || i2 == 30003 || i2 == 50002) {
            PrivacyCert$Builder with = PrivacyCert$Builder.Companion.with("bpea-423");
            with.usage("");
            with.tag("stop video/audio capture when live ends");
            with.policies(PrivacyPolicyStore.getVideoPrivacyPolicy(), PrivacyPolicyStore.getAudioPrivacyPolicy());
            LIZ(false, (Cert) with.build());
            C1970GNf.LIZ(i2, r_(), s_(), this.LJIIJ);
        }
    }

    public final void LIZIZ(Bundle bundle) {
        LiveBroadcastFragment.super.LIZIZ(bundle);
        GI0.LJII().getGpuInfoFetcher().LIZ(getActivity(), getView(), C2005GOo.LIZ);
        0Uz.LIZ("live_page_load", String.valueOf(System.currentTimeMillis()));
        long currentTimeMillis = System.currentTimeMillis();
        1Mn.LIZIZ(new GHM(currentTimeMillis));
        GHN.LIZ = currentTimeMillis;
        GHN.LJFF = currentTimeMillis;
        GJJ.LIZ().LIZIZ();
        0VN LIZIZ = C1962GMx.LJ.LIZIZ();
        if (LIZIZ != null) {
            LIZIZ.LIZLLL = this;
            DataChannelGlobal.LIZLLL.LIZ(28L.class, LIZIZ);
        } else {
            LIZIZ = null;
        }
        this.LJIILL = LIZIZ;
        C1965GNa gNa = this.LJJJJJL;
        StreamUrlExtra streamUrlExtra = this.LJ;
        if (streamUrlExtra == null) {
            n.LIZ("");
        }
        this.LJIILLIIL = new VideoWidget(gNa, streamUrlExtra, this.LJIILL);
        ((WidgetManager) this.LJJIIZI.getValue()).load(2131368812, this.LJIILLIIL, false);
        View view = getView();
        if (view != null) {
            view.post(new C1983GNs(this));
        }
    }

    public final void LIZJ(Cert cert) {
        C3491GtA LIZ = C3491GtA.LJFF.LIZ("anchor_close_live_confirm");
        LIZ.LIZ(p_());
        LIZ.LIZ("live_type", "video_live");
        LIZ.LIZLLL();
        C2833GiY LIZ2 = C2833GiY.LIZ();
        n.LIZIZ(LIZ2, "");
        Boolean bool = (Boolean) LIZ2.LJIILIIL;
        n.LIZIZ(bool, "");
        if (bool.booleanValue()) {
            1sP LIZ3 = LIZ(2131367151);
            if (LIZ3 != null) {
                LIZ3.postDelayed(new GOE(this, cert), 1000);
            }
        } else {
            LJJIFFI();
            LIZLLL(1);
            PrivacyCert$Builder with = PrivacyCert$Builder.Companion.with("bpea-429");
            with.usage("");
            with.tag("stop video/audio capture when live ends");
            with.policies(PrivacyPolicyStore.getVideoPrivacyPolicy(), PrivacyPolicyStore.getAudioPrivacyPolicy());
            LIZ((Cert) with.build());
            C1970GNf.LIZIZ(10001, r_(), s_(), this.LJIIJ);
        }
        1Om.LIZ().LIZ(0);
    }

    public final void handleMsg(Message message) {
        M12.LIZ(message);
        int i = 0;
        if (message.what == 3) {
            Object obj = message.obj;
            if (!(obj instanceof 1JF)) {
                obj = null;
            }
            0UM r1 = (0UM) obj;
            if (r1 != null) {
                i = r1.getErrorCode();
            }
            LIZIZ(i);
        } else if (message.obj instanceof Exception) {
            if (message.what == 13) {
                0aP.LIZ(6, "LiveBroadcastFragment", "fetch ngb rtmp url failed");
                this.LJII = false;
                PrivacyCert$Builder with = PrivacyCert$Builder.Companion.with("bpea-459");
                with.usage("");
                with.tag("start audio capture when live starts");
                with.policies(PrivacyPolicyStore.getAudioPrivacyPolicy());
                LIZIZ((Cert) with.build());
            }
        } else if (message.what == 13) {
            this.LJII = false;
            Object obj2 = message.obj;
            Objects.requireNonNull(obj2, "null cannot be cast to non-null type kotlin.String");
            String str = (String) obj2;
            StreamUrl streamUrl = q_().getStreamUrl();
            StringBuilder sb = new StringBuilder();
            sb.append(str);
            StreamUrlExtra streamUrlExtra = this.LJ;
            if (streamUrlExtra == null) {
                n.LIZ("");
            }
            sb.append(streamUrlExtra.LIZIZ);
            streamUrl.LJIILL = sb.toString();
            0aP.LIZ(3, "LiveBroadcastFragment", "fetch ngb RTMP url, url = ".concat(String.valueOf(str)));
            PrivacyCert$Builder with2 = PrivacyCert$Builder.Companion.with("bpea-460");
            with2.usage("");
            with2.tag("start audio capture when live starts");
            with2.policies(PrivacyPolicyStore.getAudioPrivacyPolicy());
            LIZIZ((Cert) with2.build());
        }
    }

    /* JADX WARNING: type inference failed for: r6v0, types: [com.bytedance.android.live.broadcast.BaseBroadcastFragment, com.bytedance.android.livesdk.ui.BaseFragment, com.bytedance.android.livesdk.broadcast.video.LiveBroadcastFragment] */
    public final void LIZIZ(Cert cert) {
        ILiveStream iLiveStream;
        if (this.mStatusActive && !this.LJJIL && !this.LJIIIZ) {
            StreamUrl streamUrl = q_().getStreamUrl();
            n.LIZIZ(streamUrl, "");
            String str = streamUrl.LJIILLIIL;
            if (str == null || str.length() == 0) {
                StreamUrl streamUrl2 = q_().getStreamUrl();
                n.LIZIZ(streamUrl2, "");
                StreamUrl streamUrl3 = q_().getStreamUrl();
                n.LIZIZ(streamUrl3, "");
                streamUrl2.LJIILLIIL = streamUrl3.LIZ();
            }
            0VN r0 = this.LJIILL;
            if (r0 != null) {
                r0.LJII(cert);
            }
            0Xg.LIZ("capture_audio");
            0Xk r1 = 0Xk.LJ;
            0VN r02 = this.LJIILL;
            LiveCore liveCore = null;
            if (r02 != null) {
                iLiveStream = r02.LJ();
            } else {
                iLiveStream = null;
            }
            r1.LIZ(iLiveStream);
            C1831GHw LIZ = 0V3.LIZ.LIZ("ttlive_stream_url");
            if (LiveStreamEnableUrlListSetting.INSTANCE.enable()) {
                0VN r12 = this.LJIILL;
                if (r12 != null) {
                    StreamUrl streamUrl4 = q_().getStreamUrl();
                    n.LIZIZ(streamUrl4, "");
                    r12.LIZ(streamUrl4.LJ);
                }
                StreamUrl streamUrl5 = q_().getStreamUrl();
                n.LIZIZ(streamUrl5, "");
                LIZ.LIZ("url_list", streamUrl5.LJ.toString());
            } else {
                0VN r13 = this.LJIILL;
                if (r13 != null) {
                    StreamUrl streamUrl6 = q_().getStreamUrl();
                    n.LIZIZ(streamUrl6, "");
                    r13.LIZ(streamUrl6.LJIILLIIL);
                }
                StreamUrl streamUrl7 = q_().getStreamUrl();
                n.LIZIZ(streamUrl7, "");
                LIZ.LIZ("url", streamUrl7.LJIILLIIL);
            }
            LIZ.LIZ();
            0Xk r14 = 0Xk.LJ;
            0VN r03 = this.LJIILL;
            if (r03 != null) {
                liveCore = r03.LJ();
            }
            r14.LIZIZ(liveCore);
            p_().LIZIZ(28N.class, true);
        }
    }

    public final void LIZJ(boolean z) {
        String str;
        if (!this.LJIILJJIL) {
            2sR<Integer> r0 = C1781GFy.LLJL;
            n.LIZIZ(r0, "");
            Integer num = (Integer) r0.LIZ();
            if (num.intValue() >= 5) {
                this.LJJIII = false;
            } else if (this.LJJIII) {
                if (LJJIIZI().size() == 0 || z) {
                    this.LJJIII = false;
                    FrameLayout frameLayout = (FrameLayout) LIZ(2131366090);
                    n.LIZIZ(frameLayout, "");
                    frameLayout.setClickable(true);
                    FrameLayout frameLayout2 = (FrameLayout) LIZ(2131366090);
                    n.LIZIZ(frameLayout2, "");
                    frameLayout2.setVisibility(0);
                    0bT r5 = new 0bT();
                    0bT r1 = new 0bT();
                    2us r02 = new 2us();
                    r02.element = 2;
                    GOL gol = new GOL(r02, r5, r1);
                    1sP LIZ = LIZ(2131365467);
                    n.LIZIZ(LIZ, "");
                    r5.LIZ(LIZ);
                    r5.LIZ("tiktok_live_broadcast_resource");
                    r5.LIZIZ = false;
                    r5.LIZLLL = 3;
                    r5.LIZ(new GO2(this, r1, gol));
                    1sP LIZ2 = LIZ(2131370575);
                    n.LIZIZ(LIZ2, "");
                    r1.LIZ(LIZ2);
                    r1.LIZ("tiktok_live_broadcast_resource");
                    r1.LIZIZ = false;
                    r1.LIZJ = true;
                    r1.LIZLLL = 3;
                    r1.LIZ(new GOA(this, gol));
                    if (0b0.LJI()) {
                        r5.LIZIZ("ttlive_livecenter_guide_hand.webp");
                        r1.LIZIZ("ttlive_livecenter_guide_black_line.webp");
                        0bX.LIZ(r5);
                        0bX.LIZ(r1);
                    } else {
                        r5.LIZIZ("ttlive_livecenter_guide_hand_rtl.webp");
                        r1.LIZIZ("ttlive_livecenter_guide_black_line_rtl.webp");
                        0bX.LIZ(r5);
                        0bX.LIZ(r1);
                    }
                    LIZ(2131365473).LIZ(2131886883);
                    1jk LIZ3 = LIZ(2131365473);
                    n.LIZIZ(LIZ3, "");
                    LIZ3.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 GOC(this, animatorSet, r5));
                    C3491GtA LIZ4 = C3491GtA.LJFF.LIZ("livesdk_extended_comment_filed_guidence");
                    LIZ4.LJII(String.valueOf(q_().getOwnerUserId()));
                    LIZ4.LJIIIIZZ(String.valueOf(s_()));
                    C1856GIv streamType = q_().getStreamType();
                    if (streamType != null) {
                        str = C1393G1a.LIZ(streamType);
                    } else {
                        str = null;
                    }
                    LIZ4.LIZIZ(str);
                    LIZ4.LIZLLL();
                    2sR<Integer> r12 = C1781GFy.LLJL;
                    n.LIZIZ(r12, "");
                    r12.LIZ(Integer.valueOf(num.intValue() + 1));
                }
                if (!LJJIIZI().contains(this.LJJJJZ) && !z) {
                    LJJIIZI().add(this.LJJJJZ);
                }
            }
        }
    }

    public final void LIZIZ(boolean z) {
        if (!this.LJIILJJIL) {
            2sR<Boolean> r0 = C1781GFy.LLJJJJJIL;
            n.LIZIZ(r0, "");
            Object LIZ = r0.LIZ();
            n.LIZIZ(LIZ, "");
            if (((Boolean) LIZ).booleanValue()) {
                if (LJJIIZI().size() == 0 || z) {
                    2sR<Boolean> r1 = C1781GFy.LLJJJJJIL;
                    n.LIZIZ(r1, "");
                    r1.LIZ(false);
                    FrameLayout frameLayout = (FrameLayout) LIZ(2131366090);
                    n.LIZIZ(frameLayout, "");
                    frameLayout.setVisibility(0);
                    FrameLayout frameLayout2 = (FrameLayout) LIZ(2131366090);
                    n.LIZIZ(frameLayout2, "");
                    frameLayout2.setClickable(true);
                    0bT r4 = new 0bT();
                    0bT r12 = new 0bT();
                    1sP LIZ2 = LIZ(2131365467);
                    n.LIZIZ(LIZ2, "");
                    r4.LIZ(LIZ2);
                    r4.LIZ("tiktok_live_broadcast_resource");
                    r4.LIZIZ = true;
                    r4.LIZ(new GO3(this, r12));
                    1sP LIZ3 = LIZ(2131362737);
                    n.LIZIZ(LIZ3, "");
                    r12.LIZ(LIZ3);
                    r12.LIZ("tiktok_live_broadcast_resource");
                    r12.LIZIZ = true;
                    r12.LIZJ = true;
                    r12.LIZ(new GOQ(this));
                    if (0b0.LJI()) {
                        r4.LIZIZ("ttlive_livecenter_guide_hand_rtl.webp");
                        r12.LIZIZ("ttlive_livecenter_guide_black_line_rtl.webp");
                        0bX.LIZ(r4);
                        0bX.LIZ(r12);
                    } else {
                        r4.LIZIZ("ttlive_livecenter_guide_hand.webp");
                        r12.LIZIZ("ttlive_livecenter_guide_black_line.webp");
                        0bX.LIZ(r4);
                        0bX.LIZ(r12);
                    }
                    LIZ(2131365473).LIZ(2131886883);
                    1jk LIZ4 = LIZ(2131365473);
                    n.LIZIZ(LIZ4, "");
                    LIZ4.setText(0b0.LIZ(2131829232));
                    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 GOD(this, animatorSet, r4));
                }
                if (!LJJIIZI().contains(this.LJJJJLL) && !z) {
                    LJJIIZI().add(this.LJJJJLL);
                }
            }
        }
    }

    /* JADX WARNING: type inference failed for: r0v11, types: [android.view.View, X.G9l] */
    public final void onEvent(GJB gjb) {
        String str;
        int intValue;
        M12.LIZ(gjb);
        int i = gjb.LIZ;
        if (i != 6) {
            if (i == 7) {
                C3553GuA guA = gjb.LIZLLL;
                if (guA instanceof ControlMessage) {
                    ControlMessage controlMessage = (ControlMessage) guA;
                    if (controlMessage.LIZ == 4) {
                        PerceptionDialogInfo perceptionDialogInfo = controlMessage.LIZLLL;
                        if (perceptionDialogInfo != null) {
                            DataChannelGlobal.LIZLLL.LIZIZ(HGK.class, perceptionDialogInfo);
                        }
                        PunishEventInfo punishEventInfo = controlMessage.LJFF;
                        if (punishEventInfo != null) {
                            this.LJJI = new GR4(punishEventInfo.LIZ, punishEventInfo.LIZIZ, punishEventInfo.LIZJ, punishEventInfo.LIZLLL);
                        }
                        ControlMessage.Extra extra = controlMessage.LIZJ;
                        if (extra != null) {
                            this.LJIJJ = Uri.parse(extra.LIZ).buildUpon().appendQueryParameter("source", "inapp").appendQueryParameter("enter_from", "live").build().toString();
                            this.LJIJJLI = HL0.LIZ(extra.LIZJ, "");
                            this.LJIL = HL0.LIZ(extra.LIZLLL, "");
                            this.LJJ = HL0.LIZ(extra.LJ, "");
                        }
                        PrivacyCert$Builder with = PrivacyCert$Builder.Companion.with("bpea-424");
                        with.usage("");
                        with.tag("stop video/audio capture when live ends");
                        with.policies(PrivacyPolicyStore.getVideoPrivacyPolicy(), PrivacyPolicyStore.getAudioPrivacyPolicy());
                        LIZ(true, (Cert) with.build());
                        C1970GNf.LIZIZ(10003, r_(), s_(), this.LJIIJ);
                        return;
                    }
                }
                PrivacyCert$Builder with2 = PrivacyCert$Builder.Companion.with("bpea-425");
                with2.usage("");
                with2.tag("stop video/audio capture when live ends");
                with2.policies(PrivacyPolicyStore.getVideoPrivacyPolicy(), PrivacyPolicyStore.getAudioPrivacyPolicy());
                LIZ(false, (Cert) with2.build());
                C1970GNf.LIZIZ(gjb.LIZIZ, r_(), s_(), this.LJIIJ);
                return;
            } else if (i != 8) {
                if (i == 11) {
                    PrivacyCert$Builder with3 = PrivacyCert$Builder.Companion.with("bpea-421");
                    with3.usage("");
                    with3.tag("stop video/audio capture when live ends");
                    with3.policies(PrivacyPolicyStore.getVideoPrivacyPolicy(), PrivacyPolicyStore.getAudioPrivacyPolicy());
                    PrivacyCert build = with3.build();
                    C1970GNf.LIZIZ(10002, r_(), s_(), this.LJIIJ);
                    LJJIFFI();
                    LIZLLL(1);
                    0VN r0 = this.LJIILL;
                    if (r0 != null) {
                        r0.LIZ();
                    }
                    0VN r02 = this.LJIILL;
                    if (r02 != null) {
                        r02.LJIIIIZZ(build);
                    }
                    0Xg.LIZ("release_audio");
                    0VN r03 = this.LJIILL;
                    if (r03 != null) {
                        r03.LJ(build);
                    }
                    0Xg.LIZ("release_video");
                    C1313Fz8.LIZ(getContext(), 2131834091);
                    1hK activity = getActivity();
                    if (activity != null) {
                        activity.finish();
                        return;
                    }
                    return;
                } else if (i == 17) {
                    PrivacyCert$Builder with4 = PrivacyCert$Builder.Companion.with("bpea-776");
                    with4.usage("");
                    with4.tag("close live immediately");
                    with4.policies(PrivacyPolicyStore.getVideoPrivacyPolicy(), PrivacyPolicyStore.getAudioPrivacyPolicy());
                    LIZJ((Cert) with4.build());
                    return;
                } else {
                    return;
                }
            }
        }
        Context context = getContext();
        if (context != null) {
            n.LIZIZ(context, "");
            if (!G9Q.LIZ.LIZ(context, p_(), new GC8(this), new GJA(this))) {
                Integer num = (Integer) p_().LIZIZ(C4338HGh.class);
                if (num == null || (intValue = num.intValue()) <= 0) {
                    str = getResources().getString(2131828240);
                } else {
                    str = getResources().getQuantityString(2131689729, intValue, new Object[]{Integer.valueOf(intValue)});
                }
                n.LIZIZ(str, "");
                ? r04 = (C1612G9l) LIZ(2131367160);
                if (r04 != 0) {
                    C1430G2l.LIZ((View) r04, true);
                }
                long currentTimeMillis = System.currentTimeMillis();
                GD1.LIZIZ.LIZ().LIZ().getAnchorPreFinish(s_()).LIZ(Pm5.LIZ(this, SRf.DESTROY)).LIZ(new C6455Hzs()).LIZ(new C1997GOg(this, str, currentTimeMillis), new C1996GOf(this, str, currentTimeMillis));
            }
            C3491GtA LIZ = C3491GtA.LJFF.LIZ("anchor_close_live_popup");
            LIZ.LIZ(p_());
            LIZ.LIZ("live_type", "video_live");
            LIZ.LIZLLL();
        }
    }

    private void LIZ(DataChannel dataChannel, boolean z) {
        String str;
        String str2;
        Room room = (Room) DataChannelGlobal.LIZLLL.LIZIZ(HEP.class);
        long LIZJ = C4100H7d.LIZ().LIZIZ().LIZJ();
        if (room != null && room.getOwnerUserId() == LIZJ) {
            C3491GtA LIZ = C3491GtA.LJFF.LIZ("livesdk_switch_to_background");
            LIZ.LIZ(dataChannel);
            LIZ.LJIIIIZZ(room.getIdStr());
            LIZ.LJII(String.valueOf(room.getOwnerUserId()));
            C1856GIv streamType = room.getStreamType();
            if (streamType != null) {
                str = C1393G1a.LIZ(streamType);
            } else {
                str = null;
            }
            LIZ.LIZIZ(str);
            if (z) {
                str2 = "anchor_leave";
            } else {
                str2 = "anchor_back";
            }
            LIZ.LJI(str2);
            LIZ.LIZLLL();
        }
    }

    private final void LIZ(boolean z, Cert cert) {
        String str;
        if (!this.LJJIL) {
            LJJIFFI();
            LIZLLL(1);
        }
        if (z && !86a.LIZ(this.LJIJJ)) {
            C3935H0u webViewManager = GI0.LJI().webViewManager();
            Context context = getContext();
            C3547Gu4 LIZIZ = C3598Gut.LIZIZ(this.LJIJJ);
            LIZIZ.LIZJ = true;
            LIZIZ.LIZIZ = 0b0.LIZ(2131833712);
            webViewManager.LIZ(context, LIZIZ);
        }
        StringBuilder sb = new StringBuilder("room close onLiveEnd endByBanned:");
        if (z) {
            str = "true";
        } else {
            str = "false";
        }
        sb.append(str);
        0aP.LIZ(3, "LiveBroadcastFragment", sb.toString());
        LIZ(cert);
    }

    public final View LIZ(LayoutInflater layoutInflater, ViewGroup viewGroup) {
        M12.LIZ(layoutInflater);
        View LIZ = 0S6.LIZ(0S6.LJFF, 2131561750, viewGroup);
        if (LiveAnchorOneVnSetting.INSTANCE.enable1vn()) {
            LIZ.setBackgroundColor(0b0.LIZIZ(2131100842));
        }
        return LIZ;
    }
}
