Android7.0修改信号格等级显示

目前信号格最强为4格,每格对应着不同的dbm值的大小

如何修改每格对应的dbm值大小来解决显示问题

 

1.修改\vendor\mediatek\proprietary\frameworks\base\packages\FwkPlugin\src\com\mediatek\op\telephony\DefaultServiceStateExt.java

 

public int mapGsmSignalLevel(int asu, int gsmRscpQdbm) {
        int level;
        // for 3G network
        if (gsmRscpQdbm < 0) {
            // 3G network
            if (asu < 3 || asu == 99) {
                level = SignalStrength.SIGNAL_STRENGTH_NONE_OR_UNKNOWN;
            } else if (asu >= 11) {
                level = SignalStrength.SIGNAL_STRENGTH_GREAT;
            } else if (asu >= 9) {
                level = SignalStrength.SIGNAL_STRENGTH_GOOD;
            } else if (asu >= 6) {
                level = SignalStrength.SIGNAL_STRENGTH_MODERATE;
            } else {
                level = SignalStrength.SIGNAL_STRENGTH_POOR;
            }
        } else {
            // 2G network
            if (asu < 3 || asu == 99) {
                level = SignalStrength.SIGNAL_STRENGTH_NONE_OR_UNKNOWN;
            } else if (asu >= 11) {
                level = SignalStrength.SIGNAL_STRENGTH_GREAT;
            } else if (asu >= 9) {
                level = SignalStrength.SIGNAL_STRENGTH_GOOD;
            } else if (asu >= 6) {
                level = SignalStrength.SIGNAL_STRENGTH_MODERATE;
            } else {
                level = SignalStrength.SIGNAL_STRENGTH_POOR;
            }
        }
        return level;
    }

LTE:

if (mLteRsrp > -44) {
            rsrpIconLevel = -1;
        } else if (mLteRsrp >= -90) {
            rsrpIconLevel = SignalStrength.SIGNAL_STRENGTH_GREAT;
        } else if (mLteRsrp >= -96) {
            rsrpIconLevel = SignalStrength.SIGNAL_STRENGTH_GOOD;
        } else if (mLteRsrp >= -102) {
            rsrpIconLevel = SignalStrength.SIGNAL_STRENGTH_MODERATE;
        } else if (mLteRsrp >= -107) {
            rsrpIconLevel = SignalStrength.SIGNAL_STRENGTH_POOR;
        } else if (mLteRsrp < -107) {
            rsrpIconLevel = SignalStrength.SIGNAL_STRENGTH_NONE_OR_UNKNOWN;
        }

dbm与asu换算公式:

 

dBm = -113 + (2 * asu);
 

 


 

你可能感兴趣的:(MTK随记)