基于MTK 6.0系统
源码文件 frameworks/base/wifi/java/android/net/wifi/WifiManager.java;
/**
* Calculates the level of the signal. This should be used any time a signal
* is being shown.
* @param rssi The power of the signal measured in RSSI.
* @param numLevels The number of levels to consider in the calculated
* level.
* @return A level of the signal, given in the range of 0 to numLevels-1
* (both inclusive).
*/
public static int calculateSignalLevel(int rssi, int numLevels) {
rssi = rssi + 8; // add by wxd
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);
}
}
上述方法就是计算wifi信号强度等级的函数,MAX_RSSI和MIN_RSSI分别为最强和最弱信号强度等级的信号强度阀值,分别为-55和-100,至于信号强度等级系统默认是这样的
/**
* Number of RSSI levels used in the framework to initiate
* {@link #RSSI_CHANGED_ACTION} broadcast
* @hide
*/
public static final int RSSI_LEVELS = 5;
如果想修改wifi的信号强度的显示,把rssi数值加大就好了。