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

Commit 8c9e975c authored by Robert Greenwalt's avatar Robert Greenwalt Committed by Android (Google) Code Review
Browse files

Merge "Don't accept score below 0." into lmp-dev

parents 3d13b16a 35f7a94c
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -223,6 +223,9 @@ public abstract class NetworkAgent extends Handler {
     * Called by the bearer code when it has a new score for this network.
     */
    public void sendNetworkScore(int score) {
        if (score < 0) {
            throw new IllegalArgumentException("Score must be >= 0");
        }
        queueOrSendMessage(EVENT_NETWORK_SCORE_CHANGED, new Integer(score));
    }

+5 −0
Original line number Diff line number Diff line
@@ -4746,6 +4746,11 @@ public class ConnectivityService extends IConnectivityManager.Stub {

    private void updateNetworkScore(NetworkAgentInfo nai, int score) {
        if (DBG) log("updateNetworkScore for " + nai.name() + " to " + score);
        if (score < 0) {
            loge("updateNetworkScore for " + nai.name() + " got a negative score (" + score +
                    ").  Bumping score to min of 0");
            score = 0;
        }

        nai.currentScore = score;