[NS B02] Split out a function to apply a NetworkReassignment
This makes the rematchAllNetworksAndRequests function, which
is the nexus of the rematching code, very straightforward and
easy to read.
Bug: 113554781
Test: FrameworksNetTests
Change-Id: I5cea4ed7e06439494700d88ab202b696402fa360
diff --git a/services/core/java/com/android/server/ConnectivityService.java b/services/core/java/com/android/server/ConnectivityService.java
index 30419ae..ea6fe2b 100644
--- a/services/core/java/com/android/server/ConnectivityService.java
+++ b/services/core/java/com/android/server/ConnectivityService.java
@@ -6723,12 +6723,15 @@
// be optimized to only do the processing needed.
final long now = SystemClock.elapsedRealtime();
final NetworkAgentInfo oldDefaultNetwork = getDefaultNetwork();
-
final NetworkReassignment changes = computeNetworkReassignment();
+ applyNetworkReassignment(changes, oldDefaultNetwork, now);
+ }
- // Now that the entire rematch is computed, update the lists of satisfied requests in
- // the network agents. This is necessary because some code later depends on this state
- // to be correct, most prominently computing the linger status.
+ private void applyNetworkReassignment(@NonNull final NetworkReassignment changes,
+ @Nullable final NetworkAgentInfo oldDefaultNetwork, final long now) {
+ // First, update the lists of satisfied requests in the network agents. This is necessary
+ // because some code later depends on this state to be correct, most prominently computing
+ // the linger status.
for (final NetworkReassignment.RequestReassignment event :
changes.getRequestReassignments()) {
// The rematch is seeded with an entry for each request, and requests that don't