Merge "[NS A11] Small refactor"

This commit is contained in:
Chalard Jean
2019-11-25 08:55:19 +00:00
committed by Gerrit Code Review

View File

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