Signal strength display and signal refresh time in Android

Source: Internet
Author: User

The UI Signal display on the android interface is implemented by sending AT commands to the communication module through RIL. For example, at + CSQ, we can obtain real-time RIL information through logcat-B radio.


So how long does the signal display refresh on the interface?

Frameworks/base/telephony/Java/COM/Android/Internal/telephony/servicestatetracker. Java

/** Signal strength poll rate .*/
Protected static final int poll_period_millis = 120*1000;

The signal refresh time is 2 minutes, that is to say, it takes about 2 minutes to display the signal from my boot to the signal, which is too long.

Protected static final int poll_period_millis = 12*1000;

We can change it to 12 seconds.

How can we obtain the signal strength displayed on the interface?

Frameworks/base/packages/systemui/src/COM/Android/systemui/statusbar/statusbarpolicy. Java



If (! Iscdma () {// obtain the GSM signal strength
Int ASU = msignalstrength. getgsmsignalstrength ();

// ASU rangeles from 0 to 31-ts 27.007 sec 8.5
// ASU = 0 (-11db or less) is very weak
// Signal, its better to show 0 bars to the user in such cases.
// ASU = 99 is a special case, where the signal strength is unknown.
If (ASU <= 2 | ASU = 99) iconlevel = 0;
Else if (ASU> = 12) iconlevel = 4;
Else if (ASU> = 8) iconlevel = 3;
Else if (ASU> = 5) iconlevel = 2;
Else iconlevel = 1;

// Though mphone is a manager, this call is not an IPC
If (mphone. isnetworkroaming ()){
Iconlist = ssignalimages_r [minetcondition];
} Else {
Iconlist = ssignalimages [minetcondition];
}
} Else {
Iconlist = ssignalimages [minetcondition];

// If 3G (EV) and 1X network are available than 3G shoshould be // The evdo network is displayed when there are 3G and 1X (Telecom 2.5g) Networks
// Displayed, displayed Arg shocould be from the EV side.
// If a voice call is made then Arg should switch to 1x. // The 1X network is used during the call,
If (mphonestate = telephonymanager. call_state_idle) & isevdo ()){
Iconlevel = getevdolevel ();
If (false ){
Slog. D (TAG, "Use evdo level =" + iconlevel + "to replace CDMA level =" + getcdmalevel ());
}
} Else {
Iconlevel = getcdmalevel ();
}
}
Mphonesignaliconid = iconlist [iconlevel];
Mservice. seticon ("phone_signal", mphonesignaliconid, 0 );
}

Private int getcdmalevel () {// CDMA Signal display
Final int cdmadbm = msignalstrength. getcdmadbm ();
Final int CDMA ecio = msignalstrength. getcdma ecio ();
Int leveldbm = 0;
Int levelecio = 0;

If (cdmadbm> =-75) leveldbm = 4;
Else if (cdmadbm> =-85) leveldbm = 3;
Else if (cdmadbm >=- 95) leveldbm = 2;
Else if (cdmadbm> =-100) leveldbm = 1;
Else leveldbm = 0;

// EC/Io are in dB * 10
If (CDMA ecio> =-90) levelecio = 4;
Else if (CDMA ecio >=- 110) levelecio = 3;
Else if (CDMA ecio >=- 130) levelecio = 2;
Else if (CDMA ecio >=- 150) levelecio = 1;
Else levelecio = 0;

Return (leveldbm <levelecio )? Leveldbm: levelecio;
}

Private int getevdolevel () {// The evdo network displays the CDMA 2000 3G signal (for example, the telecom Tianyi 3G)
Int evdodbm = msignalstrength. getevdodbm ();
Int evdosnr = msignalstrength. getevdosnr ();
Int levelevdodbm = 0;
Int levelevdosnr = 0;

If (evdodbm> =-65) levelevdodbm = 4;
Else if (evdodbm >=- 75) levelevdodbm = 3;
Else if (evdodbm >=- 90) levelevdodbm = 2;
Else if (evdodbm >=- 105) levelevdodbm = 1;
Else levelevdodbm = 0;

If (evdosnr> = 7) levelevdosnr = 4;
Else if (evdosnr> = 5) levelevdosnr = 3;
Else if (evdosnr> = 3) levelevdosnr = 2;
Else if (evdosnr> = 1) levelevdosnr = 1;
Else levelevdosnr = 0;

Return (levelevdodbm <levelevdosnr )? Levelevdodbm: levelevdosnr;
}

Many Android mobile phone signals are not very good. They can modify the above section to maintain the signal displayed on the interface in a certain area, of course, the signal value of each module does not all follow the grading standard of the above Code, and the corresponding at manual must be modified.



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.