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


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

import X.AbstractC524424z;
import X.AnonymousClass0ED;
import X.AnonymousClass0EE;
import X.AnonymousClass0WE;
import X.AnonymousClass2E5;
import X.AnonymousClass2IT;
import X.C08630Wm;
import X.C19630qG;
import X.C21090sc;
import X.C35995EBs;
import X.C47061tP;
import X.C524124w;
import X.C53639L4i;
import X.C55616Lsb;
import X.C55617Lsc;
import X.C84513Ui;
import X.COK;
import android.content.Context;
import android.text.TextUtils;
import android.util.Log;
import com.bef.effectsdk.AssetResourceFinder;
import com.bytedance.android.livesdk.livesetting.other.TikTokLiveGeckoBroadcastCdnPathSetting;
import com.bytedance.android.livesdk.livesetting.other.TiktokLiveBasicResourceGeckoBaseUrlSetting;
import com.bytedance.android.livesdk.livesetting.other.TiktokLiveBoeResourceGeckoBaseUrlSetting;
import com.bytedance.android.livesdk.livesetting.other.TiktokLiveInteractionResourceGeckoBaseUrlSetting;
import com.bytedance.android.livesdk.livesetting.other.TiktokLiveLottieResourceGeckoBaseUrlSetting;
import com.bytedance.android.livesdk.livesetting.other.TiktokLiveWatchResourceGeckoBaseUrlSetting;
import com.bytedance.android.livesdkapi.host.IHostContext;
import com.bytedance.covode.number.Covode;
import com.ss.android.deviceregister.DeviceRegisterManager;
import com.ss.android.ugc.aweme.gecko.GeckoXNetImpl;
import com.ss.android.ugc.aweme.live.ILiveHostOuterService;
import com.ss.android.ugc.aweme.live.LiveHostOuterService;
import com.ss.android.ugc.aweme.out.AVExternalServiceImpl;
import com.ss.android.ugc.effectmanager.EffectManager;
import java.io.File;
import java.util.Locale;
import kotlin.g.b.m;

public class LiveAppContext implements IHostContext {
    public EffectManager LIZ;

    static {
        Covode.recordClassIndex(80826);
    }

    @Override // com.bytedance.android.livesdkapi.host.IHostContext
    public int appId() {
        return 1233;
    }

    @Override // com.bytedance.android.livesdkapi.host.IHostContext
    public String appName() {
        return "musical_ly";
    }

    @Override // com.bytedance.android.livesdkapi.host.IHostContext
    public Context context() {
        return AnonymousClass0WE.LJJI.LIZ();
    }

    @Override // com.bytedance.android.livesdkapi.host.IHostContext
    public Locale currentLocale() {
        return LiveHostOuterService.LJIILL().LIZIZ();
    }

    @Override // com.bytedance.android.livesdkapi.host.IHostContext
    public String getBoeLane() {
        return LiveHostOuterService.LJIILL().LJIIJ();
    }

    @Override // com.bytedance.android.livesdkapi.host.IHostContext
    public String getChannel() {
        return AnonymousClass0WE.LJIJI;
    }

    @Override // com.bytedance.android.livesdkapi.host.IHostContext
    public EffectManager getEffectManager() {
        if (this.LIZ == null) {
            AnonymousClass0EE r4 = new AnonymousClass0EE();
            AVExternalServiceImpl.LIZ().abilityService().effectService().buildEffectPlatform(context(), new C55616Lsb(r4), C53639L4i.LIZ);
            try {
                AnonymousClass0ED<TResult> r2 = r4.LIZ;
                r2.LJFF();
                if (r2.LIZJ()) {
                    C19630qG.LIZIZ("So decompress: LiveAppContext, get effect manager wrong,  task error: " + Log.getStackTraceString(r2.LJ()));
                } else {
                    this.LIZ = r2.LIZLLL();
                }
            } catch (InterruptedException e) {
                C19630qG.LIZIZ("So decompress: LiveAppContext, get effect manager wrong, " + e.getMessage() + "at " + Log.getStackTraceString(e));
                e.printStackTrace();
            }
        }
        return this.LIZ;
    }

    @Override // com.bytedance.android.livesdkapi.host.IHostContext
    public String getGeckoAccessKey() {
        return AnonymousClass2IT.LIZ.LIZJ();
    }

    @Override // com.bytedance.android.livesdkapi.host.IHostContext
    public String getGeckoHost() {
        return "gecko-va.tiktokv.com";
    }

