TikTok.apk(点击下载) / AnonymousClass2FU.java


package X;

import android.content.Context;
import android.content.IntentFilter;
import android.util.Pair;
import com.bytedance.android.livesdk.livesetting.pullstream.DnsOptMethodSetting;
import com.bytedance.android.livesdk.livesetting.pullstream.LiveSdkEnableTfoPreconnectSetting;
import com.bytedance.android.livesdk.livesetting.watchlive.firstscreen.FirstScreenOptSwitcher;
import com.bytedance.android.livesdkapi.host.IHostApp;
import com.bytedance.android.livesdkapi.host.IHostContext;
import com.bytedance.covode.number.Covode;

/* renamed from: X.2FU  reason: invalid class name */
public final class AnonymousClass2FU implements AbstractC55062Fb {
    public AnonymousClass2FA LIZ;

    static {
        Covode.recordClassIndex(12974);
    }

    public AnonymousClass2FU() {
    }

    public /* synthetic */ AnonymousClass2FU(byte b) {
        this();
    }

    @Override // X.AbstractC55062Fb
    public final void LIZ() {
        boolean z;
        try {
            if (!AnonymousClass25P.LIZ(((IHostContext) C524124w.LIZ(IHostContext.class)).context())) {
                return;
            }
        } catch (Throwable unused) {
        }
        if (DnsOptMethodSetting.INSTANCE.getValue() == 1 && FirstScreenOptSwitcher.INSTANCE.getValue() && C30434BxP.LJI().LIZJ().LIZIZ() == null) {
            String str = (C524124w.LIZ(IHostApp.class) == null || ((IHostApp) C524124w.LIZ(IHostApp.class)).isInMusicallyRegion()) ? "https://hotapi-va.tiktokv.com" : "https://hotapi-sg.tiktokv.com";
            AnonymousClass2FW r2 = new AnonymousClass2FW();
            r2.LIZIZ = str;
            r2.LIZLLL = ((IHostContext) C524124w.LIZ(IHostContext.class)).getUpdateVersionCode();
            r2.LJ = new AnonymousClass2W4(this);
            r2.LJI = LiveSdkEnableTfoPreconnectSetting.INSTANCE.getValue();
            AnonymousClass2FT.LIZ().LIZ(r2.LIZ());
            Context applicationContext = ((IHostContext) C524124w.LIZ(IHostContext.class)).context().getApplicationContext();
            if (C16360kz.LIZJ && applicationContext == null) {
                applicationContext = C16360kz.LIZ;
            }
            AnonymousClass2FA r4 = new AnonymousClass2FA(applicationContext);
            r4.LIZ = new AnonymousClass2FY();
            AnonymousClass2FL.LIZ().LJ = r4.LIZ;
            AnonymousClass2FL LIZ2 = AnonymousClass2FL.LIZ();
            if (LIZ2.LJ != null) {
                LIZ2.LJIIIZ = ((Integer) LIZ2.LJ.LIZ("min_start_play_buffer", Integer.valueOf(AnonymousClass2FL.LIZ))).intValue();
                LIZ2.LJIIJ = ((Integer) LIZ2.LJ.LIZ("max_start_play_buffer", Integer.valueOf(AnonymousClass2FL.LIZIZ))).intValue();
                LIZ2.LJIIJJI = ((Double) LIZ2.LJ.LIZ("attenuation_coefficient", Double.valueOf(AnonymousClass2FL.LIZLLL))).doubleValue();
                LIZ2.LJIIL = ((Integer) LIZ2.LJ.LIZ("attenuation_time_offset", 1000)).intValue();
            }
            double d = 0.0d;
            double d2 = 0.0d;
            for (int i2 = 0; i2 < LIZ2.LJII.length; i2++) {
                d2 += Math.cbrt((double) (8 - LIZ2.LJII[i2]));
            }
            int i3 = LIZ2.LJIIJ - LIZ2.LJIIIZ;
            int i4 = LIZ2.LJIIIZ;
            int i5 = 1;
            while (i5 < LIZ2.LJII.length) {
                d += Math.cbrt((double) (8 - LIZ2.LJII[i5]));
                double d3 = (double) LIZ2.LJIIIZ;
                double d4 = (double) i3;
                Double.isNaN(d4);
                Double.isNaN(d3);
                int i6 = (int) (d3 + ((d / d2) * d4));
                LIZ2.LJIIIIZZ.put(Integer.valueOf(LIZ2.LJII[i5 - 1]), new Pair(Integer.valueOf(i4), Integer.valueOf(i6)));
                i5++;
                i4 = i6;
            }
            if (i5 == LIZ2.LJII.length) {
                z = true;
                LIZ2.LJIIIIZZ.put(Integer.valueOf(LIZ2.LJII[i5 - 1]), new Pair(Integer.valueOf(i4), Integer.valueOf(LIZ2.LJIIJ)));
            } else {
                z = true;
            }
            C30434BxP.LJI().LIZJ().LIZ(r4);
            try {
                r4.LJII = z;
                AnonymousClass2FA.LIZ(r4.LIZJ, r4.LIZLLL, new IntentFilter("android.net.conn.CONNECTIVITY_CHANGE"));
                AnonymousClass2FT.LIZ().LIZJ.LIZ();
            } catch (Throwable unused2) {
            }
        }
    }

    @Override // X.AbstractC55062Fb
    public final void LIZ(AnonymousClass2FA r1) {
        this.LIZ = r1;
    }

    @Override // X.AbstractC55062Fb
    public final AnonymousClass2FA LIZIZ() {
        return this.LIZ;
    }
}