Delegate multiprocess flag to WebView update service.
Instead of letting DevelopmentSettings manage the setting directly and
observing the changes from WebViewUpdateService, have the update service
manage the setting and just expose IPCs for the settings app to use to
get/set the setting. This means we can set a more flexible policy for
whether multiprocess is enabled by default and change it without
touching the settings code, though for now this CL does not change the
behaviour and is just a refactoring.
Bug: 21643067
Test: Toggle multiprocess WebView in developer settings
Change-Id: I777fccf5d0106b0c4c442d043dc6df25ed7ea487
diff --git a/src/com/android/settings/DevelopmentSettings.java b/src/com/android/settings/DevelopmentSettings.java
index 418c1e2..e69521e 100644
--- a/src/com/android/settings/DevelopmentSettings.java
+++ b/src/com/android/settings/DevelopmentSettings.java
@@ -865,20 +865,16 @@
}
private void updateWebViewMultiprocessOptions() {
- updateSwitchPreference(mWebViewMultiprocess,
- Settings.Global.getInt(getActivity().getContentResolver(),
- Settings.Global.WEBVIEW_MULTIPROCESS, 0) != 0);
+ try {
+ updateSwitchPreference(mWebViewMultiprocess,
+ mWebViewUpdateService.isMultiProcessEnabled());
+ } catch (RemoteException e) {
+ }
}
private void writeWebViewMultiprocessOptions() {
- boolean value = mWebViewMultiprocess.isChecked();
- Settings.Global.putInt(getActivity().getContentResolver(),
- Settings.Global.WEBVIEW_MULTIPROCESS, value ? 1 : 0);
-
try {
- String wv_package = mWebViewUpdateService.getCurrentWebViewPackageName();
- ActivityManager.getService().killPackageDependents(
- wv_package, UserHandle.USER_ALL);
+ mWebViewUpdateService.enableMultiProcess(mWebViewMultiprocess.isChecked());
} catch (RemoteException e) {
}
}