[Wi-Fi] Index Wi-Fi preferences.

This is a WifiTracker2 version of partial part of ag/9980423

- Disable the "Saved network" if the access points is empty.
- Disable the "Wifi data usage" if there is no wifi radio.

Bug: 146823365
Test: manual
      Search 'Saved networks' when there is a saved Wi-Fi network
      and when there is no saved Wi-Fi network.
      Search 'data usage' on the device which supports Wi-Fi and
      on the device which does not supports Wi-Fi.
Change-Id: If46e65585f1b272401666f78fd5e3a4cf49bef6e
This commit is contained in:
Arc Wang
2020-03-30 15:47:57 +08:00
parent 9c32d89aaa
commit fd3360d28b
2 changed files with 18 additions and 4 deletions

View File

@@ -1304,9 +1304,7 @@ public class WifiSettings extends RestrictedSettingsFragment
final List<String> keys = super.getNonIndexableKeys(context);
final WifiManager wifiManager = context.getSystemService(WifiManager.class);
final List<AccessPoint> accessPoints = WifiSavedConfigUtils.getAllConfigs(
context, wifiManager);
if (accessPoints == null || accessPoints.size() <= 0) {
if (WifiSavedConfigUtils.getAllConfigsCount(context, wifiManager) == 0) {
keys.add(PREF_KEY_SAVED_NETWORKS);
}