Restrict app data on metered networks.
Paired with framework change that no longer requires NetworkPolicy
to have limit when restricting apps.
Bug: 5571454
Change-Id: I2a5d8446a9278afb183e13d0f41f436ccb3bc9e8
diff --git a/src/com/android/settings/DataUsageSummary.java b/src/com/android/settings/DataUsageSummary.java
index 46d6c65..f33c11f 100644
--- a/src/com/android/settings/DataUsageSummary.java
+++ b/src/com/android/settings/DataUsageSummary.java
@@ -474,11 +474,7 @@
case R.id.data_usage_menu_restrict_background: {
final boolean restrictBackground = !item.isChecked();
if (restrictBackground) {
- if (hasLimitedNetworks()) {
- ConfirmRestrictFragment.show(this);
- } else {
- DeniedRestrictFragment.show(this);
- }
+ ConfirmRestrictFragment.show(this);
} else {
// no confirmation to drop restriction
setRestrictBackground(false);
@@ -764,13 +760,8 @@
&& !getRestrictBackground() && isBandwidthControlEnabled()
&& hasMobileRadio(context)) {
setPreferenceTitle(mAppRestrictView, R.string.data_usage_app_restrict_background);
- if (hasLimitedNetworks()) {
- setPreferenceSummary(mAppRestrictView,
- getString(R.string.data_usage_app_restrict_background_summary));
- } else {
- setPreferenceSummary(mAppRestrictView,
- getString(R.string.data_usage_app_restrict_background_summary_disabled));
- }
+ setPreferenceSummary(mAppRestrictView,
+ getString(R.string.data_usage_app_restrict_background_summary));
mAppRestrictView.setVisibility(View.VISIBLE);
mAppRestrict.setChecked(getAppRestrictBackground());
@@ -1037,16 +1028,10 @@
final boolean restrictBackground = !mAppRestrict.isChecked();
if (restrictBackground) {
- if (hasLimitedNetworks()) {
- // enabling restriction; show confirmation dialog which
- // eventually calls setRestrictBackground() once user
- // confirms.
- ConfirmAppRestrictFragment.show(DataUsageSummary.this);
- } else {
- // no limited networks; show dialog to guide user towards
- // setting a network limit. doesn't mutate restrict state.
- DeniedRestrictFragment.show(DataUsageSummary.this);
- }
+ // enabling restriction; show confirmation dialog which
+ // eventually calls setRestrictBackground() once user
+ // confirms.
+ ConfirmAppRestrictFragment.show(DataUsageSummary.this);
} else {
setAppRestrictBackground(false);
}