Don't notify on network switch if source network is validated. am: fde640e59d am: b301283d57 am: a0a41b1e3d

am: bed9b4583d

Change-Id: I150cbafb6ab3fce4800241bfacec4bf4ee73db31
This commit is contained in:
Lorenzo Colitti
2016-08-31 22:40:41 +00:00
committed by android-build-merger
2 changed files with 9 additions and 3 deletions

View File

@@ -4721,9 +4721,6 @@ public class ConnectivityService extends IConnectivityManager.Stub
if (VDBG) log(" accepting network in place of " + currentNetwork.name()); if (VDBG) log(" accepting network in place of " + currentNetwork.name());
currentNetwork.removeRequest(nri.request.requestId); currentNetwork.removeRequest(nri.request.requestId);
currentNetwork.lingerRequest(nri.request, now, mLingerDelayMs); currentNetwork.lingerRequest(nri.request, now, mLingerDelayMs);
if (isDefaultRequest(nri)) {
mLingerMonitor.noteLingerDefaultNetwork(currentNetwork, newNetwork);
}
affectedNetworks.add(currentNetwork); affectedNetworks.add(currentNetwork);
} else { } else {
if (VDBG) log(" accepting network in place of null"); if (VDBG) log(" accepting network in place of null");
@@ -4744,6 +4741,9 @@ public class ConnectivityService extends IConnectivityManager.Stub
if (isDefaultRequest(nri)) { if (isDefaultRequest(nri)) {
isNewDefault = true; isNewDefault = true;
oldDefaultNetwork = currentNetwork; oldDefaultNetwork = currentNetwork;
if (currentNetwork != null) {
mLingerMonitor.noteLingerDefaultNetwork(currentNetwork, newNetwork);
}
} }
} }
} else if (newNetwork.isSatisfyingRequest(nri.request.requestId)) { } else if (newNetwork.isSatisfyingRequest(nri.request.requestId)) {

View File

@@ -242,6 +242,12 @@ public class LingerMonitor {
return; return;
} }
// Only show the notification if we switched away because a network became unvalidated, not
// because its score changed.
// TODO: instead of just skipping notification, keep a note of it, and show it if it becomes
// unvalidated.
if (fromNai.lastValidated) return;
if (isNotificationEnabled(fromNai, toNai)) { if (isNotificationEnabled(fromNai, toNai)) {
notify(fromNai, toNai, forceToast); notify(fromNai, toNai, forceToast);
} }