package com.ss.android.ugc.aweme.commerce.anywhere;

import X.2rI;
import X.46i;
import X.AnonymousClass9EH;
import X.C30738n2;
import X.C44309Lh;
import X.C46909Vh;
import X.C46919Vi;
import X.C46929Vj;
import X.C46959Vm;
import X.C46969Vn;
import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.os.Build;
import android.text.TextUtils;
import com.bytedance.covode.number.Covode;
import com.bytedance.ies.ugc.aweme.commercialize.splash.service.ISplashAdService;
import com.bytedance.keva.Keva;
import com.ss.android.common.applog.AppLog;
import com.ss.android.ugc.aweme.IAccountUserService;
import java.net.URLEncoder;
import kotlin.h.b.n;

public final class AnyDoorDepend {
    static {
        Covode.recordClassIndex(57945);
    }

    public final C46919Vi getAppType() {
        return C46919Vi.US;
    }

    public final Context getContext() {
        return AnonymousClass9EH.LJJIFFI.LIZ();
    }

    public final C46959Vm getRouter() {
        return new C46929Vj();
    }

    public final void cleanExtraMockCacheIfNeed() {
        ISplashAdService iSplashAdService = (ISplashAdService) C44309Lh.LIZ(ISplashAdService.class);
        if (iSplashAdService != null) {
            iSplashAdService.LIZJ();
        }
    }

    public final C46909Vh getAppInfo() {
        String str;
        String valueOf = String.valueOf(C46969Vn.LIZ);
        String serverDeviceId = AppLog.getServerDeviceId();
        46i.LIZ();
        if (46i.LIZ.LJIILLIIL()) {
            IAccountUserService LJFF = 46i.LJFF();
            n.LIZIZ(LJFF, "");
            str = LJFF.getCurUserId();
        } else {
            str = "0";
        }
        String encode = URLEncoder.encode(Build.MODEL, "UTF-8");
        boolean enableBoe = 2rI.LIZ.LIZ.enableBoe();
        String str2 = INVOKEVIRTUAL_com_ss_android_ugc_aweme_commerce_anywhere_AnyDoorDepend_com_ss_android_ugc_aweme_lancet_process_AwemeMetaDataLancet_getPackageInfo(getContext().getPackageManager(), getContext().getPackageName(), 0).versionName;
        String str3 = Build.VERSION.RELEASE;
        String string = Keva.getRepo("aweme_network").getString("lastInputEmailPrefix", "");
        n.LIZIZ(str2, "");
        n.LIZIZ(encode, "");
        return new C46909Vh(valueOf, str, serverDeviceId, str2, encode, str3, string, enableBoe);
    }

    public static PackageInfo INVOKEVIRTUAL_com_ss_android_ugc_aweme_commerce_anywhere_AnyDoorDepend_com_ss_android_ugc_aweme_lancet_process_AwemeMetaDataLancet_getPackageInfo(PackageManager packageManager, String str, int i) {
        Context LIZ = AnonymousClass9EH.LJJIFFI.LIZ();
        if (C30738n2.LJIIIZ && TextUtils.equals(str, LIZ.getPackageName()) && i == 128) {
            if (C30738n2.LIZIZ == null) {
                C30738n2.LIZIZ = packageManager.getPackageInfo(str, i);
            }
            return C30738n2.LIZIZ;
        } else if (C30738n2.LJIIIZ && TextUtils.equals(str, LIZ.getPackageName()) && i == 0) {
            if (C30738n2.LIZLLL == null) {
                C30738n2.LIZLLL = packageManager.getPackageInfo(str, i);
            }
            return C30738n2.LIZLLL;
        } else if (C30738n2.LJIIIZ && TextUtils.equals(str, LIZ.getPackageName()) && i == 64) {
            if (C30738n2.LJ == null) {
                C30738n2.LJ = packageManager.getPackageInfo(str, i);
            }
            return C30738n2.LJ;
        } else if (!C30738n2.LJIIIZ || !TextUtils.equals(str, LIZ.getPackageName()) || i != 8) {
            return packageManager.getPackageInfo(str, i);
        } else {
            if (C30738n2.LJFF == null) {
                C30738n2.LJFF = packageManager.getPackageInfo(str, i);
            }
            return C30738n2.LJFF;
        }
    }
}
