Android system transplantation and debugging -------) how to modify the number of 4G signal strength grids displayed on Android phones

Source: Internet
Author: User

Android system transplantation and debugging -------) how to modify the number of 4G signal strength grids displayed on Android phones

Before modifying the displayed signal strength, let's take a look at what is dB and what is dBm?

1. dB
DB is a value that represents relative values. A pure ratio represents only the relative size relationship between two quantities, with no unit, when considering the number of dB whose power is larger or smaller than that of B,

The formula below is as follows: 10log (a power/B power). If the ratio of the two is used, 20log (a voltage/B voltage) is used ).)
[Example] If the power of a is twice the power of B, then 10lg (the power of a/B) = 10lg2 = dB. That is to say, the power of a is 3 dB higher than that of B.

If the power of a is half the power of B, the power of a is 3 dB lower than that of B.


2. dBm
DBm is a value indicating the absolute power value (or a ratio of 1 mw power as the benchmark). The formula is: 10log (power value/1 mw ).

[Example] if the power P is 1 mw, it is converted to dBm and then 0 dBm.
[Example] For 40 W power, the converted value in dBm unit should be:
10log (40 W/1 mw) = 10log (40000) = 10log4 + 10log10000 = 46dBm.
In short, dB is the ratio between two quantities, indicating the relative size between two quantities, while dBm indicates the absolute power size value. In dB and dBm computing, pay attention to the basic concepts,

When one dBm is used to subtract another dBm, the result is dB, for example, 30dBm-0dBm = 30dB.

3. Cell phone signal strength Representation

Well, the unit of the number displayed on the mobile phone is dBm. When you look at it carefully, you will find that the value is negative. That is to say, the phone will display-67 (dBm), which indicates that the signal is very strong.

Here is a small knowledge:

China Mobile's specifications stipulate that when the mobile phone reception level is greater than or equal to (city-90dBm; Country-94dBm), the coverage requirements are met, that is, the wireless signal strength here meets the coverage requirements.

-67dBm is more than 20 DBS better than-90dBm signal, so it will have a better voice quality in the call success rate and call process (of course, EDGE/GPRS internet access speed)

Therefore, the larger the value, the better the signal, because it is a negative value, and it is always a negative value in your hands, if you feel

If you are interested in antennas with wireless base stations nearby, you can try to bring your mobile phone as close as possible to the antenna panel, so the value will grow bigger and bigger,

Then it may be very close to 0 (0 cannot be reached, and here 0 does not mean that the phone has no signal .)


When selecting the engineering mode in the signal strength meter, a lot of parameters are displayed. You only need to check that bcchev (control channel level value) is the signal strength value of the mobile phone, in dBm, how big the signal your phone can normally answer it, BCCHLev-C1, C1 also has a display value, such as: bcchlev(-63), C1 (34 ), it indicates that your phone will not quit when the signal is greater than-97dBm.
  

Next, we can see how much transmission power a mobile phone needs. According to the GSM protocol, the transmission power of mobile phones can be controlled by base stations. The base station uses the downstream SACCH channel to issue commands to control the transmit power level of the mobile phone,

2 dB for each power level;

The maximum transmit power level of the GSM 2000 mobile phone is 5 (2 W = mw, 33dBm), and the minimum transmit power level is 19 (3 mw, 5dBm ),

The maximum transmit power level of the DCS1800 mobile phone is 0 (1 W, 30dBm), and the minimum transmit power level is 15 (1 mW, 0dBm ).

When the mobile phone is far away from the base station or in the wireless shadow area, the base station can command the mobile phone to send a large power until 33dBm (GSM900 ),

To overcome the signal loss caused by long-distance transmission or building occlusion.


The TXPower in the intensity meter is the transmit power of the mobile phone. When you call the phone, you can see the transmit power of your mobile phone. That is, the larger the value, the more power-saving the radiation, the smaller the radiation, and the value at 5,

Your phone consumes a lot of power and the battery will not work for a day. When you call a phone, others will often fail to hear your voice. Your phone will often lose the signal, in this way, you can call a complaint to allow the carrier to perform signal coverage,

Make your mobile phone signal better and reduce radiation.

The above words have only one core meaning. Don't be fooled by your phone signal !!! It is defined by mobile phone manufacturers. To be professional, you can view the signal strength dBm directly.
The android system checks the signal strength in settings-about mobile phone-network.
  

There is a gap between indoor and outdoor signal strength. Generally, the outdoor signal is better than the indoor signal.
Now let's look at the so-called dBm. The value range is-XX ~ Between 0. The larger the number, the higher the signal strength.


-50dBm ~ Within the 0dBm range, congratulations! Your signal is very good. You can stand next to the base station, right?
-90dBm ~ -60dBm. Congratulations, you will not be able to make a phone call. If you cannot, contact the carrier. That's their problem.

In the G room, the signal strength of the DS table is-67dBm and 23asu. In the phone handshake,-75dBm, 19asu. Adjust the positions to see at least-83dBm and 15asu.

What level does this belong? In short, the signal is very good. I didn't watch it outside, but it must be higher than this one,
For other mobile phones, you can visit the Internet by yourself. Most of the dBm values of DS are in the same grade. Some posts show off that they are larger than-50dBm because they are on the edge of the base station. The normal range is-90dBm ~ -60dBm.

 

