xweb笔记

package org.xwalk.core;

import android.app.Application;
import android.content.ContentResolver;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Build;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Log;
import com.tencent.xweb.DeprecatedOutsideXWebSdk;
import com.tencent.xweb.WebDebugCfg;
import com.tencent.xweb.WebView;
import com.tencent.xweb.XWebChildProcessMonitor;
import com.tencent.xweb.XWebCoreContentProvider;
import com.tencent.xweb.XWebFeature;
import com.tencent.xweb.XWebWebViewMode;
import com.tencent.xweb.internal.ConstValue;
import com.tencent.xweb.internal.IWebViewProvider;
import com.tencent.xweb.remotedebug.XWebRemoteDebugBroadcastListener;
import com.tencent.xweb.remotedebug.XWebRemoteDebugBroadcastManager;
import com.tencent.xweb.remotedebug.XWebRemoteDebugHandler;
import com.tencent.xweb.updater.XWebBroadcastListener;
import com.tencent.xweb.updater.XWebBroadcastListenerManager;
import com.tencent.xweb.util.AbiUtil;
import com.tencent.xweb.util.ProcessUtil;
import com.tencent.xweb.util.WebViewExtensionListener;
import com.tencent.xweb.util.WebViewWrapperFactory;
import com.tencent.xweb.util.XWebChoreHandler;
import com.tencent.xweb.util.XWebCoreInfo;
import com.tencent.xweb.util.XWebFileUtil;
import com.tencent.xweb.util.XWebLog;
import com.tencent.xweb.util.XWebSharedPreferenceUtil;
import com.tencent.xweb.util.XWebUpdateConfigUtil;
import com.tencent.xweb.xwalk.plugin.XWalkPluginManager;
import java.util.HashSet;
import java.util.Locale;
import java.util.Set;

/* loaded from: classes10.dex */
public class XWalkEnvironment {
    public static final String CRASH_DUMP_FILE_SUFFIX = "xweb_sandbox_crash";
    public static final String CRASH_DUMP_FILE_SUFFIX_FOR_GPU = "xweb_gpu_crash";
    public static final String CRASH_DUMP_FILE_SUFFIX_FOR_RENDER_UNSANDBOX = "xweb_render_crash";
    public static final String LOCAL_TEST_ZIP_NAME = "runtime_package.zip";
    public static final int MULTI_PROCESS_TYPE_DISABLE = 0;
    public static final int MULTI_PROCESS_TYPE_RENDERER = 1;
    public static final int MULTI_PROCESS_TYPE_RENDERER_AND_GPU = 2;
    public static final String PINUS_SO_NAME = "libxwebcore.so";
    public static final String RUNTIME_ABI_ARM32_STR = "armeabi-v7a";
    public static final String RUNTIME_ABI_ARM64_STR = "arm64-v8a";
    public static final int SDK_SUPPORT_MIN_APKVERSION = 2000;
    public static final int SDK_VERSION = 20231201;
    private static final String TAG = "XWalkEnvironment";
    public static final int TEST_APK_START_VERSION = 100000000;
    public static final String XWALK_SO_NAME = "libxwalkcore.so";
    private static Context sApplicationContext;
    private static boolean sEnableCheckCertificate;
    private static boolean sEnableV8Lite;
    private static String sLocaleString;
    private static String sPrivilegedServicesName;
    private static String sSandboxedServicesName;
    private static String sStrCurrentProcessName;
    private static WebViewExtensionListener sWebViewExtensionListener;
    private static XWebCoreInfo sXWebCoreVersionInfo;
    private static final XWebBroadcastListener xwebBroadcastListener = new XWebBroadcastListener();
    private static final XWebRemoteDebugBroadcastListener xwebRemoteDebugBroadcastListener = new XWebRemoteDebugBroadcastListener();
    private static boolean sUsingCustomContext = false;
    private static boolean sIsForceDarkMode = false;
    private static int sForceDarkBehavior = 2;
    private static final Bundle sExtendConfig = new Bundle();
    public static boolean isTurnOnKVLog = false;
    private static final Set<String> sAppInfos = new HashSet();
    private static final Bundle sXWebInitConfigBundle = new Bundle();
    private static int multiProcessType = 0;
    private static boolean sEnableSandbox = false;

    /* loaded from: classes9.dex */
    public enum ForceDarkBehavior {
        FORCE_DARK_ONLY,
        MEDIA_QUERY_ONLY,
        PREFER_MEDIA_QUERY_OVER_FORCE_DARK
    }

