From d86ebaa0f64e8b0dc4d00d04a4073ea21b1dd373 Mon Sep 17 00:00:00 2001 From: "Torne (Richard Coles)" Date: Tue, 10 Jan 2017 16:06:52 +0000 Subject: [PATCH] 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 --- .../android/settings/DevelopmentSettings.java | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/com/android/settings/DevelopmentSettings.java b/src/com/android/settings/DevelopmentSettings.java index 418c1e2aae5..e69521ec50e 100644 --- a/src/com/android/settings/DevelopmentSettings.java +++ b/src/com/android/settings/DevelopmentSettings.java @@ -865,20 +865,16 @@ public class DevelopmentSettings extends RestrictedSettingsFragment } 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) { } }