Add an experimental webview setting to dev options.
Bug:12492817 Add an experimental webview setting to developer options to enable data reduction proxy. Change-Id: I6e0931b39c8dd129622129589ae67352c8396cd2
This commit is contained in:
@@ -4538,6 +4538,12 @@
|
|||||||
<string name="show_all_anrs_summary">Show App Not Responding dialog
|
<string name="show_all_anrs_summary">Show App Not Responding dialog
|
||||||
for background apps</string>
|
for background apps</string>
|
||||||
|
|
||||||
|
<!-- UI debug setting: webview data reduction proxy [CHAR LIMIT=25] -->
|
||||||
|
<string name="webview_data_reduction_proxy">Reduce WebView Network Usage</string>
|
||||||
|
<!-- UI debug setting: webview data reduction proxy summary [CHAR LIMIT=150] -->
|
||||||
|
<string name="webview_data_reduction_proxy_summary">Reduce network usage by
|
||||||
|
proxying WebView connections through Google compression servers (Experimental)</string>
|
||||||
|
|
||||||
<!-- Activity title for network data usage summary. [CHAR LIMIT=25] -->
|
<!-- Activity title for network data usage summary. [CHAR LIMIT=25] -->
|
||||||
<string name="data_usage_summary_title">Data usage</string>
|
<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] -->
|
<!-- Title for option to pick visible time range from a list available usage periods. [CHAR LIMIT=25] -->
|
||||||
|
@@ -286,6 +286,10 @@
|
|||||||
android:title="@string/show_all_anrs"
|
android:title="@string/show_all_anrs"
|
||||||
android:summary="@string/show_all_anrs_summary"/>
|
android:summary="@string/show_all_anrs_summary"/>
|
||||||
|
|
||||||
|
<CheckBoxPreference
|
||||||
|
android:key="webview_data_reduction_proxy"
|
||||||
|
android:title="@string/webview_data_reduction_proxy"
|
||||||
|
android:summary="@string/webview_data_reduction_proxy_summary"/>
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
||||||
|
@@ -60,6 +60,7 @@ import android.view.HardwareRenderer;
|
|||||||
import android.view.IWindowManager;
|
import android.view.IWindowManager;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.accessibility.AccessibilityManager;
|
import android.view.accessibility.AccessibilityManager;
|
||||||
|
import android.webkit.WebView;
|
||||||
import android.widget.CompoundButton;
|
import android.widget.CompoundButton;
|
||||||
import android.widget.Switch;
|
import android.widget.Switch;
|
||||||
import android.widget.TextView;
|
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 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 PROCESS_STATS = "proc_stats";
|
||||||
|
|
||||||
private static final String TAG_CONFIRM_ENFORCE = "confirm_enforce";
|
private static final String TAG_CONFIRM_ENFORCE = "confirm_enforce";
|
||||||
@@ -209,6 +212,8 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
|
|||||||
|
|
||||||
private CheckBoxPreference mShowAllANRs;
|
private CheckBoxPreference mShowAllANRs;
|
||||||
|
|
||||||
|
private CheckBoxPreference mWebViewDataReductionProxy;
|
||||||
|
|
||||||
private PreferenceScreen mProcessStats;
|
private PreferenceScreen mProcessStats;
|
||||||
|
|
||||||
private final ArrayList<Preference> mAllPrefs = new ArrayList<Preference>();
|
private final ArrayList<Preference> mAllPrefs = new ArrayList<Preference>();
|
||||||
@@ -340,6 +345,8 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
|
|||||||
|
|
||||||
mProcessStats = (PreferenceScreen) findPreference(PROCESS_STATS);
|
mProcessStats = (PreferenceScreen) findPreference(PROCESS_STATS);
|
||||||
mAllPrefs.add(mProcessStats);
|
mAllPrefs.add(mProcessStats);
|
||||||
|
|
||||||
|
mWebViewDataReductionProxy = findAndInitCheckboxPref(WEBVIEW_DATA_REDUCTION_PROXY_KEY);
|
||||||
}
|
}
|
||||||
|
|
||||||
private ListPreference addListPreference(String prefKey) {
|
private ListPreference addListPreference(String prefKey) {
|
||||||
@@ -515,6 +522,7 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
|
|||||||
updateImmediatelyDestroyActivitiesOptions();
|
updateImmediatelyDestroyActivitiesOptions();
|
||||||
updateAppProcessLimitOptions();
|
updateAppProcessLimitOptions();
|
||||||
updateShowAllANRsOptions();
|
updateShowAllANRsOptions();
|
||||||
|
updateWebViewDataReductionProxyOptions();
|
||||||
updateVerifyAppsOverUsbOptions();
|
updateVerifyAppsOverUsbOptions();
|
||||||
updateBugreportOptions();
|
updateBugreportOptions();
|
||||||
updateForceRtlOptions();
|
updateForceRtlOptions();
|
||||||
@@ -1193,6 +1201,20 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
|
|||||||
getActivity().getContentResolver(), Settings.Secure.ANR_SHOW_BACKGROUND, 0) != 0);
|
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
|
@Override
|
||||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||||
if (buttonView == mEnabledSwitch) {
|
if (buttonView == mEnabledSwitch) {
|
||||||
@@ -1309,6 +1331,8 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
|
|||||||
writeImmediatelyDestroyActivitiesOptions();
|
writeImmediatelyDestroyActivitiesOptions();
|
||||||
} else if (preference == mShowAllANRs) {
|
} else if (preference == mShowAllANRs) {
|
||||||
writeShowAllANRsOptions();
|
writeShowAllANRsOptions();
|
||||||
|
} else if (preference == mWebViewDataReductionProxy) {
|
||||||
|
writeWebViewDataReductionProxyOptions();
|
||||||
} else if (preference == mForceHardwareUi) {
|
} else if (preference == mForceHardwareUi) {
|
||||||
writeHardwareUiOptions();
|
writeHardwareUiOptions();
|
||||||
} else if (preference == mForceMsaa) {
|
} else if (preference == mForceMsaa) {
|
||||||
|
Reference in New Issue
Block a user