    @DeprecatedOutsideXWebSdk
    @Deprecated
    public static void appendAppInfo(String str) {
        XWebLog.i(TAG, "appendAppInfo:" + str);
        sAppInfos.add(str);
    }

    public static boolean containsAppInfo(String str) {
        XWebLog.i(TAG, "containsAppInfo, strInfos:" + str);
        String[] split = str.split("&");
        if (!(split == null || split.length == 0)) {
            for (String str2 : split) {
                if (!TextUtils.isEmpty(str2) && !sAppInfos.contains(str2.trim())) {
                    return false;
                }
            }
        }
        return true;
    }

    public static Context convertContextToApplication(Context context) {
        return context instanceof Application ? context : context.getApplicationContext();
    }

    public static String dumpAppInfo() {
        String join = TextUtils.join(";", sAppInfos);
        XWebLog.i(TAG, "dumpAppInfo:" + join);
        return join;
    }

    public static void ensureInitEnvironment(Context context) {
        if (!hasInited()) {
            init(context);
        }
    }

    @DeprecatedOutsideXWebSdk
    @Deprecated
    public static Context getApplicationContext() {
        return sApplicationContext;
    }

    @DeprecatedOutsideXWebSdk
    @Deprecated
    public static int getAvailableVersion() {
        XWebCoreInfo xWebCoreInfo = sXWebCoreVersionInfo;
        if (xWebCoreInfo == null) {
            return -1;
        }
        return xWebCoreInfo.ver;
    }

    public static String getAvailableVersionDetail() {
        XWebCoreInfo xWebCoreInfo = sXWebCoreVersionInfo;
        return xWebCoreInfo != null ? xWebCoreInfo.verDetail : "";
    }

    public static boolean getBuildConfigForceXWebCore() {
        return false;
    }

    public static boolean getBuildConfigNeedTurnOffDynamicCode() {
        return false;
    }

    public static boolean getBuildConfigShouldEmbedXWebCore() {
        return false;
    }

    public static boolean getBuildConfigThirdPartyRelease() {
        return false;
    }

    public static boolean getBuildConfigXWebTestMode() {
        return false;
    }

    @DeprecatedOutsideXWebSdk
    @Deprecated
    public static ContentResolver getContentResolver() {
        Context context = sApplicationContext;
        if (context != null) {
            return context.getContentResolver();
        }
        XWebLog.e(TAG, "getContentResolver, sApplicationContext is null");
        return null;
    }

    public static float getCustomDensity() {
        float f15;
        Bundle bundle = sExtendConfig;
        synchronized (bundle) {
            f15 = bundle.getFloat(ConstValue.EXTEND_CONFIG_CUSTOM_DENSITY, 0.0f);
        }
        return f15;
    }

    public static boolean getEnableCheckCertificate() {
        return sEnableCheckCertificate;
    }

    @DeprecatedOutsideXWebSdk
    @Deprecated
    public static synchronized boolean getEnableSandbox() {
        boolean z15;
        synchronized (XWalkEnvironment.class) {
            if (Build.VERSION.SDK_INT < 26) {
                XWebLog.i(TAG, "getEnableSandbox, disable sandbox because android version below O");
                sEnableSandbox = false;
            }
            XWebLog.i(TAG, "getEnableSandbox:" + sEnableSandbox);
            z15 = sEnableSandbox;
        }
        return z15;
    }

    @DeprecatedOutsideXWebSdk
    @Deprecated
    public static Bundle getExtendConfigBundle() {
        return sExtendConfig;
    }

    private static boolean getFeatureSupport(int i15) {
        IWebViewProvider webViewProvider = getWebViewProvider();
        if (webViewProvider != null) {
            Object execute = webViewProvider.execute(ConstValue.STR_CMD_FEATURE_SUPPORT, new Object[]{Integer.valueOf(i15)});
            if (execute instanceof Boolean) {
                return ((Boolean) execute).booleanValue();
            }
        }
        return false;
    }

    public static int getForceDarkBehavior() {
        return sForceDarkBehavior;
    }

    public static boolean getForceDarkMode() {
        return sIsForceDarkMode;
    }

    public static Object getInitConfig(String str) {
        Object obj;
        Bundle bundle = sXWebInitConfigBundle;
        synchronized (bundle) {
            obj = bundle.get(str);
        }
        return obj;
    }

