diff options
author | Quang Luong <qal@google.com> | 2020-05-06 11:11:11 -0700 |
---|---|---|
committer | Quang Luong <qal@google.com> | 2020-05-06 11:17:51 -0700 |
commit | 903adb307231d9be59e898c7255d688e343ec3af (patch) | |
tree | 88991b2fb400a953e5896792c01812eed5be9c32 /libs | |
parent | 4d68b0507ef4bede9fd8af1a93f0637e78b5fe6c (diff) |
[WifiTrackerLib] Return SPEED_NONE if ScoredNetwork has no speed info
The speed value of a ScoredNetwork should be interpreted as SPEED_NONE
if the value is 0, instead of being bucketed into SPEED_SLOW.
Bug: 155846675
Test: build
Change-Id: I6e234f6888c2283f90cf8b7aa8debe6325292505
Diffstat (limited to 'libs')
-rw-r--r-- | libs/WifiTrackerLib/src/com/android/wifitrackerlib/Utils.java | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/libs/WifiTrackerLib/src/com/android/wifitrackerlib/Utils.java b/libs/WifiTrackerLib/src/com/android/wifitrackerlib/Utils.java index 78617ba5a..934cdf146 100644 --- a/libs/WifiTrackerLib/src/com/android/wifitrackerlib/Utils.java +++ b/libs/WifiTrackerLib/src/com/android/wifitrackerlib/Utils.java @@ -347,7 +347,9 @@ class Utils { @Speed private static int roundToClosestSpeedEnum(int speed) { - if (speed < (SPEED_SLOW + SPEED_MODERATE) / 2) { + if (speed == SPEED_NONE) { + return SPEED_NONE; + } else if (speed < (SPEED_SLOW + SPEED_MODERATE) / 2) { return SPEED_SLOW; } else if (speed < (SPEED_MODERATE + SPEED_FAST) / 2) { return SPEED_MODERATE; |