Merge "Add WebView provider setting to developer settings."
This commit is contained in:
committed by
Android (Google) Code Review
commit
a48f16fe01
@@ -79,6 +79,12 @@
|
|||||||
android:summary="@string/picture_color_mode_desc"
|
android:summary="@string/picture_color_mode_desc"
|
||||||
android:persistent="false" />
|
android:persistent="false" />
|
||||||
|
|
||||||
|
<ListPreference
|
||||||
|
android:key="select_webview_provider"
|
||||||
|
android:title="@string/select_webview_provider_title"
|
||||||
|
android:dialogTitle="@string/select_webview_provider_dialog_title"
|
||||||
|
android:summary="%s" />
|
||||||
|
|
||||||
<PreferenceCategory android:key="debug_debugging_category"
|
<PreferenceCategory android:key="debug_debugging_category"
|
||||||
android:title="@string/debug_debugging_category">
|
android:title="@string/debug_debugging_category">
|
||||||
|
|
||||||
|
@@ -72,6 +72,8 @@ import android.view.LayoutInflater;
|
|||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.view.accessibility.AccessibilityManager;
|
import android.view.accessibility.AccessibilityManager;
|
||||||
|
import android.webkit.IWebViewUpdateService;
|
||||||
|
import android.webkit.WebViewProviderInfo;
|
||||||
import android.widget.Switch;
|
import android.widget.Switch;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
@@ -110,6 +112,7 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
|
|||||||
private static final String ENABLE_TERMINAL = "enable_terminal";
|
private static final String ENABLE_TERMINAL = "enable_terminal";
|
||||||
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 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";
|
||||||
@@ -253,6 +256,7 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
|
|||||||
private ListPreference mAnimatorDurationScale;
|
private ListPreference mAnimatorDurationScale;
|
||||||
private ListPreference mOverlayDisplayDevices;
|
private ListPreference mOverlayDisplayDevices;
|
||||||
private ListPreference mOpenGLTraces;
|
private ListPreference mOpenGLTraces;
|
||||||
|
private ListPreference mWebViewProvider;
|
||||||
|
|
||||||
private ListPreference mSimulateColorSpace;
|
private ListPreference mSimulateColorSpace;
|
||||||
|
|
||||||
@@ -389,6 +393,7 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
|
|||||||
mMobileDataAlwaysOn = findAndInitSwitchPref(MOBILE_DATA_ALWAYS_ON);
|
mMobileDataAlwaysOn = findAndInitSwitchPref(MOBILE_DATA_ALWAYS_ON);
|
||||||
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);
|
||||||
|
|
||||||
mWindowAnimationScale = addListPreference(WINDOW_ANIMATION_SCALE_KEY);
|
mWindowAnimationScale = addListPreference(WINDOW_ANIMATION_SCALE_KEY);
|
||||||
mTransitionAnimationScale = addListPreference(TRANSITION_ANIMATION_SCALE_KEY);
|
mTransitionAnimationScale = addListPreference(TRANSITION_ANIMATION_SCALE_KEY);
|
||||||
@@ -461,6 +466,7 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
|
|||||||
removePreference(KEY_COLOR_MODE);
|
removePreference(KEY_COLOR_MODE);
|
||||||
mColorModePreference = null;
|
mColorModePreference = null;
|
||||||
}
|
}
|
||||||
|
updateWebViewProviderOptions();
|
||||||
}
|
}
|
||||||
|
|
||||||
private ListPreference addListPreference(String prefKey) {
|
private ListPreference addListPreference(String prefKey) {
|
||||||
@@ -669,6 +675,7 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
|
|||||||
updateSimulateColorSpace();
|
updateSimulateColorSpace();
|
||||||
updateUSBAudioOptions();
|
updateUSBAudioOptions();
|
||||||
updateForceResizableOptions();
|
updateForceResizableOptions();
|
||||||
|
updateWebViewProviderOptions();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void resetDangerousOptions() {
|
private void resetDangerousOptions() {
|
||||||
@@ -697,6 +704,35 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
|
|||||||
pokeSystemProperties();
|
pokeSystemProperties();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void updateWebViewProviderOptions() {
|
||||||
|
IWebViewUpdateService webViewUpdateService =
|
||||||
|
IWebViewUpdateService.Stub.asInterface(ServiceManager.getService("webviewupdate"));
|
||||||
|
try {
|
||||||
|
WebViewProviderInfo[] providers = webViewUpdateService.getValidWebViewPackages();
|
||||||
|
String[] options = new String[providers.length];
|
||||||
|
String[] values = new String[providers.length];
|
||||||
|
for(int n = 0; n < providers.length; n++) {
|
||||||
|
options[n] = providers[n].description;
|
||||||
|
values[n] = providers[n].packageName;
|
||||||
|
}
|
||||||
|
mWebViewProvider.setEntries(options);
|
||||||
|
mWebViewProvider.setEntryValues(values);
|
||||||
|
|
||||||
|
String value = webViewUpdateService.getCurrentWebViewPackageName();
|
||||||
|
if (value == null) {
|
||||||
|
value = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < values.length; i++) {
|
||||||
|
if (value.contentEquals(values[i])) {
|
||||||
|
mWebViewProvider.setValueIndex(i);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} 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) {
|
||||||
@@ -736,6 +772,18 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
|
|||||||
mBtHciSnoopLog.isChecked() ? 1 : 0);
|
mBtHciSnoopLog.isChecked() ? 1 : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void writeWebViewProviderOptions(Object newValue) {
|
||||||
|
IWebViewUpdateService webViewUpdateService =
|
||||||
|
IWebViewUpdateService.Stub.asInterface(ServiceManager.getService("webviewupdate"));
|
||||||
|
|
||||||
|
try {
|
||||||
|
webViewUpdateService.changeProviderAndSetting(
|
||||||
|
newValue == null ? "" : newValue.toString());
|
||||||
|
updateWebViewProviderOptions();
|
||||||
|
} catch(RemoteException e) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void writeDebuggerOptions() {
|
private void writeDebuggerOptions() {
|
||||||
try {
|
try {
|
||||||
ActivityManagerNative.getDefault().setDebugApp(
|
ActivityManagerNative.getDefault().setDebugApp(
|
||||||
@@ -1754,6 +1802,9 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
|
|||||||
updateHdcpValues();
|
updateHdcpValues();
|
||||||
pokeSystemProperties();
|
pokeSystemProperties();
|
||||||
return true;
|
return true;
|
||||||
|
} else if (preference == mWebViewProvider) {
|
||||||
|
writeWebViewProviderOptions(newValue);
|
||||||
|
return true;
|
||||||
} else if (preference == mLogdSize) {
|
} else if (preference == mLogdSize) {
|
||||||
writeLogdSizeOption(newValue);
|
writeLogdSizeOption(newValue);
|
||||||
return true;
|
return true;
|
||||||
|
Reference in New Issue
Block a user