    @DeprecatedOutsideXWebSdk
    @Deprecated
    public static Bundle getInitConfigBundle() {
        return sXWebInitConfigBundle;
    }

    @DeprecatedOutsideXWebSdk
    @Deprecated
    public static int getInstalledNewstVersion(Context context) {
        return XWebCoreInfo.getInstalledNewestVersionForCurAbi(context);
    }

    public static int getInstalledNewstVersionForCurAbi() {
        return getInstalledNewstVersion(AbiUtil.getRuntimeAbi());
    }

    public static int getInstalledNewstVersionForPredownAbi() {
        String runtimeAbi = AbiUtil.getRuntimeAbi();
        String str = RUNTIME_ABI_ARM32_STR;
        if (str.equalsIgnoreCase(runtimeAbi)) {
            str = RUNTIME_ABI_ARM64_STR;
        }
        return getInstalledNewstVersion(str);
    }

    public static int getInstalledPluginVersion(Context context, String str) {
        if (context == null) {
            XWebLog.e(TAG, "getInstalledPluginVersion, context is null");
            return -2;
        }
        SharedPreferences sharedPreferencesForPluginVersionInfo = XWebSharedPreferenceUtil.getSharedPreferencesForPluginVersionInfo(str);
        if (sharedPreferencesForPluginVersionInfo != null) {
            return sharedPreferencesForPluginVersionInfo.getInt(XWebSharedPreferenceUtil.SP_KEY_PLUGIN_AVAILABLE_VERSION, -1);
        }
        XWebLog.e(TAG, "getInstalledPluginVersion, sp is null");
        return -3;
    }

    public static Locale getLocale() {
        String str = sLocaleString;
        if (str == null || str.isEmpty()) {
            return null;
        }
        return Locale.forLanguageTag(sLocaleString);
    }

    public static String getLocaleString() {
        return sLocaleString;
    }

    private static String getModuleName() {
        String processName = getProcessName();
        return processName == null ? "" : processName.contains(":") ? processName.substring(processName.lastIndexOf(":") + 1).toLowerCase() : processName.contains(".") ? processName.substring(processName.lastIndexOf(".") + 1).toLowerCase() : processName;
    }

    @DeprecatedOutsideXWebSdk
    @Deprecated
    public static synchronized int getMultiProcessType() {
        synchronized (XWalkEnvironment.class) {
            int i15 = multiProcessType;
            if (i15 < 0 || i15 > 2) {
                XWebLog.w(TAG, "getMultiProcessType, MULTI_PROCESS_TYPE_DISABLE");
                return 0;
            }
            XWebLog.i(TAG, "getMultiProcessType, multiProcessType:" + multiProcessType);
            return multiProcessType;
        }
    }

    public static String getPackageName() {
        Context context = sApplicationContext;
        if (context != null) {
            return context.getPackageName();
        }
        XWebLog.e(TAG, "getPackageName, sApplicationContext is null");
        return "";
    }

    public static String getPrivilegedServicesName() {
        return sPrivilegedServicesName;
    }

    public static String getProcessName() {
        if (!TextUtils.isEmpty(sStrCurrentProcessName)) {
            return sStrCurrentProcessName;
        }
        Object initConfig = getInitConfig(ConstValue.INIT_CONFIG_KEY_PROCESSNAME);
        if (initConfig != null) {
            String obj = initConfig.toString();
            sStrCurrentProcessName = obj;
            return obj;
        }
        String safeGetProcessName = ProcessUtil.safeGetProcessName(getApplicationContext());
        sStrCurrentProcessName = safeGetProcessName;
        return safeGetProcessName;
    }

    public static String getSafeModuleName(String str) {
        try {
            String moduleName = getModuleName();
            if (!"tools".equalsIgnoreCase(moduleName) && !"mm".equalsIgnoreCase(moduleName) && !"support".equalsIgnoreCase(moduleName)) {
                if (moduleName.startsWith("appbrand")) {
                    XWebLog.i(TAG, "getSafeModuleName, module = appbrand");
                    return "appbrand";
                }
                XWebLog.i(TAG, "getSafeModuleName, unknown:" + moduleName + ", use defaultVal:" + str);
                return str;
            }
            XWebLog.i(TAG, "getSafeModuleName, module = " + moduleName);
            return moduleName;
        } catch (Throwable th5) {
            XWebLog.e(TAG, "getSafeModuleName, use defaultVal:" + str + ", error", th5);
            return str;
        }
    }

