|
28 | 28 | * @hide
|
29 | 29 | */
|
30 | 30 | public final class WebViewFactory {
|
31 |
| - private static final boolean DEFAULT_TO_EXPERIMENTAL_WEBVIEW = true; |
32 |
| - // REMEMBER: property names must be <= 31 chars total. |
33 |
| - private static final String EXPERIMENTAL_PROPERTY_DEFAULT_OFF = "persist.sys.webview.exp"; |
34 |
| - private static final String EXPERIMENTAL_PROPERTY_DEFAULT_ON = |
35 |
| - "persist.sys.webview." + Build.ID; |
36 |
| - |
37 |
| - // Modify the persisted property name when the new webview is on-by-default, so that any user |
38 |
| - // setting override only lives as long as that build. |
39 |
| - private static final String LONG_PROPERTY_NAME = DEFAULT_TO_EXPERIMENTAL_WEBVIEW ? |
40 |
| - EXPERIMENTAL_PROPERTY_DEFAULT_ON : EXPERIMENTAL_PROPERTY_DEFAULT_OFF; |
41 |
| - private static final String WEBVIEW_EXPERIMENTAL_PROPERTY = |
42 |
| - LONG_PROPERTY_NAME.length() > SystemProperties.PROP_NAME_MAX ? |
43 |
| - LONG_PROPERTY_NAME.substring(0, SystemProperties.PROP_NAME_MAX) : LONG_PROPERTY_NAME; |
44 | 31 |
|
45 | 32 | private static final String FORCE_PROVIDER_PROPERTY = "webview.force_provider";
|
46 | 33 | private static final String FORCE_PROVIDER_PROPERTY_VALUE_CHROMIUM = "chromium";
|
@@ -73,32 +60,25 @@ private static class Preloader {
|
73 | 60 | private static final Object sProviderLock = new Object();
|
74 | 61 |
|
75 | 62 | public static boolean isExperimentalWebViewAvailable() {
|
76 |
| - try { |
77 |
| - // Pass false so we don't initialize the class at this point, as this will be wasted if |
78 |
| - // it's not enabled. |
79 |
| - Class.forName(CHROMIUM_WEBVIEW_FACTORY, false, WebViewFactory.class.getClassLoader()); |
80 |
| - return true; |
81 |
| - } catch (ClassNotFoundException e) { |
82 |
| - return false; |
83 |
| - } |
| 63 | + // TODO: Remove callers of this method then remove it. |
| 64 | + return false; // Hide the toggle in Developer Settings. |
84 | 65 | }
|
85 | 66 |
|
86 | 67 | /** @hide */
|
87 | 68 | public static void setUseExperimentalWebView(boolean enable) {
|
88 |
| - SystemProperties.set(WEBVIEW_EXPERIMENTAL_PROPERTY, enable ? "true" : "false"); |
89 |
| - Log.i(LOGTAG, "Use Experimental WebView changed: " |
90 |
| - + SystemProperties.get(WebViewFactory.WEBVIEW_EXPERIMENTAL_PROPERTY, "")); |
| 69 | + // TODO: Remove callers of this method then remove it. |
91 | 70 | }
|
92 | 71 |
|
93 | 72 | /** @hide */
|
94 | 73 | public static boolean useExperimentalWebView() {
|
95 |
| - return SystemProperties.getBoolean(WEBVIEW_EXPERIMENTAL_PROPERTY, |
96 |
| - DEFAULT_TO_EXPERIMENTAL_WEBVIEW); |
| 74 | + // TODO: Remove callers of this method then remove it. |
| 75 | + return isChromiumWebViewEnabled(); |
97 | 76 | }
|
98 | 77 |
|
99 | 78 | /** @hide */
|
100 | 79 | public static boolean isUseExperimentalWebViewSet() {
|
101 |
| - return !SystemProperties.get(WEBVIEW_EXPERIMENTAL_PROPERTY).isEmpty(); |
| 80 | + // TODO: Remove callers of this method then remove it. |
| 81 | + return false; // User has not modifed Developer Settings |
102 | 82 | }
|
103 | 83 |
|
104 | 84 | static WebViewFactoryProvider getProvider() {
|
@@ -140,21 +120,20 @@ static WebViewFactoryProvider getProvider() {
|
140 | 120 |
|
141 | 121 | // We allow a system property to specify that we should use the experimental Chromium powered
|
142 | 122 | // WebView. This enables us to switch between implementations at runtime.
|
143 |
| - private static boolean isExperimentalWebViewEnabled() { |
144 |
| - if (!isExperimentalWebViewAvailable()) return false; |
| 123 | + private static boolean isChromiumWebViewEnabled() { |
145 | 124 | String forceProviderName = SystemProperties.get(FORCE_PROVIDER_PROPERTY);
|
146 |
| - if (forceProviderName.isEmpty()) return useExperimentalWebView(); |
| 125 | + if (forceProviderName.isEmpty()) return true; |
147 | 126 |
|
148 | 127 | Log.i(LOGTAG, String.format("Provider overridden by property: %s=%s",
|
149 | 128 | FORCE_PROVIDER_PROPERTY, forceProviderName));
|
150 | 129 | if (forceProviderName.equals(FORCE_PROVIDER_PROPERTY_VALUE_CHROMIUM)) return true;
|
151 | 130 | if (forceProviderName.equals(FORCE_PROVIDER_PROPERTY_VALUE_CLASSIC)) return false;
|
152 | 131 | Log.e(LOGTAG, String.format("Unrecognized provider: %s", forceProviderName));
|
153 |
| - return useExperimentalWebView(); |
| 132 | + return true; |
154 | 133 | }
|
155 | 134 |
|
156 | 135 | private static Class<WebViewFactoryProvider> getFactoryClass() throws ClassNotFoundException {
|
157 |
| - if (isExperimentalWebViewEnabled()) { |
| 136 | + if (isChromiumWebViewEnabled()) { |
158 | 137 | return (Class<WebViewFactoryProvider>) Class.forName(CHROMIUM_WEBVIEW_FACTORY);
|
159 | 138 | } else {
|
160 | 139 | return (Class<WebViewFactoryProvider>) Class.forName(DEFAULT_WEBVIEW_FACTORY);
|
|
0 commit comments