summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSunil Ravi <sunilravi@google.com>2020-01-09 12:07:15 -0800
committerSunil Ravi <sunilravi@google.com>2020-01-10 21:51:02 +0000
commit4f32f5d2a87c067eb6d38ed92d8b2dc082e489d8 (patch)
tree29b41507a248d95e8da672fcd3e2da54b407adc5
parentc20aac99b6d0e7361fcbfed2bd859bd1368f54c8 (diff)
Adjust positive RSSI only for some implementation.
Wifi chip can report positive rssi when STA and AP are very close(close to zero distance apart). There are some driver implementations where they avoid large negative rssi reporting by adding with 256. Adjust the RSSI only for such implementations. Bug: 146811944 Test: Placed STA and AP close to each other and confirmed that all signal bars are shown indicating strong rssi. Change-Id: Iab9af736782b2b61692bdf5795b54a28da28bfd0
-rw-r--r--service/java/com/android/server/wifi/ClientModeImpl.java10
1 files changed, 6 insertions, 4 deletions
diff --git a/service/java/com/android/server/wifi/ClientModeImpl.java b/service/java/com/android/server/wifi/ClientModeImpl.java
index 7da4b6fd1..08afc04bf 100644
--- a/service/java/com/android/server/wifi/ClientModeImpl.java
+++ b/service/java/com/android/server/wifi/ClientModeImpl.java
@@ -2277,11 +2277,13 @@ public class ClientModeImpl extends StateMachine {
}
if (newRssi > WifiInfo.INVALID_RSSI && newRssi < WifiInfo.MAX_RSSI) {
- // screen out invalid values
- /* some implementations avoid negative values by adding 256
- * so we need to adjust for that here.
+ /*
+ * Positive RSSI is possible when devices are close(~0m apart) to each other.
+ * And there are some driver/firmware implementation, where they avoid
+ * reporting large negative rssi values by adding 256.
+ * so adjust the valid rssi reports for such implementations.
*/
- if (newRssi > 0) {
+ if (newRssi > (WifiInfo.INVALID_RSSI + 256)) {
Log.wtf(TAG, "Error! +ve value RSSI: " + newRssi);
newRssi -= 256;
}