Show saved networks before scored networks.
Changing ranking order to prioritize saved networks over scored networks. Bug: 34716123 Test: Turn on scoring and scoring UI features, ensure unscored saved network appears before unsaved scored network. Working on adding tests for AccessPoint.java separately. Change-Id: Ib53ade6c0e3756e2595ba6a73bf1a0fdc05e3074
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user