    public static String getSandboxedServicesName() {
        return sSandboxedServicesName;
    }

    @DeprecatedOutsideXWebSdk
    @Deprecated
    public static boolean getUsingCustomContext() {
        if (isCurrentSupportCustomContext()) {
            return getUsingCustomContextInternal();
        }
        return false;
    }

    public static boolean getUsingCustomContextInternal() {
        return sUsingCustomContext;
    }

    public static boolean getV8LiteMode() {
        return sEnableV8Lite;
    }

    public static WebViewExtensionListener getWebViewExtensionListener() {
        return sWebViewExtensionListener;
    }

    public static WebView.WebViewKind getWebViewKindFromAvailableVersion() {
        return getWebViewKindFromVersion(getAvailableVersion());
    }

    public static WebView.WebViewKind getWebViewKindFromInstalledNewstVersion(Context context) {
        return getWebViewKindFromVersion(getInstalledNewstVersion(context));
    }

    public static WebView.WebViewKind getWebViewKindFromVersion(int i15) {
        if (!hasInited()) {
            XWebLog.w(TAG, "getWebViewKindFromVersion, not init yet, version:" + i15);
            return WebView.WebViewKind.WV_KIND_NONE;
        } else if (i15 <= 0) {
            XWebLog.w(TAG, "getWebViewKindFromVersion, invalid version:" + i15);
            return WebView.WebViewKind.WV_KIND_NONE;
        } else if (XWebFileUtil.isExtractedCoreDirFileExist(i15, PINUS_SO_NAME)) {
            return WebView.WebViewKind.WV_KIND_PINUS;
        } else {
            XWebLog.w(TAG, "getWebViewKindFromVersion, version:" + i15 + ", no pinus so file exist");
            return WebView.WebViewKind.WV_KIND_NONE;
        }
    }

    private static IWebViewProvider getWebViewProvider() {
        return WebViewWrapperFactory.getWebViewProvider(getWebViewKindFromAvailableVersion());
    }

    public static boolean hasAvailableVersion() {
        return 2000 <= getAvailableVersion();
    }

    public static boolean hasInited() {
        return sApplicationContext != null;
    }

    public static boolean hasInstalledAvailableVersion() {
        return 2000 <= getInstalledNewstVersionForCurAbi();
    }

    public static synchronized void init(Context context) {
        synchronized (XWalkEnvironment.class) {
            if (context == null) {
                XWebLog.w(TAG, "init, invalid context");
            } else if (hasInited()) {
                XWebLog.w(TAG, "init, already init");
            } else {
                long currentTimeMillis = System.currentTimeMillis();
                XWebLog.w(TAG, "init start, sdkVersion:20231201, processName:" + getProcessName() + ", stack:" + Log.getStackTraceString(new Exception("please ignore this exception")));
                sApplicationContext = convertContextToApplication(context);
                StringBuilder sb5 = new StringBuilder("init, application context:");
                sb5.append(sApplicationContext);
                XWebLog.i(TAG, sb5.toString());
                XWebSharedPreferenceUtil.setApplicationContext(sApplicationContext);
                long currentTimeMillis2 = System.currentTimeMillis();
                sXWebCoreVersionInfo = initCoreVersionInfo();
                XWebLog.i(TAG, "init, initCoreInfo costTime:" + (System.currentTimeMillis() - currentTimeMillis2) + ", coreInfo:" + sXWebCoreVersionInfo);
                showBuildConfigs();
                XWebChoreHandler.setDataDirSuffix();
                long currentTimeMillis3 = System.currentTimeMillis();
                XWalkPluginManager.initPlugins();
                XWebLog.i(TAG, "init, initPlugins costTime:" + (System.currentTimeMillis() - currentTimeMillis3));
                WebDebugCfg.getInst().load(context);
                initAppInfos();
                initProcessServices();
                XWebChildProcessMonitor.init();
                XWebWebViewMode.init();
                XWebRemoteDebugHandler.init();
                XWebBroadcastListenerManager.registerListener(sApplicationContext, xwebBroadcastListener);
                XWebRemoteDebugBroadcastManager.registerListener(sApplicationContext, xwebRemoteDebugBroadcastListener);
                XWebCoreContentProvider.onXWebInitFinished();
                XWebLog.w(TAG, "init end, processName:" + getProcessName() + ", costTime:" + (System.currentTimeMillis() - currentTimeMillis));
            }
        }
    }

