diff options
author | Michael Plass <mplass@google.com> | 2017-06-14 01:05:02 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2017-06-14 01:05:03 +0000 |
commit | f932bcf61f7dfc559d0287c438b8cedea8bd9092 (patch) | |
tree | a68f9a2d391bbf0d5b43520f2261ebdb4f33e7b2 /service | |
parent | 613bc28a67c43005f61a617611c6d228a7d25ba5 (diff) | |
parent | e802d02eb96d3cbe774110c432f957976deb92b3 (diff) |
Merge "[WifiScoreReport] Simplifed scorer/quick handover" into oc-dr1-dev
Diffstat (limited to 'service')
-rw-r--r-- | service/java/com/android/server/wifi/WifiScoreReport.java | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/service/java/com/android/server/wifi/WifiScoreReport.java b/service/java/com/android/server/wifi/WifiScoreReport.java index 8bc8bf37a..74ddf99ec 100644 --- a/service/java/com/android/server/wifi/WifiScoreReport.java +++ b/service/java/com/android/server/wifi/WifiScoreReport.java @@ -148,8 +148,13 @@ public class WifiScoreReport { int aggressiveHandover, WifiMetrics wifiMetrics) { int score; - updateScoringState(wifiInfo, aggressiveHandover); - score = calculateScore(wifiInfo, aggressiveHandover); + if (aggressiveHandover == 0) { + // Use the old method + updateScoringState(wifiInfo, aggressiveHandover); + score = calculateScore(wifiInfo, aggressiveHandover); + } else { + score = calculateAlternativeScore(wifiInfo); + } //sanitize boundaries if (score > NetworkAgent.WIFI_BASE_SCORE) { @@ -320,4 +325,17 @@ public class WifiScoreReport { } return false; } + + /** + * Experimental scorer, used when aggressive handover preference is set + */ + private int calculateAlternativeScore(WifiInfo wifiInfo) { + double rssi = wifiInfo.getRssi(); + double badRssi = wifiInfo.is5GHz() ? mThresholdQualifiedRssi5 : mThresholdQualifiedRssi24; + + double baseScore = 50.0; // The score to beat to be chosen over mobile data + double score = (rssi - badRssi) + baseScore; + return (int) Math.round(score); + } + } |