Remove Network Restrictions duplicate from setting search

Bug: 33701673
Test: make RunSettingsRoboTests
Change-Id: I6b1aef6102811a6ad25d2da43993441c6e56006c
This commit is contained in:
Matthew Fritze
2017-05-11 17:57:08 -07:00
parent 3b2d98c714
commit 8b0ed39c11
4 changed files with 29 additions and 10 deletions

View File

@@ -71,10 +71,11 @@ public class DataUsageSummary extends DataUsageBase implements Indexable, DataUs
public static final boolean TEST_RADIOS = false;
public static final String TEST_RADIOS_PROP = "test.radios";
public static final String KEY_RESTRICT_BACKGROUND = "restrict_background";
public static final String KEY_NETWORK_RESTRICTIONS = "network_restrictions";
private static final String KEY_STATUS_HEADER = "status_header";
private static final String KEY_LIMIT_SUMMARY = "limit_summary";
private static final String KEY_RESTRICT_BACKGROUND = "restrict_background";
private static final String KEY_NETWORK_RESTRICTIONS = "network_restrictions";
private static final String KEY_WIFI_USAGE_TITLE = "wifi_category";
private DataUsageController mDataUsageController;
@@ -465,7 +466,7 @@ public class DataUsageSummary extends DataUsageBase implements Indexable, DataUs
@Override
public List<SearchIndexableResource> getXmlResourcesToIndex(Context context,
boolean enabled) {
ArrayList<SearchIndexableResource> resources = new ArrayList<>();
List<SearchIndexableResource> resources = new ArrayList<>();
SearchIndexableResource resource = new SearchIndexableResource(context);
resource.xmlResId = R.xml.data_usage;
resources.add(resource);
@@ -485,13 +486,14 @@ public class DataUsageSummary extends DataUsageBase implements Indexable, DataUs
@Override
public List<String> getNonIndexableKeys(Context context) {
ArrayList<String> keys = new ArrayList<>();
boolean hasMobileData = ConnectivityManager.from(context).isNetworkSupported(
ConnectivityManager.TYPE_MOBILE);
List<String> keys = super.getNonIndexableKeys(context);
if (hasMobileData) {
if (hasMobileData(context)) {
keys.add(KEY_RESTRICT_BACKGROUND);
}
if (hasWifiRadio(context)) {
keys.add(KEY_NETWORK_RESTRICTIONS);
}
keys.add(KEY_WIFI_USAGE_TITLE);
return keys;