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

am: a0a41b1e3d

Change-Id: I047a0040798223c163d333996e6bc06e206129a0
This commit is contained in:
Lorenzo Colitti
2016-08-30 11:02:33 +00:00
committed by android-build-merger
2 changed files with 9 additions and 3 deletions

View File

@@ -4699,9 +4699,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");
@@ -4722,6 +4719,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);
} }