Fix DataUsageSummary non-indexable keys

Indexing in DataUsage was not conventional, since it
blocked adding XML based on current sim status rather than
indexing everything and changing non-indexabe keys.

Manual merge for: ag/2631595

Change-Id: I7bb3cdb0f11772bbaefb6c21c61eb63bd0b17c7e
Fixes: 64193449
Test: robotests
This commit is contained in:
Matthew Fritze
2017-07-31 09:44:57 -07:00
parent 56538f1775
commit 621c24861c
6 changed files with 114 additions and 70 deletions

View File

@@ -69,12 +69,21 @@ public class DataUsageSummary extends DataUsageBase implements Indexable, DataUs
static final boolean LOGD = false;
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_MOBILE_USAGE_TITLE = "mobile_category";
private static final String KEY_WIFI_USAGE_TITLE = "wifi_category";
// Mobile data keys
public static final String KEY_MOBILE_USAGE_TITLE = "mobile_category";
public static final String KEY_MOBILE_DATA_USAGE_TOGGLE = "data_usage_enable";
public static final String KEY_MOBILE_DATA_USAGE = "cellular_data_usage";
public static final String KEY_MOBILE_BILLING_CYCLE = "billing_preference";
// Wifi keys
public static final String KEY_WIFI_USAGE_TITLE = "wifi_category";
public static final String KEY_WIFI_DATA_USAGE = "wifi_data_usage";
public static final String KEY_NETWORK_RESTRICTIONS = "network_restrictions";
private DataUsageController mDataUsageController;
private DataUsageInfoController mDataInfoController;
@@ -381,16 +390,14 @@ public class DataUsageSummary extends DataUsageBase implements Indexable, DataUs
resource.xmlResId = R.xml.data_usage;
resources.add(resource);
if (DataUsageUtils.hasMobileData(context)) {
resource = new SearchIndexableResource(context);
resource.xmlResId = R.xml.data_usage_cellular;
resources.add(resource);
}
if (DataUsageUtils.hasWifiRadio(context)) {
resource = new SearchIndexableResource(context);
resource.xmlResId = R.xml.data_usage_wifi;
resources.add(resource);
}
resource = new SearchIndexableResource(context);
resource.xmlResId = R.xml.data_usage_cellular;
resources.add(resource);
resource = new SearchIndexableResource(context);
resource.xmlResId = R.xml.data_usage_wifi;
resources.add(resource);
return resources;
}
@@ -398,12 +405,19 @@ public class DataUsageSummary extends DataUsageBase implements Indexable, DataUs
public List<String> getNonIndexableKeys(Context context) {
List<String> keys = super.getNonIndexableKeys(context);
if (DataUsageUtils.hasMobileData(context)) {
keys.add(KEY_RESTRICT_BACKGROUND);
if (!DataUsageUtils.hasMobileData(context)) {
keys.add(KEY_MOBILE_USAGE_TITLE);
keys.add(KEY_MOBILE_DATA_USAGE_TOGGLE);
keys.add(KEY_MOBILE_DATA_USAGE);
keys.add(KEY_MOBILE_BILLING_CYCLE);
}
if (DataUsageUtils.hasWifiRadio(context)) {
if (!DataUsageUtils.hasWifiRadio(context)) {
keys.add(KEY_WIFI_DATA_USAGE);
keys.add(KEY_NETWORK_RESTRICTIONS);
}
// This title is named Wifi, and will confuse users.
keys.add(KEY_WIFI_USAGE_TITLE);
return keys;