    private static void initAppInfos() {
        if (getBuildConfigShouldEmbedXWebCore()) {
            appendAppInfo(ConstValue.APP_INFO_EMBED_XWEB);
        }
    }

    private static XWebCoreInfo initCoreVersionInfo() {
        XWebCoreInfo.resetUsingCoreVersionIfNeed();
        String runtimeAbi = AbiUtil.getRuntimeAbi();
        XWebCoreInfo versionInfoForAbi = XWebCoreInfo.getVersionInfoForAbi(runtimeAbi);
        int i15 = versionInfoForAbi.ver;
        if (i15 > 0 && !XWebFileUtil.isDownloadApkFileExist(i15)) {
            XWebLog.i(TAG, "initCoreVersionInfo, no apk in version(" + versionInfoForAbi.ver + ") dir");
            versionInfoForAbi = new XWebCoreInfo(-1, null, runtimeAbi);
            XWebCoreInfo.setVersionInfo(versionInfoForAbi);
        }
        int i16 = versionInfoForAbi.ver;
        if (i16 > 0 && XWebFileUtil.isExtractedCoreDirFileExist(i16, XWALK_SO_NAME)) {
            XWebLog.i(TAG, "initCoreVersionInfo, xwalk core version(" + versionInfoForAbi.ver + ") no longer support");
            versionInfoForAbi = new XWebCoreInfo(-1, null, runtimeAbi);
            XWebCoreInfo.setVersionInfo(versionInfoForAbi);
        }
        int i17 = versionInfoForAbi.ver;
        if (i17 > 0) {
            XWebCoreInfo.saveUsingCoreVersion(i17);
        }
        return versionInfoForAbi;
    }

    public static void initInChildProcess(Context context, boolean z15) {
        if (context == null) {
            XWebLog.w(TAG, "initInChildProcess, invalid context");
        } else if (hasInited()) {
            XWebLog.w(TAG, "initInChildProcess, already init");
        } else {
            XWebLog.w(TAG, "initInChildProcess start, sdkVersion:20231201, isIsolated:" + z15 + " stack:" + Log.getStackTraceString(new Exception("please ignore this exception")));
            sApplicationContext = convertContextToApplication(context);
            StringBuilder sb5 = new StringBuilder("initInChildProcess, application context:");
            sb5.append(sApplicationContext);
            XWebLog.w(TAG, sb5.toString());
            if (!z15) {
                XWebSharedPreferenceUtil.setApplicationContext(sApplicationContext);
                sXWebCoreVersionInfo = initCoreVersionInfo();
                XWebLog.i(TAG, "initInChildProcess, coreInfo:" + sXWebCoreVersionInfo);
            }
            XWebLog.w(TAG, "initInChildProcess end, processName:" + getProcessName());
        }
    }

    public static void initProcessServices() {
        setServicesName("com.tencent.xweb.pinus.sdk.process.PrivilegedProcessService", "com.tencent.xweb.pinus.sdk.process.SandboxedProcessService");
    }

    @DeprecatedOutsideXWebSdk
    @Deprecated
    public static boolean isCurrentSupportCustomContext() {
        if (WebView.getCurrentModuleWebCoreType() == WebView.WebViewKind.WV_KIND_PINUS) {
            return isCurrentVersionSupportCustomContext();
        }
        return false;
    }

    public static boolean isCurrentVersionSupportAudioMuted() {
        return hasAvailableVersion() && getFeatureSupport(XWebFeature.FEATURE_XWEB_AUDIO_MUTED);
    }

    public static boolean isCurrentVersionSupportConfigureV8Lite() {
        return hasAvailableVersion() && getFeatureSupport(XWebFeature.INTERFACE_CONFIGURE_V8_LITE);
    }

    public static boolean isCurrentVersionSupportContentHeightChange() {
        return hasAvailableVersion() && getFeatureSupport(2014);
    }

    @DeprecatedOutsideXWebSdk
    @Deprecated
    public static boolean isCurrentVersionSupportCustomContext() {
        return hasAvailableVersion() && getFeatureSupport(1020);
    }

    public static boolean isCurrentVersionSupportCustomInputForAppbrand() {
        return hasAvailableVersion() && getFeatureSupport(1041);
    }

