Merge "Import translations. DO NOT MERGE" into jb-mr2-dev
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 573f4a0..fbf051e 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -4002,6 +4002,11 @@
     <string name="show_all_anrs_summary">Show App Not Responding dialog
         for background apps</string>
 
+    <!-- UI debug setting: use experimental WebView [CHAR LIMIT=25] -->
+    <string name="experimental_webview">Use Experimental WebView</string>
+    <!-- UI debug setting: use experimental WebView summary [CHAR LIMIT=50] -->
+    <string name="experimental_webview_summary">Apps will use the newest (beta) WebView</string>
+
     <!-- Activity title for network data usage summary. [CHAR LIMIT=25] -->
     <string name="data_usage_summary_title">Data usage</string>
     <!-- Title for option to pick visible time range from a list available usage periods. [CHAR LIMIT=25] -->
diff --git a/res/xml/development_prefs.xml b/res/xml/development_prefs.xml
index 6fbbbf4..72b73bb 100644
--- a/res/xml/development_prefs.xml
+++ b/res/xml/development_prefs.xml
@@ -234,6 +234,11 @@
             android:title="@string/show_all_anrs"
             android:summary="@string/show_all_anrs_summary"/>
 
+        <CheckBoxPreference
+            android:key="experimental_webview"
+            android:title="@string/experimental_webview"
+            android:summary="@string/experimental_webview_summary"/>
+
      </PreferenceCategory>
 
 </PreferenceScreen>
diff --git a/src/com/android/settings/DevelopmentSettings.java b/src/com/android/settings/DevelopmentSettings.java
index 4dfe700..d540195 100644
--- a/src/com/android/settings/DevelopmentSettings.java
+++ b/src/com/android/settings/DevelopmentSettings.java
@@ -57,6 +57,7 @@
 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 @@
 
     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 @@
     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 @@
         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 @@
         updateImmediatelyDestroyActivitiesOptions();
         updateAppProcessLimitOptions();
         updateShowAllANRsOptions();
+        updateExperimentalWebViewOptions();
         updateVerifyAppsOverUsbOptions();
         updateBugreportOptions();
     }
@@ -957,6 +971,21 @@
             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 @@
             writeImmediatelyDestroyActivitiesOptions();
         } else if (preference == mShowAllANRs) {
             writeShowAllANRsOptions();
+        } else if (preference == mExperimentalWebView) {
+            writeExperimentalWebViewOptions();
         } else if (preference == mForceHardwareUi) {
             writeHardwareUiOptions();
         } else if (preference == mForceMsaa) {