Adding developer toggle for using Chromium WebView.

This is hidden by default, and only revealed in device configurations that contain the Chromium WebView implementation.

BUG=8383477

Change-Id: I8fbb0bb55776e384b9bfc4feb6a2d30eed114ece
This commit is contained in:
Jared Duke
2013-03-15 15:13:41 -07:00
parent 9f5b49192d
commit 8dc6d08f3b
3 changed files with 41 additions and 0 deletions

View File

@@ -57,6 +57,7 @@ import android.preference.PreferenceScreen;
import android.provider.Settings;
import android.text.TextUtils;
import android.util.Log;
import android.webkit.WebViewFactory;
import android.view.Gravity;
import android.view.HardwareRenderer;
import android.view.IWindowManager;
@@ -130,6 +131,8 @@ public class DevelopmentSettings extends PreferenceFragment
private static final String SHOW_ALL_ANRS_KEY = "show_all_anrs";
private static final String WEBVIEW_EXPERIMENTAL_KEY = "experimental_webview";
private static final String TAG_CONFIRM_ENFORCE = "confirm_enforce";
private static final String PACKAGE_MIME_TYPE = "application/vnd.android.package-archive";
@@ -183,6 +186,7 @@ public class DevelopmentSettings extends PreferenceFragment
private ListPreference mAppProcessLimit;
private CheckBoxPreference mShowAllANRs;
private CheckBoxPreference mExperimentalWebView;
private final ArrayList<Preference> mAllPrefs = new ArrayList<Preference>();
private final ArrayList<CheckBoxPreference> mResetCbPrefs
@@ -275,6 +279,15 @@ public class DevelopmentSettings extends PreferenceFragment
mAllPrefs.add(mShowAllANRs);
mResetCbPrefs.add(mShowAllANRs);
if (WebViewFactory.isExperimentalWebViewAvailable()) {
mExperimentalWebView = findAndInitCheckboxPref(WEBVIEW_EXPERIMENTAL_KEY);
} else {
Preference experimentalWebView = findPreference(WEBVIEW_EXPERIMENTAL_KEY);
if (experimentalWebView != null) {
getPreferenceScreen().removePreference(experimentalWebView);
}
}
Preference hdcpChecking = findPreference(HDCP_CHECKING_KEY);
if (hdcpChecking != null) {
mAllPrefs.add(hdcpChecking);
@@ -431,6 +444,7 @@ public class DevelopmentSettings extends PreferenceFragment
updateImmediatelyDestroyActivitiesOptions();
updateAppProcessLimitOptions();
updateShowAllANRsOptions();
updateExperimentalWebViewOptions();
updateVerifyAppsOverUsbOptions();
updateBugreportOptions();
}
@@ -957,6 +971,21 @@ public class DevelopmentSettings extends PreferenceFragment
getActivity().getContentResolver(), Settings.Secure.ANR_SHOW_BACKGROUND, 0) != 0);
}
private void writeExperimentalWebViewOptions() {
if (mExperimentalWebView != null) {
SystemProperties.set(WebViewFactory.WEBVIEW_EXPERIMENTAL_PROPERTY,
mExperimentalWebView.isChecked() ? "true" : null);
pokeSystemProperties();
}
}
private void updateExperimentalWebViewOptions() {
if (mExperimentalWebView != null) {
updateCheckBox(mExperimentalWebView, SystemProperties.getBoolean(
WebViewFactory.WEBVIEW_EXPERIMENTAL_PROPERTY, false));
}
}
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (buttonView == mEnabledSwitch) {
@@ -1071,6 +1100,8 @@ public class DevelopmentSettings extends PreferenceFragment
writeImmediatelyDestroyActivitiesOptions();
} else if (preference == mShowAllANRs) {
writeShowAllANRsOptions();
} else if (preference == mExperimentalWebView) {
writeExperimentalWebViewOptions();
} else if (preference == mForceHardwareUi) {
writeHardwareUiOptions();
} else if (preference == mForceMsaa) {