    @DeprecatedOutsideXWebSdk
    @Deprecated
    public static boolean isCurrentVersionSupportCustomTextAreaForAppbrand() {
        return hasAvailableVersion() && getFeatureSupport(1012);
    }

    @DeprecatedOutsideXWebSdk
    @Deprecated
    public static boolean isCurrentVersionSupportExtendPluginForAppbrand() {
        return hasAvailableVersion() && getAvailableVersion() >= 300;
    }

    public static boolean isCurrentVersionSupportForceDarkMode() {
        return hasAvailableVersion() && getFeatureSupport(1021);
    }

    @DeprecatedOutsideXWebSdk
    @Deprecated
    public static boolean isCurrentVersionSupportMapExtendPluginForAppbrand() {
        return hasAvailableVersion() && getFeatureSupport(1011);
    }

    @DeprecatedOutsideXWebSdk
    @Deprecated
    public static boolean isCurrentVersionSupportNativeView() {
        return hasAvailableVersion() && getFeatureSupport(1013);
    }

    public static boolean isCurrentVersionSupportProxyOverrideReverseBypass() {
        return hasAvailableVersion() && getFeatureSupport(XWebFeature.FEATURE_PROXY_OVERRIDE_REVERSE_BYPASS);
    }

    public static boolean isCurrentVersionSupportScreenshotForSameLayer() {
        return hasAvailableVersion() && getFeatureSupport(2010);
    }

    public static boolean isCurrentVersionSupportSetProxyOverride() {
        return hasAvailableVersion() && getFeatureSupport(2015);
    }

    public static boolean isCurrentVersionSupportSetWebContentsSize() {
        return hasAvailableVersion() && getFeatureSupport(XWebFeature.INTERFACE_SET_WEB_CONTENTS_SIZE);
    }

    public static boolean isInTestMode() {
        return !TextUtils.isEmpty(XWebUpdateConfigUtil.getTestBaseConfigUrl());
    }

    public static boolean isPinusWebViewCoreFromAvailableVersion() {
        return getWebViewKindFromAvailableVersion() == WebView.WebViewKind.WV_KIND_PINUS;
    }

    public static boolean isPinusWebViewCoreFromInstalledNewstVersion(Context context) {
        return getWebViewKindFromInstalledNewstVersion(context) == WebView.WebViewKind.WV_KIND_PINUS;
    }

    public static boolean isTestVersion(int i15) {
        return i15 >= 100000000;
    }

    public static void refreshVersionInfo() {
        sXWebCoreVersionInfo = XWebCoreInfo.getVersionInfoForAbi(AbiUtil.getRuntimeAbi());
    }

    public static void reset() {
        XWebLog.i(TAG, "reset");
        sApplicationContext = null;
        sXWebCoreVersionInfo = null;
    }

    public static boolean setCoreVersionInfo(int i15, String str, String str2) {
        return XWebCoreInfo.setVersionInfo(i15, str, str2);
    }

    @DeprecatedOutsideXWebSdk
    @Deprecated
    public static void setCustomDensity(float f15) {
        XWebLog.i(TAG, "setCustomDensity:" + f15);
        Bundle bundle = sExtendConfig;
        synchronized (bundle) {
            bundle.putFloat(ConstValue.EXTEND_CONFIG_CUSTOM_DENSITY, f15);
        }
    }

    @DeprecatedOutsideXWebSdk
    @Deprecated
    public static void setEnableCheckCertificate(boolean z15) {
        sEnableCheckCertificate = z15;
        IWebViewProvider webViewProvider = WebViewWrapperFactory.getWebViewProvider(WebView.getCurrentModuleWebCoreType());
        if (webViewProvider != null) {
            webViewProvider.execute(ConstValue.STR_CMD_ENABLE_CHECK_CERTIFICATE, new Object[]{Boolean.valueOf(z15)});
        }
    }

    @DeprecatedOutsideXWebSdk
    @Deprecated
    public static synchronized void setEnableSandbox(boolean z15) {
        synchronized (XWalkEnvironment.class) {
            if (Build.VERSION.SDK_INT < 26) {
                XWebLog.i(TAG, "setEnableSandbox, disable sandbox because android version below O");
                sEnableSandbox = false;
            } else {
                XWebLog.i(TAG, "setEnableSandbox:" + z15);
                sEnableSandbox = z15;
            }
        }
    }

