[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
This commit is contained in:
@@ -6723,12 +6723,15 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
||||
// 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
|
||||
|
||||
Reference in New Issue
Block a user