diff options
| -rw-r--r-- | core/java/android/webkit/WebViewFactory.java | 43 |
1 files changed, 11 insertions, 32 deletions
diff --git a/core/java/android/webkit/WebViewFactory.java b/core/java/android/webkit/WebViewFactory.java index 0fd4e33a43d1..16daba05c9b7 100644 --- a/core/java/android/webkit/WebViewFactory.java +++ b/core/java/android/webkit/WebViewFactory.java @@ -28,19 +28,6 @@ import android.util.Log; * @hide */ public final class WebViewFactory { - private static final boolean DEFAULT_TO_EXPERIMENTAL_WEBVIEW = true; - // REMEMBER: property names must be <= 31 chars total. - private static final String EXPERIMENTAL_PROPERTY_DEFAULT_OFF = "persist.sys.webview.exp"; - private static final String EXPERIMENTAL_PROPERTY_DEFAULT_ON = - "persist.sys.webview." + Build.ID; - - // Modify the persisted property name when the new webview is on-by-default, so that any user - // setting override only lives as long as that build. - private static final String LONG_PROPERTY_NAME = DEFAULT_TO_EXPERIMENTAL_WEBVIEW ? - EXPERIMENTAL_PROPERTY_DEFAULT_ON : EXPERIMENTAL_PROPERTY_DEFAULT_OFF; - private static final String WEBVIEW_EXPERIMENTAL_PROPERTY = - LONG_PROPERTY_NAME.length() > SystemProperties.PROP_NAME_MAX ? - LONG_PROPERTY_NAME.substring(0, SystemProperties.PROP_NAME_MAX) : LONG_PROPERTY_NAME; private static final String FORCE_PROVIDER_PROPERTY = "webview.force_provider"; private static final String FORCE_PROVIDER_PROPERTY_VALUE_CHROMIUM = "chromium"; @@ -73,32 +60,25 @@ public final class WebViewFactory { private static final Object sProviderLock = new Object(); public static boolean isExperimentalWebViewAvailable() { - try { - // Pass false so we don't initialize the class at this point, as this will be wasted if - // it's not enabled. - Class.forName(CHROMIUM_WEBVIEW_FACTORY, false, WebViewFactory.class.getClassLoader()); - return true; - } catch (ClassNotFoundException e) { - return false; - } + // TODO: Remove callers of this method then remove it. + return false; // Hide the toggle in Developer Settings. } /** @hide */ public static void setUseExperimentalWebView(boolean enable) { - SystemProperties.set(WEBVIEW_EXPERIMENTAL_PROPERTY, enable ? "true" : "false"); - Log.i(LOGTAG, "Use Experimental WebView changed: " - + SystemProperties.get(WebViewFactory.WEBVIEW_EXPERIMENTAL_PROPERTY, "")); + // TODO: Remove callers of this method then remove it. } /** @hide */ public static boolean useExperimentalWebView() { - return SystemProperties.getBoolean(WEBVIEW_EXPERIMENTAL_PROPERTY, - DEFAULT_TO_EXPERIMENTAL_WEBVIEW); + // TODO: Remove callers of this method then remove it. + return isChromiumWebViewEnabled(); } /** @hide */ public static boolean isUseExperimentalWebViewSet() { - return !SystemProperties.get(WEBVIEW_EXPERIMENTAL_PROPERTY).isEmpty(); + // TODO: Remove callers of this method then remove it. + return false; // User has not modifed Developer Settings } static WebViewFactoryProvider getProvider() { @@ -140,21 +120,20 @@ public final class WebViewFactory { // We allow a system property to specify that we should use the experimental Chromium powered // WebView. This enables us to switch between implementations at runtime. - private static boolean isExperimentalWebViewEnabled() { - if (!isExperimentalWebViewAvailable()) return false; + private static boolean isChromiumWebViewEnabled() { String forceProviderName = SystemProperties.get(FORCE_PROVIDER_PROPERTY); - if (forceProviderName.isEmpty()) return useExperimentalWebView(); + if (forceProviderName.isEmpty()) return true; Log.i(LOGTAG, String.format("Provider overridden by property: %s=%s", FORCE_PROVIDER_PROPERTY, forceProviderName)); if (forceProviderName.equals(FORCE_PROVIDER_PROPERTY_VALUE_CHROMIUM)) return true; if (forceProviderName.equals(FORCE_PROVIDER_PROPERTY_VALUE_CLASSIC)) return false; Log.e(LOGTAG, String.format("Unrecognized provider: %s", forceProviderName)); - return useExperimentalWebView(); + return true; } private static Class<WebViewFactoryProvider> getFactoryClass() throws ClassNotFoundException { - if (isExperimentalWebViewEnabled()) { + if (isChromiumWebViewEnabled()) { return (Class<WebViewFactoryProvider>) Class.forName(CHROMIUM_WEBVIEW_FACTORY); } else { return (Class<WebViewFactoryProvider>) Class.forName(DEFAULT_WEBVIEW_FACTORY); |