    @DeprecatedOutsideXWebSdk
    @Deprecated
    public static void setForceDarkBehavior(ForceDarkBehavior forceDarkBehavior) {
        if (forceDarkBehavior == ForceDarkBehavior.FORCE_DARK_ONLY) {
            sForceDarkBehavior = 0;
        } else if (forceDarkBehavior == ForceDarkBehavior.MEDIA_QUERY_ONLY) {
            sForceDarkBehavior = 1;
        } else if (forceDarkBehavior == ForceDarkBehavior.PREFER_MEDIA_QUERY_OVER_FORCE_DARK) {
            sForceDarkBehavior = 2;
        }
        XWebLog.i(TAG, "setForceDarkBehavior, forceDarkBehavior:" + forceDarkBehavior);
    }

    @DeprecatedOutsideXWebSdk
    @Deprecated
    public static void setForceDarkMode(boolean z15) {
        sIsForceDarkMode = z15;
        XWebLog.i(TAG, "setForceDarkMode, forceDarkMode:" + z15);
    }

    @DeprecatedOutsideXWebSdk
    @Deprecated
    public static void setLocale(Locale locale) {
        if (locale != null) {
            XWebLog.i(TAG, "setLocale, customize locale:" + locale.toLanguageTag());
            setLocaleString(locale.toLanguageTag());
            return;
        }
        XWebLog.w(TAG, "setLocale, customize locale not set");
    }

    private static void setLocaleString(String str) {
        sLocaleString = str;
    }

    @DeprecatedOutsideXWebSdk
    @Deprecated
    public static synchronized void setMultiProcessType(int i15) {
        synchronized (XWalkEnvironment.class) {
            XWebLog.w(TAG, "setMultiProcessType, multiProcessType:" + i15);
            multiProcessType = i15;
        }
    }

    private static void setServicesName(String str, String str2) {
        sPrivilegedServicesName = str;
        sSandboxedServicesName = str2;
    }

    @DeprecatedOutsideXWebSdk
    @Deprecated
    public static void setUsingCustomContext(boolean z15) {
        sUsingCustomContext = z15;
        XWebLog.i(TAG, "setUsingCustomContext, usingCustomContext:" + z15);
    }

    @DeprecatedOutsideXWebSdk
    @Deprecated
    public static void setV8LiteMode(boolean z15) {
        sEnableV8Lite = z15;
        XWebLog.i(TAG, "setV8LiteMode " + z15);
    }

    public static void setWebViewExtensionListener(WebViewExtensionListener webViewExtensionListener) {
        sWebViewExtensionListener = webViewExtensionListener;
    }

    private static void showBuildConfigs() {
        XWebLog.i(TAG, "showBuildConfigs, SHOULD_EMBED_XWEB_CORE:" + getBuildConfigShouldEmbedXWebCore() + ", XWEB_TEST_MODE:" + getBuildConfigXWebTestMode() + ", FORCE_XWEB_CORE:" + getBuildConfigForceXWebCore() + ", NEED_TURN_OFF_DYNAMIC_CODE:" + getBuildConfigNeedTurnOffDynamicCode() + ", THIRD_PARD_RELEASE:" + getBuildConfigThirdPartyRelease());
    }

    public static void tryLoadLocalAssetRuntime(Context context) {
        IWebViewProvider xWebViewProvider = WebViewWrapperFactory.getXWebViewProvider();
        if (xWebViewProvider != null) {
            xWebViewProvider.execute(ConstValue.STR_CMD_TRY_LOAD_LOCAL_ASSET_RUNTIME, new Object[]{context});
        }
    }

    public static int getInstalledNewstVersion(String str) {
        return XWebCoreInfo.getVersionInfoForAbi(str).ver;
    }

    public static int getInitConfig(String str, int i15) {
        int i16;
        Bundle bundle = sXWebInitConfigBundle;
        synchronized (bundle) {
            i16 = bundle.getInt(str, i15);
        }
        return i16;
    }

    public static String getInitConfig(String str, String str2) {
        String string;
        Bundle bundle = sXWebInitConfigBundle;
        synchronized (bundle) {
            string = bundle.getString(str, str2);
        }
        return string;
    }

    public static boolean getInitConfig(String str, boolean z15) {
        boolean z16;
        Bundle bundle = sXWebInitConfigBundle;
        synchronized (bundle) {
            z16 = bundle.getBoolean(str, z15);
        }
        return z16;
    }
}

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值