Remove extra IndexProviders that provided bad data.

Gesture Settings and Wireless settings were indexing
duplicate results that only added complexity to Search.
PowerUsageDetail was never supposed to be indexed.

Bug:33701673
Test: make RunSettingsRoboTests
Change-Id: I45d1fa4bd412c3418acec24f8c98eb4736f220ab
This commit is contained in:
Matthew Fritze
2017-01-26 15:21:24 -08:00
parent 007d120c47
commit 46173a5265
15 changed files with 4 additions and 253 deletions

View File

@@ -216,56 +216,4 @@ public class WirelessSettings extends SettingsPreferenceFragment implements Inde
protected int getHelpResource() {
return R.string.help_url_more_networks;
}
/**
* For Search.
*/
public static final Indexable.SearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
new BaseSearchIndexProvider() {
@Override
public List<SearchIndexableResource> getXmlResourcesToIndex(
Context context, boolean enabled) {
// Remove wireless settings from search in demo mode
if (UserManager.isDeviceInDemoMode(context)) {
return Collections.emptyList();
}
SearchIndexableResource sir = new SearchIndexableResource(context);
sir.xmlResId = R.xml.wireless_settings;
return Arrays.asList(sir);
}
@Override
public List<String> getNonIndexableKeys(Context context) {
final ArrayList<String> result = new ArrayList<String>();
final UserManager um = (UserManager) context.getSystemService(
Context.USER_SERVICE);
final boolean isSecondaryUser = !um.isAdminUser();
final boolean isWimaxEnabled = !isSecondaryUser
&& context.getResources().getBoolean(
com.android.internal.R.bool.config_wimaxEnabled);
if (!isWimaxEnabled) {
result.add(KEY_WIMAX_SETTINGS);
}
new VpnPreferenceController(context).updateNonIndexableKeys(result);
new NfcPreferenceController(context).updateNonIndexableKeys(result);
new MobilePlanPreferenceController(context, null /* MobilePlanClickHandler */)
.updateNonIndexableKeys(result);
new MobileNetworkPreferenceController(context)
.updateNonIndexableKeys(result);
// Remove Airplane Mode settings if it's a stationary device such as a TV.
new AirplaneModePreferenceController(context, null /* fragment */)
.updateNonIndexableKeys(result);
new ProxyPreferenceController(context).updateNonIndexableKeys(result);
new TetherPreferenceController(context).updateNonIndexableKeys(result);
new WifiCallingPreferenceController(context).updateNonIndexableKeys(result);
return result;
}
};
}