========================================================== ========================================================== ====

Next let's take a look at the display effect when the phone is not modified. About the phone --> status information --> SIM card status --> signal strength, we can see the signal strength of the phone. As shown in:

1. When the signal is greater than or equal to-85dBm, the signal is displayed full

2. When the signal is greater than or equal to-95dBm and smaller than-85dBm, the signal is displayed in 3 grids.

3. When the signal is greater than or equal to-105dBm, but less than-95dBm, the signal is displayed in 2 cells, which is hard to be captured.

4. When the signal is greater than or equal to-115dBm and less than-105dBm, the signal is displayed in 1 cell, which is hard to be captured.

5. When the signal is greater than or equal to-140dBm and less than-115dBm, the signal is displayed in 0 cells, which is hard to be captured.

 

The source code for the corresponding classification of the above levels is: rameworks/base/telephony/java/android/telephony/SignalStrength. java

In the getLteLevel () method, code 1 is as follows:

  /**     * 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 ouyangandroid.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 ouyangandroid.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 ouyangandroid.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 ouyangandroid.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 ouyangandroid.util.Log.e(oyp, snrIconLevel != -1);            return snrIconLevel;        }        if (rsrpIconLevel != -1) {//added by ouyangandroid.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 ouyangandroid.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    }


We can see that the following levels are divided before modification:

1. When the value is greater than-85, the level is SIGNAL_STRENGTH_GREAT, that is, 4.

2. When the value is greater than-95, the level is SIGNAL_STRENGTH_GOOD, that is, 3.

3. When the value is greater than-105, the level is SIGNAL_STRENGTH_MODERATE, that is, 2.

4. When the value is greater than-115, the level is SIGNAL_STRENGTH_POOR, that is, 1.

5. When the value is greater than-140, the level is SIGNAL_STRENGTH_NONE_OR_UNKNOWN, that is, 0.

6. When the value is greater than-44, the level is-1.

After modification, change the previous levels:

1. When the value is greater than-97, the level is SIGNAL_STRENGTH_GREAT, that is, 4

2. When the value is greater than-105, the level is SIGNAL_STRENGTH_GOOD, that is, 3.

3. When the value is greater than-110, the level is SIGNAL_STRENGTH_MODERATE, that is, 2.

4. When the value is greater than-120, the level is SIGNAL_STRENGTH_POOR, that is, 1.

5. When the value is greater than-140, the level is SIGNAL_STRENGTH_NONE_OR_UNKNOWN, that is, 0.

6. When the value is greater than-44, the level is-1.

 

Because of the above, the MTK repair patch is added, code 2 is as follows:

//[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 ouyangandroid.util.Log.e(oyp, ssExt != null, rsrpIconLevel:+ rsrpIconLevel);                return rsrpIconLevel;            } else {                log([getLteLevel] null plug-in instance);            }        }

The code above indicates that the value of this level is obtained from the added plug-in first. If the value cannot be obtained, execute the modified value, so modify it.

The mapLteSignalLevel (mLteRsrp, mLteRssnr, mLteSignalStrength) method of IServiceStateExt. If this plug-in is not available, you can directly comment out the code 2 above from Code 1.

Because IServiceStateExt is an interface, modify its specific implementation class. Find the DefaultServiceStateExt implementation class by searching the source code.

The Directory of this class is located in: vendor/mediatek/proprietary/frameworks/base/packages/FwkPlugin/src/com/mediatek/op/telephony/defaserviceservicestateext. java

The modified code is as follows:

  //[ALPS01440836][ALPS01594704]-START: change level mapping rule of signal for CMCC    public int mapLteSignalLevel(int mLteRsrp, int mLteRssnr, int mLteSignalStrength) {      //added by ouyangandroid.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 ouyangandroid.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 ouyangandroid.util.Log.e(mapLteSignalLevel, snrIconLevel != -1);            return snrIconLevel;        }        if (rsrpIconLevel != -1) {        //added by ouyangandroid.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 ouyangandroid.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


After the code is modified, make systemimage and then download it to the MTK platform mobile phone.

 

========================================================== ========================================================== ====

The modified information is as follows:

1. When the signal is greater than or equal to-97dBm, the signal is displayed in full mode, and must be greater than-85dBm before modification.

 

2. When the signal is greater than or equal to-105dBm, but less than-97dBm, the signal is displayed with one fewer, and must be greater than-95dBm before modification.

 

3. When the signal is greater than or equal to-110dBm, but less than-105dBm, the signal is displayed in 2 cells, which is hard to be captured.

4. When the signal is greater than or equal to-120dBm and smaller than-110dBm, the signal is displayed in 1 cell, which is hard to be captured.

5. When the signal is greater than or equal to-140dBm and less than-120dBm, the signal is displayed in 0 cells, which is hard to be captured.

 

 

========================================================== ========================================================== ====

Of course, you can modify the 3G and 2G signals of China Telecom, China Mobile, and China Unicom in this category.

Finally, the source code rameworksase elephonyjavaandroid elephonySignalStrength. java is attached.

 

 

 

 

========================================================== ========================================================== ====

The Code of vendor/mediatek/proprietary/frameworks/base/packages/FwkPlugin/src/com/mediatek/op/telephony/defaserviceservicestateext. java is as follows:

 

 

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.