diff options
author | Jonathan Dixon <joth@google.com> | 2013-08-21 14:00:08 -0700 |
---|---|---|
committer | Jonathan Dixon <joth@google.com> | 2013-08-21 16:51:29 -0700 |
commit | b7d5cbc0073e37e6bcb1e496aefb829babde6931 (patch) | |
tree | 5f4c9ba986ef024e8ab017cdf7a326d9fb87d126 | |
parent | 435e7dfd922510bbc081800d0c6092ea52ed9cd1 (diff) | |
download | frameworks_base-b7d5cbc0073e37e6bcb1e496aefb829babde6931.zip frameworks_base-b7d5cbc0073e37e6bcb1e496aefb829babde6931.tar.gz frameworks_base-b7d5cbc0073e37e6bcb1e496aefb829babde6931.tar.bz2 |
Reset the Experimental WebView property per build
In order to increase test coverage, reset to the default value everytime
the build ID changes.
Bug: 10427705
Change-Id: I75e301d26ee0ca52265c5f7fe48661787b596168
-rw-r--r-- | core/java/android/webkit/WebViewFactory.java | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/core/java/android/webkit/WebViewFactory.java b/core/java/android/webkit/WebViewFactory.java index 7e6bac4..0fd4e33 100644 --- a/core/java/android/webkit/WebViewFactory.java +++ b/core/java/android/webkit/WebViewFactory.java @@ -29,13 +29,18 @@ import android.util.Log; */ 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.exp_on"; + private static final String EXPERIMENTAL_PROPERTY_DEFAULT_ON = + "persist.sys.webview." + Build.ID; - // Modify the persisted property name when the experiment is on-by-default, so that any user - // setting override lives in a different property namespace. - private static final String WEBVIEW_EXPERIMENTAL_PROPERTY = DEFAULT_TO_EXPERIMENTAL_WEBVIEW ? - EXPERIMENTAL_PROPERTY_DEFAULT_ON : EXPERIMENTAL_PROPERTY_DEFAULT_OFF; + // 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"; @@ -80,8 +85,7 @@ public final class WebViewFactory { /** @hide */ public static void setUseExperimentalWebView(boolean enable) { - SystemProperties.set(WebViewFactory.WEBVIEW_EXPERIMENTAL_PROPERTY, - enable ? "true" : "false"); + SystemProperties.set(WEBVIEW_EXPERIMENTAL_PROPERTY, enable ? "true" : "false"); Log.i(LOGTAG, "Use Experimental WebView changed: " + SystemProperties.get(WebViewFactory.WEBVIEW_EXPERIMENTAL_PROPERTY, "")); } @@ -92,6 +96,11 @@ public final class WebViewFactory { DEFAULT_TO_EXPERIMENTAL_WEBVIEW); } + /** @hide */ + public static boolean isUseExperimentalWebViewSet() { + return !SystemProperties.get(WEBVIEW_EXPERIMENTAL_PROPERTY).isEmpty(); + } + static WebViewFactoryProvider getProvider() { synchronized (sProviderLock) { // For now the main purpose of this function (and the factory abstraction) is to keep |