add developer setting for multiprocess webview
Change-Id: I9cd547ad4168b56b8b5c9eab9e2407daea74a30e
This commit is contained in:
@@ -84,6 +84,11 @@
|
|||||||
android:dialogTitle="@string/select_webview_provider_dialog_title"
|
android:dialogTitle="@string/select_webview_provider_dialog_title"
|
||||||
android:summary="%s" />
|
android:summary="%s" />
|
||||||
|
|
||||||
|
<SwitchPreference
|
||||||
|
android:key="enable_webview_multiprocess"
|
||||||
|
android:title="@string/enable_webview_multiprocess"
|
||||||
|
android:summary="@string/enable_webview_multiprocess_desc" />
|
||||||
|
|
||||||
<SwitchPreference
|
<SwitchPreference
|
||||||
android:key="color_temperature"
|
android:key="color_temperature"
|
||||||
android:title="@string/color_temperature"
|
android:title="@string/color_temperature"
|
||||||
|
@@ -53,6 +53,7 @@ import android.os.RemoteException;
|
|||||||
import android.os.ServiceManager;
|
import android.os.ServiceManager;
|
||||||
import android.os.StrictMode;
|
import android.os.StrictMode;
|
||||||
import android.os.SystemProperties;
|
import android.os.SystemProperties;
|
||||||
|
import android.os.UserHandle;
|
||||||
import android.os.UserManager;
|
import android.os.UserManager;
|
||||||
import android.os.storage.IMountService;
|
import android.os.storage.IMountService;
|
||||||
import android.provider.SearchIndexableResource;
|
import android.provider.SearchIndexableResource;
|
||||||
@@ -115,6 +116,7 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
|
|||||||
private static final String KEEP_SCREEN_ON = "keep_screen_on";
|
private static final String KEEP_SCREEN_ON = "keep_screen_on";
|
||||||
private static final String BT_HCI_SNOOP_LOG = "bt_hci_snoop_log";
|
private static final String BT_HCI_SNOOP_LOG = "bt_hci_snoop_log";
|
||||||
private static final String WEBVIEW_PROVIDER_KEY = "select_webview_provider";
|
private static final String WEBVIEW_PROVIDER_KEY = "select_webview_provider";
|
||||||
|
private static final String WEBVIEW_MULTIPROCESS_KEY = "enable_webview_multiprocess";
|
||||||
private static final String ENABLE_OEM_UNLOCK = "oem_unlock_enable";
|
private static final String ENABLE_OEM_UNLOCK = "oem_unlock_enable";
|
||||||
private static final String HDCP_CHECKING_KEY = "hdcp_checking";
|
private static final String HDCP_CHECKING_KEY = "hdcp_checking";
|
||||||
private static final String HDCP_CHECKING_PROPERTY = "persist.sys.hdcp_checking";
|
private static final String HDCP_CHECKING_PROPERTY = "persist.sys.hdcp_checking";
|
||||||
@@ -218,6 +220,7 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
|
|||||||
|
|
||||||
private IWindowManager mWindowManager;
|
private IWindowManager mWindowManager;
|
||||||
private IBackupManager mBackupManager;
|
private IBackupManager mBackupManager;
|
||||||
|
private IWebViewUpdateService mWebViewUpdateService;
|
||||||
private DevicePolicyManager mDpm;
|
private DevicePolicyManager mDpm;
|
||||||
private UserManager mUm;
|
private UserManager mUm;
|
||||||
private WifiManager mWifiManager;
|
private WifiManager mWifiManager;
|
||||||
@@ -277,6 +280,8 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
|
|||||||
private ListPreference mAnimatorDurationScale;
|
private ListPreference mAnimatorDurationScale;
|
||||||
private ListPreference mOverlayDisplayDevices;
|
private ListPreference mOverlayDisplayDevices;
|
||||||
private ListPreference mOpenGLTraces;
|
private ListPreference mOpenGLTraces;
|
||||||
|
|
||||||
|
private SwitchPreference mWebViewMultiprocess;
|
||||||
private ListPreference mWebViewProvider;
|
private ListPreference mWebViewProvider;
|
||||||
|
|
||||||
private ListPreference mSimulateColorSpace;
|
private ListPreference mSimulateColorSpace;
|
||||||
@@ -324,6 +329,9 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
|
|||||||
mWindowManager = IWindowManager.Stub.asInterface(ServiceManager.getService("window"));
|
mWindowManager = IWindowManager.Stub.asInterface(ServiceManager.getService("window"));
|
||||||
mBackupManager = IBackupManager.Stub.asInterface(
|
mBackupManager = IBackupManager.Stub.asInterface(
|
||||||
ServiceManager.getService(Context.BACKUP_SERVICE));
|
ServiceManager.getService(Context.BACKUP_SERVICE));
|
||||||
|
mWebViewUpdateService =
|
||||||
|
IWebViewUpdateService.Stub.asInterface(ServiceManager.getService("webviewupdate"));
|
||||||
|
|
||||||
mDpm = (DevicePolicyManager)getActivity().getSystemService(Context.DEVICE_POLICY_SERVICE);
|
mDpm = (DevicePolicyManager)getActivity().getSystemService(Context.DEVICE_POLICY_SERVICE);
|
||||||
mUm = (UserManager) getSystemService(Context.USER_SERVICE);
|
mUm = (UserManager) getSystemService(Context.USER_SERVICE);
|
||||||
|
|
||||||
@@ -418,6 +426,7 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
|
|||||||
mLogdSize = addListPreference(SELECT_LOGD_SIZE_KEY);
|
mLogdSize = addListPreference(SELECT_LOGD_SIZE_KEY);
|
||||||
mUsbConfiguration = addListPreference(USB_CONFIGURATION_KEY);
|
mUsbConfiguration = addListPreference(USB_CONFIGURATION_KEY);
|
||||||
mWebViewProvider = addListPreference(WEBVIEW_PROVIDER_KEY);
|
mWebViewProvider = addListPreference(WEBVIEW_PROVIDER_KEY);
|
||||||
|
mWebViewMultiprocess = findAndInitSwitchPref(WEBVIEW_MULTIPROCESS_KEY);
|
||||||
mBluetoothDisableAbsVolume = findAndInitSwitchPref(BLUETOOTH_DISABLE_ABSOLUTE_VOLUME_KEY);
|
mBluetoothDisableAbsVolume = findAndInitSwitchPref(BLUETOOTH_DISABLE_ABSOLUTE_VOLUME_KEY);
|
||||||
|
|
||||||
mWindowAnimationScale = addListPreference(WINDOW_ANIMATION_SCALE_KEY);
|
mWindowAnimationScale = addListPreference(WINDOW_ANIMATION_SCALE_KEY);
|
||||||
@@ -713,6 +722,7 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
|
|||||||
updateUSBAudioOptions();
|
updateUSBAudioOptions();
|
||||||
updateForceResizableOptions();
|
updateForceResizableOptions();
|
||||||
updateEnableFreeformWindowsSupportOptions();
|
updateEnableFreeformWindowsSupportOptions();
|
||||||
|
updateWebViewMultiprocessOptions();
|
||||||
updateWebViewProviderOptions();
|
updateWebViewProviderOptions();
|
||||||
updateOemUnlockOptions();
|
updateOemUnlockOptions();
|
||||||
if (mColorTemperaturePreference != null) {
|
if (mColorTemperaturePreference != null) {
|
||||||
@@ -748,10 +758,8 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void updateWebViewProviderOptions() {
|
private void updateWebViewProviderOptions() {
|
||||||
IWebViewUpdateService webViewUpdateService =
|
|
||||||
IWebViewUpdateService.Stub.asInterface(ServiceManager.getService("webviewupdate"));
|
|
||||||
try {
|
try {
|
||||||
WebViewProviderInfo[] providers = webViewUpdateService.getValidWebViewPackages();
|
WebViewProviderInfo[] providers = mWebViewUpdateService.getValidWebViewPackages();
|
||||||
if (providers == null) {
|
if (providers == null) {
|
||||||
Log.e(TAG, "No WebView providers available");
|
Log.e(TAG, "No WebView providers available");
|
||||||
return;
|
return;
|
||||||
@@ -765,7 +773,7 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
|
|||||||
mWebViewProvider.setEntries(options);
|
mWebViewProvider.setEntries(options);
|
||||||
mWebViewProvider.setEntryValues(values);
|
mWebViewProvider.setEntryValues(values);
|
||||||
|
|
||||||
String value = webViewUpdateService.getCurrentWebViewPackageName();
|
String value = mWebViewUpdateService.getCurrentWebViewPackageName();
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
value = "";
|
value = "";
|
||||||
}
|
}
|
||||||
@@ -780,6 +788,25 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void updateWebViewMultiprocessOptions() {
|
||||||
|
updateSwitchPreference(mWebViewMultiprocess,
|
||||||
|
Settings.Global.getInt(getActivity().getContentResolver(),
|
||||||
|
Settings.Global.WEBVIEW_MULTIPROCESS, 0) != 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
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();
|
||||||
|
ActivityManagerNative.getDefault().killPackageDependents(
|
||||||
|
wv_package, UserHandle.USER_ALL);
|
||||||
|
} catch(RemoteException e) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void updateHdcpValues() {
|
private void updateHdcpValues() {
|
||||||
ListPreference hdcpChecking = (ListPreference) findPreference(HDCP_CHECKING_KEY);
|
ListPreference hdcpChecking = (ListPreference) findPreference(HDCP_CHECKING_KEY);
|
||||||
if (hdcpChecking != null) {
|
if (hdcpChecking != null) {
|
||||||
@@ -820,11 +847,8 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void writeWebViewProviderOptions(Object newValue) {
|
private void writeWebViewProviderOptions(Object newValue) {
|
||||||
IWebViewUpdateService webViewUpdateService =
|
|
||||||
IWebViewUpdateService.Stub.asInterface(ServiceManager.getService("webviewupdate"));
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
webViewUpdateService.changeProviderAndSetting(
|
mWebViewUpdateService.changeProviderAndSetting(
|
||||||
newValue == null ? "" : newValue.toString());
|
newValue == null ? "" : newValue.toString());
|
||||||
updateWebViewProviderOptions();
|
updateWebViewProviderOptions();
|
||||||
} catch(RemoteException e) {
|
} catch(RemoteException e) {
|
||||||
@@ -1912,6 +1936,8 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
|
|||||||
startBackgroundCheckFragment();
|
startBackgroundCheckFragment();
|
||||||
} else if (preference == mBluetoothDisableAbsVolume) {
|
} else if (preference == mBluetoothDisableAbsVolume) {
|
||||||
writeBluetoothDisableAbsVolumeOptions();
|
writeBluetoothDisableAbsVolumeOptions();
|
||||||
|
} else if (preference == mWebViewMultiprocess) {
|
||||||
|
writeWebViewMultiprocessOptions();
|
||||||
} else {
|
} else {
|
||||||
return super.onPreferenceTreeClick(preference);
|
return super.onPreferenceTreeClick(preference);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user