    @Override // com.bytedance.android.livesdkapi.host.IHostContext
    public Object getGeckoXNetImpl(Context context) {
        return new GeckoXNetImpl(context);
    }

    @Override // com.bytedance.android.livesdkapi.host.IHostContext
    public String getIapKey() {
        return "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAi15r9zfdlMuE3zfC3ZZEA4U0ursaCpeXTw024ezGLKOVz7E+hBgbAhsONpfZ9tTqzEm+nc48hSs0gvhbWxFd8wSelqqJQhpSaVFLwC8VKA/oPDL7MAwbGfnlaAADwer4EOZ29KJFRiWWxolOvw9Vpzfrca6JvxSe87Y2buZp+z9kFxlGfUpyPpTkqh/8IuvZnQRTVnlOtZ1aV0urNjHgwj760LlCGO6Mwta82YTIrHIFO7JKhT5aXcrnrb7WnlojKtM3mNZ6q157D2fGiv+Gsule/ullOmXLvSkW0bJXCoQRnE9HxzmRKNss4ekmX3Vr+jmEcw1esSJ6V6LtY4JAeQIDAQAB";
    }

    @Override // com.bytedance.android.livesdkapi.host.IHostContext
    public String getPackageName() {
        return null;
    }

    @Override // com.bytedance.android.livesdkapi.host.IHostContext
    public String getPpeLane() {
        return LiveHostOuterService.LJIILL().LJIILJJIL();
    }

