Remove use of forceUpdate.

Now that WifiTracker correctly handles eviction of stale scan results
only after scanning has resumed, it is no longer necessary to
conditionally fetch APs on app resumption.

Fix broken test.

Bug: 68030053
Test: runtest --path
tests/unit/src/com/android/settings/wifi/WifiSettingsUiTest.java

Change-Id: Ib4c8d6e53cf760fcb5f00069da40c578171c09f4
This commit is contained in:
Sundeep Ghuman
2018-02-08 17:34:39 -08:00
parent e5020950f1
commit 0f711f86a6
2 changed files with 4 additions and 50 deletions

View File

@@ -352,32 +352,6 @@ public class WifiSettings extends RestrictedSettingsFragment
getPreferenceScreen().removeAll();
}
/**
* Only update the AP list if there are not any APs currently shown.
*
* <p>Thus forceUpdate will only be called during cold start or when toggling between wifi on
* and off. In other use cases, the previous APs will remain until the next update is received
* from {@link WifiTracker}.
*/
private void conditionallyForceUpdateAPs() {
if (mAccessPointsPreferenceCategory.getPreferenceCount() > 0
&& mAccessPointsPreferenceCategory.getPreference(0) instanceof
AccessPointPreference) {
// Make sure we don't update due to callbacks initiated by sticky broadcasts in
// WifiTracker.
Log.d(TAG, "Did not force update APs due to existing APs displayed");
getView().removeCallbacks(mUpdateAccessPointsRunnable);
return;
}
setProgressBarVisible(true);
mWifiTracker.forceUpdate();
if (isVerboseLoggingEnabled()) {
Log.i(TAG, "WifiSettings force update APs: " + mWifiTracker.getAccessPoints());
}
getView().removeCallbacks(mUpdateAccessPointsRunnable);
updateAccessPointPreferences();
}
/**
* @return new WifiEnabler or null (as overridden by WifiSettingsForSetupWizard)
*/
@@ -682,7 +656,7 @@ public class WifiSettings extends RestrictedSettingsFragment
final int wifiState = mWifiManager.getWifiState();
switch (wifiState) {
case WifiManager.WIFI_STATE_ENABLED:
conditionallyForceUpdateAPs();
updateAccessPointPreferences();
break;
case WifiManager.WIFI_STATE_ENABLING: