Clear notif upon bad wifi off + tests for bad wifi notif

If a notification is up and the avoid bad wifi setting
is turned off, the notification should disappear.

This patch also adds some general tests for the bad wifi
notifications.

Test: new tests in this patch
Change-Id: I5bc42afbe0efd93cfb59a759bf0aaba49a4bfc9f
This commit is contained in:
Chalard Jean
2022-09-16 18:01:12 +09:00
parent 8a9061f0b5
commit 1325a631cc
2 changed files with 37 additions and 12 deletions

View File

@@ -5083,8 +5083,14 @@ public class ConnectivityService extends IConnectivityManager.Stub
private void updateAvoidBadWifi() {
ensureRunningOnConnectivityServiceThread();
// Agent info scores and offer scores depend on whether cells yields to bad wifi.
final boolean avoidBadWifi = avoidBadWifi();
for (final NetworkAgentInfo nai : mNetworkAgentInfos) {
nai.updateScoreForNetworkAgentUpdate();
if (avoidBadWifi) {
// If the device is now avoiding bad wifi, remove notifications that might have
// been put up when the device didn't.
mNotifier.clearNotification(nai.network.getNetId(), NotificationType.LOST_INTERNET);
}
}
// UpdateOfferScore will update mNetworkOffers inline, so make a copy first.
final ArrayList<NetworkOfferInfo> offersToUpdate = new ArrayList<>(mNetworkOffers);