diff options
author | 2019-12-14 03:34:35 +0000 | |
---|---|---|
committer | 2019-12-14 03:35:07 +0000 | |
commit | 884ab0e19515180b90a3eed5863b83507eb426e5 (patch) | |
tree | 6801041879778e426944244bbde71a020cdd932f | |
parent | 9bea6e4d36cfe1ae38cf1b596573a0443e47edae (diff) |
Revert "[NS A24] Add an object to represent changes in assignment"
This reverts commit 5c18198aae4f2aba47c0d16de7960f1a4da26f61.
Reason for revert: Toggling wifi on/off causes networking to
stop working with these four patches applied.
Bug: 146230156
Change-Id: Ie0217796c89abf0dc86e6a4f8324811155dc57cd
-rw-r--r-- | services/core/java/com/android/server/ConnectivityService.java | 37 |
1 files changed, 4 insertions, 33 deletions
diff --git a/services/core/java/com/android/server/ConnectivityService.java b/services/core/java/com/android/server/ConnectivityService.java index c6f06f1a9e7d..f8f685d939a7 100644 --- a/services/core/java/com/android/server/ConnectivityService.java +++ b/services/core/java/com/android/server/ConnectivityService.java @@ -6296,26 +6296,6 @@ public class ConnectivityService extends IConnectivityManager.Stub } } - // An accumulator class to gather the list of changes that result from a rematch. - // TODO : enrich to represent an entire set of changes to apply. - private static class NetworkReassignment { - static class NetworkBgStatePair { - @NonNull final NetworkAgentInfo mNetwork; - final boolean mOldBackground; - NetworkBgStatePair(@NonNull final NetworkAgentInfo network, - final boolean oldBackground) { - mNetwork = network; - mOldBackground = oldBackground; - } - } - - @NonNull private final Set<NetworkBgStatePair> mRematchedNetworks = new ArraySet<>(); - - void addRematchedNetwork(@NonNull final NetworkBgStatePair network) { - mRematchedNetworks.add(network); - } - } - private ArrayMap<NetworkRequestInfo, NetworkAgentInfo> computeRequestReassignmentForNetwork( @NonNull final NetworkAgentInfo newNetwork) { final int score = newNetwork.getCurrentScore(); @@ -6361,8 +6341,8 @@ public class ConnectivityService extends IConnectivityManager.Stub // needed. A network is needed if it is the best network for // one or more NetworkRequests, or if it is a VPN. // - // - Writes into the passed reassignment object all changes that should be done for - // rematching this network with all requests, to be applied later. + // - Tears down newNetwork if it just became validated + // but turns out to be unneeded. // // NOTE: This function only adds NetworkRequests that "newNetwork" could satisfy, // it does not remove NetworkRequests that other Networks could better satisfy. @@ -6370,23 +6350,15 @@ public class ConnectivityService extends IConnectivityManager.Stub // This function should be used when possible instead of {@code rematchAllNetworksAndRequests} // as it performs better by a factor of the number of Networks. // - // TODO : stop writing to the passed reassignment. This is temporarily more useful, but - // it's unidiomatic Java and it's hard to read. - // - // @param changes a currently-building list of changes to write to // @param newNetwork is the network to be matched against NetworkRequests. // @param now the time the rematch starts, as returned by SystemClock.elapsedRealtime(); - private void rematchNetworkAndRequests(@NonNull final NetworkReassignment changes, - @NonNull final NetworkAgentInfo newNetwork, final long now) { + private void rematchNetworkAndRequests(NetworkAgentInfo newNetwork, long now) { ensureRunningOnConnectivityServiceThread(); if (!newNetwork.everConnected) return; boolean isNewDefault = false; NetworkAgentInfo oldDefaultNetwork = null; final boolean wasBackgroundNetwork = newNetwork.isBackgroundNetwork(); - changes.addRematchedNetwork(new NetworkReassignment.NetworkBgStatePair(newNetwork, - wasBackgroundNetwork)); - final int score = newNetwork.getCurrentScore(); if (VDBG || DDBG) log("rematching " + newNetwork.name()); @@ -6543,9 +6515,8 @@ public class ConnectivityService extends IConnectivityManager.Stub // scoring network and then a higher scoring network, which could produce multiple // callbacks. Arrays.sort(nais); - final NetworkReassignment changes = new NetworkReassignment(); for (final NetworkAgentInfo nai : nais) { - rematchNetworkAndRequests(changes, nai, now); + rematchNetworkAndRequests(nai, now); } final NetworkAgentInfo newDefaultNetwork = getDefaultNetwork(); |