diff --git a/res/values/strings.xml b/res/values/strings.xml
index 28eaa1351ea..cea89c5b754 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -4538,6 +4538,12 @@
Show App Not Responding dialog
for background apps
+
+ Reduce WebView Network Usage
+
+ Reduce network usage by
+ proxying WebView connections through Google compression servers (Experimental)
+
Data usage
diff --git a/res/xml/development_prefs.xml b/res/xml/development_prefs.xml
index e9aeae8b95b..ef929b26738 100644
--- a/res/xml/development_prefs.xml
+++ b/res/xml/development_prefs.xml
@@ -4,9 +4,9 @@
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
-
+
http://www.apache.org/licenses/LICENSE-2.0
-
+
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -32,9 +32,9 @@
android:targetClass="com.android.settings.SetFullBackupPassword" />
-
+
diff --git a/src/com/android/settings/DevelopmentSettings.java b/src/com/android/settings/DevelopmentSettings.java
index bbee5e92e36..328cae9961d 100644
--- a/src/com/android/settings/DevelopmentSettings.java
+++ b/src/com/android/settings/DevelopmentSettings.java
@@ -60,6 +60,7 @@ import android.view.HardwareRenderer;
import android.view.IWindowManager;
import android.view.View;
import android.view.accessibility.AccessibilityManager;
+import android.webkit.WebView;
import android.widget.CompoundButton;
import android.widget.Switch;
import android.widget.TextView;
@@ -144,6 +145,8 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
private static final String SHOW_ALL_ANRS_KEY = "show_all_anrs";
+ private static final String WEBVIEW_DATA_REDUCTION_PROXY_KEY = "webview_data_reduction_proxy";
+
private static final String PROCESS_STATS = "proc_stats";
private static final String TAG_CONFIRM_ENFORCE = "confirm_enforce";
@@ -209,6 +212,8 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
private CheckBoxPreference mShowAllANRs;
+ private CheckBoxPreference mWebViewDataReductionProxy;
+
private PreferenceScreen mProcessStats;
private final ArrayList mAllPrefs = new ArrayList();
@@ -340,6 +345,8 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
mProcessStats = (PreferenceScreen) findPreference(PROCESS_STATS);
mAllPrefs.add(mProcessStats);
+
+ mWebViewDataReductionProxy = findAndInitCheckboxPref(WEBVIEW_DATA_REDUCTION_PROXY_KEY);
}
private ListPreference addListPreference(String prefKey) {
@@ -515,6 +522,7 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
updateImmediatelyDestroyActivitiesOptions();
updateAppProcessLimitOptions();
updateShowAllANRsOptions();
+ updateWebViewDataReductionProxyOptions();
updateVerifyAppsOverUsbOptions();
updateBugreportOptions();
updateForceRtlOptions();
@@ -1193,6 +1201,20 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
getActivity().getContentResolver(), Settings.Secure.ANR_SHOW_BACKGROUND, 0) != 0);
}
+ private void writeWebViewDataReductionProxyOptions() {
+ Settings.Secure.putInt(getActivity().getContentResolver(),
+ Settings.Secure.WEBVIEW_DATA_REDUCTION_PROXY,
+ mWebViewDataReductionProxy.isChecked() ? 1 : 0);
+ Intent intent = new Intent(WebView.DATA_REDUCTION_PROXY_SETTING_CHANGED);
+ getActivity().sendBroadcast(intent);
+ }
+
+ private void updateWebViewDataReductionProxyOptions() {
+ updateCheckBox(mWebViewDataReductionProxy, Settings.Secure.getInt(
+ getActivity().getContentResolver(),
+ Settings.Secure.WEBVIEW_DATA_REDUCTION_PROXY, 0) != 0);
+ }
+
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (buttonView == mEnabledSwitch) {
@@ -1309,6 +1331,8 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
writeImmediatelyDestroyActivitiesOptions();
} else if (preference == mShowAllANRs) {
writeShowAllANRsOptions();
+ } else if (preference == mWebViewDataReductionProxy) {
+ writeWebViewDataReductionProxyOptions();
} else if (preference == mForceHardwareUi) {
writeHardwareUiOptions();
} else if (preference == mForceMsaa) {