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

Commit ad8cab38 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Show saved networks before scored networks."

parents f546dbf3 05c41e2c
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -222,21 +222,21 @@ public class AccessPoint implements Comparable<AccessPoint> {
        if (isActive() && !other.isActive()) return -1;
        if (!isActive() && other.isActive()) return 1;

        // Higher scores go before lower scores
        if (mRankingScore != other.mRankingScore) {
            return (mRankingScore > other.mRankingScore) ? -1 : 1;
        }

        // Reachable one goes before unreachable one.
        if (mRssi != Integer.MAX_VALUE && other.mRssi == Integer.MAX_VALUE) return -1;
        if (mRssi == Integer.MAX_VALUE && other.mRssi != Integer.MAX_VALUE) return 1;

        // Configured one goes before unconfigured one.
        // Configured (saved) one goes before unconfigured one.
        if (networkId != WifiConfiguration.INVALID_NETWORK_ID
                && other.networkId == WifiConfiguration.INVALID_NETWORK_ID) return -1;
        if (networkId == WifiConfiguration.INVALID_NETWORK_ID
                && other.networkId != WifiConfiguration.INVALID_NETWORK_ID) return 1;

        // Higher scores go before lower scores
        if (mRankingScore != other.mRankingScore) {
            return (mRankingScore > other.mRankingScore) ? -1 : 1;
        }

        // Sort by signal strength, bucketed by level
        int difference = WifiManager.calculateSignalLevel(other.mRssi, SIGNAL_LEVELS)
                - WifiManager.calculateSignalLevel(mRssi, SIGNAL_LEVELS);