Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8bab483c authored by Chalard Jean's avatar Chalard Jean
Browse files

[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
parent 14c2d1da
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
@@ -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