What is stock RSSI range for the WiFi indicator icon in notification bar?
1 Answer
I didn't look back through older versions, but here's information accurate as of Android 7.1.2.
The code that performs the transformation from RSSI to signal "level" is found in the WifiManager.calculateSignalLevel
method:
public static int calculateSignalLevel(int rssi, int numLevels) {
if (rssi <= MIN_RSSI) {
return 0;
} else if (rssi >= MAX_RSSI) {
return numLevels - 1;
} else {
float inputRange = (MAX_RSSI - MIN_RSSI);
float outputRange = (numLevels - 1);
return (int)((float)(rssi - MIN_RSSI) * outputRange / inputRange);
}
}
...where MIN_RSSI
is -100 and MAX_RSSI
is -55 (source). The input range is "dynamic" in the sense that its based off of how many resource files are available for the WiFi icon, but in AOSP this value will be 5 because it has icons for 0-4 bars. Using the above logic and values, the ranges come out to approximately:
- -55 or higher: 4 bars
- -56 to -66: 3 bars
- -67 to -77: 2 bars
- -78 to -88: 1 bar
- -89 or lower: 0 bars