    @Override // com.bytedance.android.livesdkapi.host.IHostContext
    public Object getResourceFinder(Context context, String str) {
        AnonymousClass0EE r2 = new AnonymousClass0EE();
        AVExternalServiceImpl.LIZ().abilityService().effectService().provideResourceFinder(new C55617Lsc(this, r2));
        AnonymousClass0ED<TResult> r22 = r2.LIZ;
        try {
            r22.LJFF();
            if (r22.LIZJ()) {
                C19630qG.LIZIZ("So decompress: LiveAppContext, get resource finder wrong,  task error: " + Log.getStackTraceString(r22.LJ()));
            }
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        TResult LIZLLL = r22.LIZLLL();
        return LIZLLL == null ? new AssetResourceFinder(context.getAssets(), str) : LIZLLL;
    }

    @Override // com.bytedance.android.livesdkapi.host.IHostContext
    public String getServerDeviceId() {
        return DeviceRegisterManager.getDeviceId();
    }

    @Override // com.bytedance.android.livesdkapi.host.IHostContext
    public String getSessionId() {
        return C08630Wm.LIZIZ;
    }

    @Override // com.bytedance.android.livesdkapi.host.IHostContext
    public String getTTLiveGeckoCdnUrl(String str, String str2) {
        C35995EBs eBs = C35995EBs.LIZIZ;
        C21090sc.LIZ(str, str2);
        if (!TextUtils.isEmpty(str) && !TextUtils.isEmpty(str2)) {
            AbstractC524424z LIZ2 = C524124w.LIZ(IHostContext.class);
            m.LIZIZ(LIZ2, "");
            if (((IHostContext) LIZ2).isBoe()) {
                String valueAndDefault = TiktokLiveBoeResourceGeckoBaseUrlSetting.INSTANCE.getValueAndDefault();
                if (!TextUtils.isEmpty(valueAndDefault)) {
                    return eBs.LIZ(valueAndDefault, valueAndDefault, str, str2);
                }
            }
            switch (str.hashCode()) {
                case 351530604:
                    if (str.equals("tiktok_live_watch_resource")) {
                        return eBs.LIZ(TiktokLiveWatchResourceGeckoBaseUrlSetting.INSTANCE.getValue(), TiktokLiveWatchResourceGeckoBaseUrlSetting.DEFAULT, str, str2);
                    }
                    break;
                case 1021228553:
                    if (str.equals("tiktok_live_interaction_resource")) {
                        return eBs.LIZ(TiktokLiveInteractionResourceGeckoBaseUrlSetting.INSTANCE.getValue(), "https://lf16-gecko-source.tiktokcdn.com/obj/byte-gurd-source-sg/10/gecko/resource", str, str2);
                    }
                    break;
                case 1040038381:
                    if (str.equals("tiktok_live_basic_resource")) {
                        return eBs.LIZ(TiktokLiveBasicResourceGeckoBaseUrlSetting.INSTANCE.getValue(), "https://lf16-gecko-source.tiktokcdn.com/obj/byte-gurd-source-sg/10/gecko/resource", str, str2);
                    }
                    break;
                case 1072357760:
                    if (str.equals("tiktok_live_lottie_resource")) {
                        return eBs.LIZ(TiktokLiveLottieResourceGeckoBaseUrlSetting.INSTANCE.getValue(), "https://lf16-gecko-source.tiktokcdn.com/obj/byte-gurd-source-sg/10/gecko/resource", str, str2);
                    }
                    break;
                case 1544090554:
                    if (str.equals("tiktok_live_broadcast_resource")) {
                        return eBs.LIZ(TikTokLiveGeckoBroadcastCdnPathSetting.INSTANCE.getValue(), "https://lf16-gecko-source.tiktokcdn.com/obj/byte-gurd-source-sg/10/gecko/resource", str, str2);
                    }
                    break;
            }
        }
        return "";
    }

    @Override // com.bytedance.android.livesdkapi.host.IHostContext
    public File getTTLiveGeckoResourceFile(String str, String str2) {
        C21090sc.LIZ(str, str2);
        if (TextUtils.isEmpty(str) || TextUtils.isEmpty(str2)) {
            return null;
        }
        String str3 = "";
        if (!TextUtils.isEmpty(str)) {
            if (C35995EBs.LIZ == null) {
                ILiveHostOuterService LJIILL = LiveHostOuterService.LJIILL();
                m.LIZIZ(LJIILL, str3);
                C84513Ui r1 = new C84513Ui(LJIILL.LJ());
                ILiveHostOuterService LJIILL2 = LiveHostOuterService.LJIILL();
                m.LIZIZ(LJIILL2, str3);
                C35995EBs.LIZ = r1.LIZ(LJIILL2.LIZLLL()).LIZ(COK.LIZ());
            }
            C84513Ui r0 = C35995EBs.LIZ;
            String str4 = r0 != null ? r0.LIZIZ : null;
            str3 = !TextUtils.isEmpty(str4) ? AnonymousClass2E5.LIZ(AnonymousClass2IT.LIZ.LIZIZ(), str4, str) : null;
        }
        if (TextUtils.isEmpty(str3)) {
            return null;
        }
        File file = new File(str3 + File.separator + str2);
        if (!file.exists()) {
            return null;
        }
        return file;
    }

    @Override // com.bytedance.android.livesdkapi.host.IHostContext
    public int getUpdateVersionCode() {
        try {
            return C47061tP.LIZ(context(), "UPDATE_VERSION_CODE");
        } catch (Exception unused) {
            return 0;
        }
    }

    @Override // com.bytedance.android.livesdkapi.host.IHostContext
    public String getVersionCode() {
        return String.valueOf(AnonymousClass0WE.LJJI.LJII());
    }

    @Override // com.bytedance.android.livesdkapi.host.IHostContext
    public int getVersionCodeInt() {
        return (int) AnonymousClass0WE.LJJI.LJII();
    }

    @Override // com.bytedance.android.livesdkapi.host.IHostContext
    public String getVersionName() {
        return AnonymousClass0WE.LJJI.LJIIIIZZ();
    }

    @Override // com.bytedance.android.livesdkapi.host.IHostContext
    public boolean isBoe() {
        LiveHostOuterService.LJIILL();
        return false;
    }

    @Override // com.bytedance.android.livesdkapi.host.IHostContext
    public boolean isLocalTest() {
        return TextUtils.equals(getChannel(), "local_test");
    }

    @Override // com.bytedance.android.livesdkapi.host.IHostContext
    public boolean isNeedProtectMinor() {
        return LiveHostOuterService.LJIILL().LIZ();
    }

    @Override // com.bytedance.android.livesdkapi.host.IHostContext
    public boolean isOffline() {
        return false;
    }

    @Override // com.bytedance.android.livesdkapi.host.IHostContext
    public boolean isPpe() {
        LiveHostOuterService.LJIILL();
        return false;
    }

    @Override // com.bytedance.android.livesdkapi.host.IHostContext
    public int liveId() {
        return 12;
    }

    @Override // X.AbstractC524424z
    public void onInit() {
    }

    @Override // com.bytedance.android.livesdkapi.host.IHostContext
    public void trafficDeteriorationAB(int i2) {
        LiveHostOuterService.LJIILL().LIZ(i2);
    }
}