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

Commit ce454807 authored by Chalard Jean's avatar Chalard Jean
Browse files

[NS A35] Send updated scores to factories at the end.

Test: ConnectivityServiceTests
Change-Id: I66c4e8f52e11bc7e199dd8c12d43b0b136a21f19
parent 13bab234
Loading
Loading
Loading
Loading
+11 −7
Original line number Diff line number Diff line
@@ -6199,11 +6199,14 @@ public class ConnectivityService extends IConnectivityManager.Stub

    private void sendUpdatedScoreToFactories(@NonNull NetworkRequest networkRequest,
            @Nullable NetworkAgentInfo nai) {
        int score = 0;
        int serial = 0;
        final int score;
        final int serial;
        if (nai != null) {
            score = nai.getCurrentScore();
            serial = nai.factorySerialNumber;
        } else {
            score = 0;
            serial = 0;
        }
        if (VDBG || DDBG){
            log("sending new Min Network Score(" + score + "): " + networkRequest.toString());
@@ -6590,11 +6593,6 @@ public class ConnectivityService extends IConnectivityManager.Stub
                newNetwork.removeRequest(nri.request.requestId);
            }
            nri.mSatisfier = newSatisfier;
            // Tell NetworkProviders about the new score, so they can stop
            // trying to connect if they know they cannot match it.
            // TODO - this could get expensive if there are a lot of outstanding requests for this
            // network. Think of a way to reduce this. Push netid->request mapping to each factory?
            sendUpdatedScoreToFactories(nri.request, newSatisfier);
        }
    }

@@ -6646,6 +6644,12 @@ public class ConnectivityService extends IConnectivityManager.Stub
        // before LegacyTypeTracker sends legacy broadcasts
        for (final NetworkReassignment.RequestReassignment event :
                changes.getRequestReassignments()) {
            // Tell NetworkProviders about the new score, so they can stop
            // trying to connect if they know they cannot match it.
            // TODO - this could get expensive if there are a lot of outstanding requests for this
            // network. Think of a way to reduce this. Push netid->request mapping to each factory?
            sendUpdatedScoreToFactories(event.mRequest.request, event.mNewNetwork);

            if (null != event.mNewNetwork) {
                notifyNetworkAvailable(event.mNewNetwork, event.mRequest);
            } else {