在修改显示的信号强度之前,先了解一下什么是dB,什么是dBm?
1.dB
dB是一个表征相对值的值,纯粹的比值,只表示两个量的相对大小关系,没有单位,当考虑甲的功率相比于乙功率大或小多少个dB时,
按下面的计算公式:10log(甲功率/乙功率),如果采用两者的电压比计算,要用20log(甲电压/乙电压)。)
[例] 甲功率比乙功率大一倍,那么10lg(甲功率/乙功率)=10lg2=3dB。也就是说,甲的功率比乙的功率大3 dB。
反之,如果甲的功率是乙的功率的一半,则甲的功率比乙的功率小3 dB。
2.dBm
dBm是一个表示功率绝对值的值(也可以认为是以1mW功率为基准的一个比值),计算公式为:10log(功率值/1mw)。
[例] 如果功率P为1mw,折算为dBm后为0dBm。
[例] 对于40W的功率,按dBm单位进行折算后的值应为:
10log(40W/1mw)=10log(40000)=10log4+10log10000=46dBm。
总之,dB是两个量之间的比值,表示两个量间的相对大小,而dBm则是表示功率绝对大小的值。在dB,dBm计算中,要注意基本概念,
用一个dBm减另外一个dBm时,得到的结果是dB,如:30dBm - 0dBm = 30dB。
3.手机信号强度表示
好了,那么手机上显示的数字的单位是那个呢,是dBm。当你仔细看的时候会发现这个值是负的,也就是说手机会显示比如 -67(dBm),那就说明信号很强了.
这里还说一个小知识:
中国移动的规范规定,手机接收电平>=(城市取-90dBm ;乡村取 -94dBm )时,则满足覆盖要求,也就是说此处无线信号强度满足覆盖要求。
-67dBm 要比-90dBm 信号要强20多个dB ,那么它在打电话接通成功率和通话过程中的话音质量都会好的多(当然也包括EDGE/GPRS上网的速度那些 )
所以,那个值越大信号就越好,因为那是个负值,而且在你手里的时候它永远是负值 ,如果你感
兴趣且附近有无线基站的天线的话,你也可以把你的手机尽量接近天线面板,那么值就越来越大,如果手机跟天线面板挨到一起,
那么它可能十分接近于0了(0是达不到的,这里的0的意思也不是说手机没信号了。)
在信号强度计选择工程模式,显示了很多参数,你只要看BCCHLev(控制信道电平值)它就是手机的信号强度值,单位dBm,多大的信号你的手机可以正常接听呢,BCCHLev-C1,C1也有显示数值,如:BCCHLev(-63) ,C1(34),表示你的手机在信号大于-97dBm的状况下是不会掉话的。
再来看手机发射功率要多大才合适呢,按GSM协议规定,手机发射功率是可以被基站控制的。基站通过下行SACCH信道,发出命令控制手机的发射功率级别,
每个功率级别差2dB;
GSM900 手机最大发射功率级别是5(2W=2000mw,33dBm),最小发射功率级别是19(3mw,5dBm),
DCS1800手机最大发射功率级别是0(1W,30dBm),最小发射功率级别是15(1mW,0dBm)。
当手机远离基站,或者处于无线阴影区时,基站可以命令手机发出较大功率,直至33dBm(GSM900),
以克服远距离传输或建筑物遮挡所造成的信号损耗。
强度计里的TXPower就是手机发射功率,你在拨打电话的状态下可以看出你的手机发射功率,也就是数值越大越省电,辐射越小,数值在5,
你的电话耗电大电池用不了一天,通话时别人经常听不到你的声音,你的手机经常会突然没信号,会掉话,这样你可以打投诉电话让运营商来做信号覆盖,
让你的手机信号好起来,减少辐射。
以上那么多字,只有一个核心意思。不要被你手机信号还有多少格欺骗!!!那都是手机厂商自己定义的。咱要玩专业点的,直接看信号强度dBm。
android系统查信号强度在设置—关于手机—网络里。
室内和室外的信号强度是有差距的。一般室外信号比室内好。
现在来看这个所谓的dBm,数值范围在-XX~0之间。这个数越大,信号强度越高。
-50dBm~0dBm范围内,恭喜你,你的信号已经好得很了。话说你就站在基站旁边是吧,哈
-90dBm~-60dBm,同样恭喜你,你基本不会面临打不了电话的问题。如果打不了的,找运营商吧,那是他们的问题。
G室内,DS放桌上信号强度-67dBm,23asu。作打电话状握手里,-75dBm,19asu。调整各种姿势,看到的最低是-83dBm,15asu。
这属于什么等级呢?简单说就是,信号很不错。室外没看,但肯定比这个高,
至于其他手机,可以自己上网去看,和DS的dBm值大多在一个档次。个别帖子炫耀自己大于-50dBm的,都是因为他就在基站边上。正常的范围是-90dBm~-60dBm。
====================================================================================
下面我们来看看手机没有修改时候的显示效果,关于手机-->状态信息-->SIM卡状态-->信号强度,就能看到手机的信号强度了。如下图所示:
1、当信号大于等于-85dBm时候,信号显示满格
2、当信号大于等于-95dBm时候,而小于-85dBm时,信号显示3格
3、当信号大于等于-105dBm时候,而小于-95dBm时,信号显示2格,不好捕捉到。
4、当信号大于等于-115dBm时候,而小于-105dBm时,信号显示1格,不好捕捉到。
5、当信号大于等于-140dBm时候,而小于-115dBm时,信号显示0格,不好捕捉到。
上面几个等级的相应划分的源代码在:rameworks/base/telephony/java/android/telephony/SignalStrength.java
中的getLteLevel()方法中,代码1如下:
/**
* Get LTE as level 0..4
*
* @hide
*/
public int getLteLevel() {
/*
* TS 36.214 Physical Layer Section 5.1.3 TS 36.331 RRC RSSI = received
* signal + noise RSRP = reference signal dBm RSRQ = quality of signal
* dB= Number of Resource blocksxRSRP/RSSI SNR = gain=signal/noise ratio
* = -10log P1/P2 dB
*/
int rssiIconLevel = SIGNAL_STRENGTH_NONE_OR_UNKNOWN;
int rsrpIconLevel = -1;
int snrIconLevel = -1;
int rsrpThreshType = Resources.getSystem().getInteger(com.android.internal.R.integer.
config_LTE_RSRP_threshold_type);
int[] threshRsrp;
if (rsrpThreshType == RSRP_THRESH_TYPE_STRICT) {
threshRsrp = RSRP_THRESH_STRICT;
} else {
threshRsrp = RSRP_THRESH_LENIENT;
}
//[ALPS01440836][ALPS01594704]-START: change level mapping rule of signal for CMCC
if (!IS_BSP_PACKAGE) {
IServiceStateExt ssExt = getPlugInInstance();
if (ssExt != null) {
rsrpIconLevel = ssExt.mapLteSignalLevel(mLteRsrp, mLteRssnr, mLteSignalStrength);
//added by ouyang
android.util.Log.e("oyp", "ssExt != null, rsrpIconLevel:"+ rsrpIconLevel);
return rsrpIconLevel;
} else {
log("[getLteLevel] null plug-in instance");
}
}
//modifed by ouyang [2015-10-12] start
// if (mLteRsrp > -44) {
// rsrpIconLevel = -1;
// } else if (mLteRsrp >= -85) {
// rsrpIconLevel = SIGNAL_STRENGTH_GREAT;
// } else if (mLteRsrp >= -95) {
// rsrpIconLevel = SIGNAL_STRENGTH_GOOD;
// } else if (mLteRsrp >= -105) {
// rsrpIconLevel = SIGNAL_STRENGTH_MODERATE;
// } else if (mLteRsrp >= -115) {
// rsrpIconLevel = SIGNAL_STRENGTH_POOR;
// } else if (mLteRsrp >= -140) {
// rsrpIconLevel = SIGNAL_STRENGTH_NONE_OR_UNKNOWN;
// }
if (mLteRsrp > -44) {
rsrpIconLevel = -1;
} else if (mLteRsrp >= -97) {
rsrpIconLevel = SIGNAL_STRENGTH_GREAT;
} else if (mLteRsrp >= -105) {
rsrpIconLevel = SIGNAL_STRENGTH_GOOD;
} else if (mLteRsrp >= -110) {
rsrpIconLevel = SIGNAL_STRENGTH_MODERATE;
} else if (mLteRsrp >= -120) {
rsrpIconLevel = SIGNAL_STRENGTH_POOR;
} else if (mLteRsrp >= -140) {
rsrpIconLevel = SIGNAL_STRENGTH_NONE_OR_UNKNOWN;
}
//modifed by ouyang [2015-10-12] end
//added by ouyang
android.util.Log.e("oyp", "getLTELevel - rsrp:" + mLteRsrp + " rsrpIconLevel:"
+ rsrpIconLevel);
/*
* Values are -200 dB to +300 (SNR*10dB) RS_SNR >= 13.0 dB =>4 bars 4.5
* dB <= RS_SNR < 13.0 dB => 3 bars 1.0 dB <= RS_SNR < 4.5 dB => 2 bars
* -3.0 dB <= RS_SNR < 1.0 dB 1 bar RS_SNR < -3.0 dB/No Service Antenna
* Icon Only
*/
if (mLteRssnr > 300) {
snrIconLevel = -1;
} else if (mLteRssnr >= 130) {
snrIconLevel = SIGNAL_STRENGTH_GREAT;
} else if (mLteRssnr >= 45) {
snrIconLevel = SIGNAL_STRENGTH_GOOD;
} else if (mLteRssnr >= 10) {
snrIconLevel = SIGNAL_STRENGTH_MODERATE;
} else if (mLteRssnr >= -30) {
snrIconLevel = SIGNAL_STRENGTH_POOR;
} else if (mLteRssnr >= -200) {
snrIconLevel = SIGNAL_STRENGTH_NONE_OR_UNKNOWN;
}
//added by ouyang
android.util.Log.e("oyp", "getLTELevel - snr:" + mLteRssnr + " snrIconLevel:" + snrIconLevel);
if (DBG) log("getLTELevel - rsrp:" + mLteRsrp + " snr:" + mLteRssnr + " rsrpIconLevel:"
+ rsrpIconLevel + " snrIconLevel:" + snrIconLevel);
/* Choose a measurement type to use for notification */
if (snrIconLevel != -1 && rsrpIconLevel != -1) {
/*
* The number of bars displayed shall be the smaller of the bars
* associated with LTE RSRP and the bars associated with the LTE
* RS_SNR
*/
//added by ouyang
android.util.Log.e("oyp", "snrIconLevel != -1 && rsrpIconLevel != -1,"
+"return rsrpIconLevel < snrIconLevel ? rsrpIconLevel : snrIconLevel"
+(rsrpIconLevel < snrIconLevel));
return (rsrpIconLevel < snrIconLevel ? rsrpIconLevel : snrIconLevel);
}
if (snrIconLevel != -1) {
//added by ouyang
android.util.Log.e("oyp", "snrIconLevel != -1");
return snrIconLevel;
}
if (rsrpIconLevel != -1) {
//added by ouyang
android.util.Log.e("oyp", "rsrpIconLevel != -1");
return rsrpIconLevel;
}
/* Valid values are (0-63, 99) as defined in TS 36.331 */
if (mLteSignalStrength > 63) {
rssiIconLevel = SIGNAL_STRENGTH_NONE_OR_UNKNOWN;
} else if (mLteSignalStrength >= 12) {
rssiIconLevel = SIGNAL_STRENGTH_GREAT;
} else if (mLteSignalStrength >= 8) {
rssiIconLevel = SIGNAL_STRENGTH_GOOD;
} else if (mLteSignalStrength >= 5) {
rssiIconLevel = SIGNAL_STRENGTH_MODERATE;
} else if (mLteSignalStrength >= 0) {
rssiIconLevel = SIGNAL_STRENGTH_POOR;
}
//added by ouyang
android.util.Log.e("oyp", "getLTELevel - rssi:" + mLteSignalStrength + " rssiIconLevel:"
+ rssiIconLevel);
if (DBG) {
log("getLTELevel - rssi:" + mLteSignalStrength + " rssiIconLevel:"
+ rssiIconLevel);
}
return rssiIconLevel;
//[ALPS01440836][ALPS01594704]-END: change level mapping rule of signal for CMCC
}
可以看到未修改前,划分的几个等级是:
1.大于-85时候,等级为SIGNAL_STRENGTH_GREAT,即为4
2.大于-95时候,等级为SIGNAL_STRENGTH_GOOD,即为3
3.大于-105时候,等级为SIGNAL_STRENGTH_MODERATE,即为2
4.大于-115时候,等级为SIGNAL_STRENGTH_POOR,即为1
5.大于-140时候,等级为SIGNAL_STRENGTH_NONE_OR_UNKNOWN,即为0
6.大于-44时候,等级为-1
修改后,将上面的几个等级划分改为:
1.大于-97时候,等级为SIGNAL_STRENGTH_GREAT,即为4
2.大于-105时候,等级为SIGNAL_STRENGTH_GOOD,即为3
3.大于-110时候,等级为SIGNAL_STRENGTH_MODERATE,即为2
4.大于-120时候,等级为SIGNAL_STRENGTH_POOR,即为1
5.大于-140时候,等级为SIGNAL_STRENGTH_NONE_OR_UNKNOWN,即为0
6.大于-44时候,等级为-1
由于上面的,加入了MTK的修复patch,代码2如下:
//[ALPS01440836][ALPS01594704]-START: change level mapping rule of signal for CMCC
if (!IS_BSP_PACKAGE) {
IServiceStateExt ssExt = getPlugInInstance();
if (ssExt != null) {
rsrpIconLevel = ssExt.mapLteSignalLevel(mLteRsrp, mLteRssnr, mLteSignalStrength);
//added by ouyang
android.util.Log.e("oyp", "ssExt != null, rsrpIconLevel:"+ rsrpIconLevel);
return rsrpIconLevel;
} else {
log("[getLteLevel] null plug-in instance");
}
}
上面代码的意思是,先把这等级划分的值从加入的插件中去获取,如果获取不到再执行我上面修改的,所以要去修改
IServiceStateExt的mapLteSignalLevel(mLteRsrp, mLteRssnr, mLteSignalStrength)方法。当然如果没有这个插件的话,可以直接把我上面的这段代码2从代码1中注释即可。
由于IServiceStateExt是个接口,所以去修改它的具体实现类。通过查找源代码,找到了实现类DefaultServiceStateExt。
该类目录位于:vendor/mediatek/proprietary/frameworks/base/packages/FwkPlugin/src/com/mediatek/op/telephony/DefaultServiceStateExt.java
修改后代码如下:
//[ALPS01440836][ALPS01594704]-START: change level mapping rule of signal for CMCC
public int mapLteSignalLevel(int mLteRsrp, int mLteRssnr, int mLteSignalStrength) {
//added by ouyang
android.util.Log.e("mapLteSignalLevel", "mapLteSignalLevel starting .......");
/*
* TS 36.214 Physical Layer Section 5.1.3 TS 36.331 RRC RSSI = received
* signal + noise RSRP = reference signal dBm RSRQ = quality of signal
* dB= Number of Resource blocksxRSRP/RSSI SNR = gain=signal/noise ratio
* = -10log P1/P2 dB
*/
int rssiIconLevel = SignalStrength.SIGNAL_STRENGTH_NONE_OR_UNKNOWN;
int rsrpIconLevel = -1;
int snrIconLevel = -1;
//modifed by ouyang [2015-10-14] start
// if (mLteRsrp > -44) {
// rsrpIconLevel = -1;
// } else if (mLteRsrp >= -85) {
// rsrpIconLevel = SignalStrength.SIGNAL_STRENGTH_GREAT;
// } else if (mLteRsrp >= -95) {
// rsrpIconLevel = SignalStrength.SIGNAL_STRENGTH_GOOD;
// } else if (mLteRsrp >= -105) {
// rsrpIconLevel = SignalStrength.SIGNAL_STRENGTH_MODERATE;
// } else if (mLteRsrp >= -115) {
// rsrpIconLevel = SignalStrength.SIGNAL_STRENGTH_POOR;
// } else if (mLteRsrp >= -140) {
// rsrpIconLevel = SignalStrength.SIGNAL_STRENGTH_NONE_OR_UNKNOWN;
// }
if (mLteRsrp > -44) {
rsrpIconLevel = -1;
} else if (mLteRsrp >= -97) {
rsrpIconLevel = SignalStrength.SIGNAL_STRENGTH_GREAT;
} else if (mLteRsrp >= -105) {
rsrpIconLevel = SignalStrength.SIGNAL_STRENGTH_GOOD;
} else if (mLteRsrp >= -110) {
rsrpIconLevel = SignalStrength.SIGNAL_STRENGTH_MODERATE;
} else if (mLteRsrp >= -120) {
rsrpIconLevel = SignalStrength.SIGNAL_STRENGTH_POOR;
} else if (mLteRsrp >= -140) {
rsrpIconLevel = SignalStrength.SIGNAL_STRENGTH_NONE_OR_UNKNOWN;
}
//added by ouyang
android.util.Log.e("mapLteSignalLevel", "getLTELevel - rsrp:" + mLteRsrp + " rsrpIconLevel:"+ rsrpIconLevel);
//modifed by ouyang [2015-10-14] end
/*
* Values are -200 dB to +300 (SNR*10dB) RS_SNR >= 13.0 dB =>4 bars 4.5
* dB <= RS_SNR < 13.0 dB => 3 bars 1.0 dB <= RS_SNR < 4.5 dB => 2 bars
* -3.0 dB <= RS_SNR < 1.0 dB 1 bar RS_SNR < -3.0 dB/No Service Antenna
* Icon Only
*/
if (mLteRssnr > 300) {
snrIconLevel = -1;
} else if (mLteRssnr >= 130) {
snrIconLevel = SignalStrength.SIGNAL_STRENGTH_GREAT;
} else if (mLteRssnr >= 45) {
snrIconLevel = SignalStrength.SIGNAL_STRENGTH_GOOD;
} else if (mLteRssnr >= 10) {
snrIconLevel = SignalStrength.SIGNAL_STRENGTH_MODERATE;
} else if (mLteRssnr >= -30) {
snrIconLevel = SignalStrength.SIGNAL_STRENGTH_POOR;
} else if (mLteRssnr >= -200) {
snrIconLevel = SignalStrength.SIGNAL_STRENGTH_NONE_OR_UNKNOWN;
}
//added by ouyang
android.util.Log.e("mapLteSignalLevel", "getLTELevel - snr:" + mLteRssnr + " snrIconLevel:" + snrIconLevel);
Log.i(TAG, "getLTELevel - rsrp:" + mLteRsrp + " snr:" + mLteRssnr + " rsrpIconLevel:"
+ rsrpIconLevel + " snrIconLevel:" + snrIconLevel);
/* Choose a measurement type to use for notification */
if (snrIconLevel != -1 && rsrpIconLevel != -1) {
/*
* The number of bars displayed shall be the smaller of the bars
* associated with LTE RSRP and the bars associated with the LTE
* RS_SNR
*/
//added by ouyang
android.util.Log.e("mapLteSignalLevel", "snrIconLevel != -1 && rsrpIconLevel != -1,"
+"return rsrpIconLevel < snrIconLevel ? rsrpIconLevel : snrIconLevel"
+(rsrpIconLevel < snrIconLevel));
return (rsrpIconLevel < snrIconLevel ? rsrpIconLevel : snrIconLevel);
}
if (snrIconLevel != -1) {
//added by ouyang
android.util.Log.e("mapLteSignalLevel", "snrIconLevel != -1");
return snrIconLevel;
}
if (rsrpIconLevel != -1) {
//added by ouyang
android.util.Log.e("mapLteSignalLevel", "rsrpIconLevel != -1");
return rsrpIconLevel;
}
/* Valid values are (0-63, 99) as defined in TS 36.331 */
if (mLteSignalStrength > 63) {
rssiIconLevel = SignalStrength.SIGNAL_STRENGTH_NONE_OR_UNKNOWN;
} else if (mLteSignalStrength >= 12) {
rssiIconLevel = SignalStrength.SIGNAL_STRENGTH_GREAT;
} else if (mLteSignalStrength >= 8) {
rssiIconLevel = SignalStrength.SIGNAL_STRENGTH_GOOD;
} else if (mLteSignalStrength >= 5) {
rssiIconLevel = SignalStrength.SIGNAL_STRENGTH_MODERATE;
} else if (mLteSignalStrength >= 0) {
rssiIconLevel = SignalStrength.SIGNAL_STRENGTH_POOR;
}
//added by ouyang
android.util.Log.e("mapLteSignalLevel", "getLTELevel - rssi:" + mLteSignalStrength + " rssiIconLevel:"
+ rssiIconLevel);
Log.i(TAG, "getLTELevel - rssi:" + mLteSignalStrength + " rssiIconLevel:"
+ rssiIconLevel);
return rssiIconLevel;
}
//[ALPS01440836][ALPS01594704]-END: change level mapping rule of signal for CMCC
修改完代码后,make systemimage后烧录到MTK平台手机即可。
====================================================================================
修改后的效果图如下所示:
1、当信号大于等于-97dBm时候,信号显示满格,而修改之前需要大于-85dBm。
2、当信号大于等于-105dBm时候,而小于-97dBm时,信号显示少一个,而修改之前需要大于-95dBm。
3、当信号大于等于-110dBm时候,而小于-105dBm时,信号显示2格,不好捕捉到。
4、当信号大于等于-120dBm时候,而小于-110dBm时,信号显示1格,不好捕捉到。
5、当信号大于等于-140dBm时候,而小于-120dBm时,信号显示0格,不好捕捉到。
====================================================================================
当然,要修改电信、移动、联通的3G、2G信号也可以在这个类中去修改。
最后附上源代码 \frameworks\base\telephony\java\android\telephony\SignalStrength.java
====================================================================================
vendor/mediatek/proprietary/frameworks/base/packages/FwkPlugin/src/com/mediatek/op/telephony/DefaultServiceStateExt.java代码如下:
====================================================================================
作者:欧阳鹏 欢迎转载,与人分享是进步的源泉!
转载请保留原文地址:http://blog.csdn.net/ouyang_peng
====================================================================================