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
This commit is contained in:
@@ -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) {
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user