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

Commit 26693d46 authored by Chalard Jean's avatar Chalard Jean
Browse files

[NS B08] More simplification

Only computing the reassignment does not actually change the
default network.

Test: FrameworksNetTests
Change-Id: I21ddf5cc1e3d3817055dbda4246e38ceb0732407
parent 7738b847
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -6692,18 +6692,17 @@ public class ConnectivityService extends IConnectivityManager.Stub
    private void rematchAllNetworksAndRequests() {
        // TODO: This may be slow, and should be optimized.
        final long now = SystemClock.elapsedRealtime();
        final NetworkAgentInfo oldDefaultNetwork = getDefaultNetwork();
        final NetworkReassignment changes = computeNetworkReassignment();
        if (VDBG || DDBG) {
            log(changes.debugString());
        } else if (DBG) {
            log(changes.toString()); // Shorter form, only one line of log
        }
        applyNetworkReassignment(changes, oldDefaultNetwork, now);
        applyNetworkReassignment(changes, now);
    }

    private void applyNetworkReassignment(@NonNull final NetworkReassignment changes,
            @Nullable final NetworkAgentInfo oldDefaultNetwork, final long now) {
            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.
@@ -6713,6 +6712,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
                    event.mNewNetwork, now);
        }

        final NetworkAgentInfo oldDefaultNetwork = getDefaultNetwork();
        final NetworkRequestInfo defaultRequestInfo = mNetworkRequests.get(mDefaultRequest);
        final NetworkReassignment.RequestReassignment reassignment =
                changes.getReassignment(defaultRequestInfo);