[NS A11] Small refactor

Test: ConnectivityServiceTest
Change-Id: I9c4247e0ed67c76d10575bd1a8fb5ff7780a1206
This commit is contained in:
Chalard Jean
2019-11-07 19:16:09 +09:00
parent 0a8afdae5d
commit f5ff770f70

View File

@@ -6350,7 +6350,6 @@ public class ConnectivityService extends IConnectivityManager.Stub
private void rematchNetworkAndRequests(NetworkAgentInfo newNetwork, long now) {
ensureRunningOnConnectivityServiceThread();
if (!newNetwork.everConnected) return;
boolean keep = newNetwork.isVPN();
boolean isNewDefault = false;
NetworkAgentInfo oldDefaultNetwork = null;
@@ -6392,7 +6391,6 @@ public class ConnectivityService extends IConnectivityManager.Stub
Slog.wtf(TAG, "BUG: " + newSatisfier.name() + " already has " + nri.request);
}
addedRequests.add(nri);
keep = true;
// Tell NetworkFactories about the new score, so they can stop
// trying to connect if they know they cannot match it.
// TODO - this could get expensive if we have a lot of requests for this
@@ -6499,7 +6497,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
notifyLockdownVpn(newNetwork);
}
if (keep) {
if (reassignedRequests.containsValue(newNetwork) || newNetwork.isVPN()) {
// Notify battery stats service about this network, both the normal
// interface and any stacked links.
// TODO: Avoid redoing this; this must only be done once when a network comes online.