summaryrefslogtreecommitdiffstats
path: root/telephony/java/android
diff options
context:
space:
mode:
authorJohn Wang <johnwang@google.com>2012-01-30 18:45:56 -0800
committerJohn Wang <johnwang@google.com>2012-01-31 11:15:28 -0800
commit5e39519396918f9e2312d1c355a9b6889851d887 (patch)
tree09ae6d3a8e4bc3bca9e2f9b909e5620862a43e47 /telephony/java/android
parentb2d37b39a1bb48d9f9c5b45255c5df769b85d6ae (diff)
downloadframeworks_base-5e39519396918f9e2312d1c355a9b6889851d887.zip
frameworks_base-5e39519396918f9e2312d1c355a9b6889851d887.tar.gz
frameworks_base-5e39519396918f9e2312d1c355a9b6889851d887.tar.bz2
Use LTE SNR and RSRP to set signal level bar.
The LTE signal strength level is the smaller one between lte rsrp level and lte snr level if both rsrp and snr are valid. The lte snr mapping are Four bars: SNR >= 45 Three bars: 10 <= SNR < 45 Two bars: -30 <= SNR < 10 One bars: SNR < -30 No bars: No Service The invalid value of lte snr is changed to INVALID_SNR from -1, since -1 is a valid value of lte snr. bug:5640958 Change-Id: If26aaba0c7fcc0fee3db488b5adfa02922f06715
Diffstat (limited to 'telephony/java/android')
-rw-r--r--telephony/java/android/telephony/SignalStrength.java34
1 files changed, 27 insertions, 7 deletions
diff --git a/telephony/java/android/telephony/SignalStrength.java b/telephony/java/android/telephony/SignalStrength.java
index 05e198f..1a4b574 100644
--- a/telephony/java/android/telephony/SignalStrength.java
+++ b/telephony/java/android/telephony/SignalStrength.java
@@ -47,6 +47,9 @@ public class SignalStrength implements Parcelable {
"none", "poor", "moderate", "good", "great"
};
+ /** @hide */
+ public static final int INVALID_SNR = 0x7FFFFFFF;
+
private int mGsmSignalStrength; // Valid values are (0-31, 99) as defined in TS 27.007 8.5
private int mGsmBitErrorRate; // bit error rate (0-7, 99) as defined in TS 27.007 8.5
private int mCdmaDbm; // This value is the RSSI value
@@ -96,7 +99,7 @@ public class SignalStrength implements Parcelable {
mLteSignalStrength = -1;
mLteRsrp = -1;
mLteRsrq = -1;
- mLteRssnr = -1;
+ mLteRssnr = INVALID_SNR;
mLteCqi = -1;
isGsm = true;
}
@@ -136,7 +139,8 @@ public class SignalStrength implements Parcelable {
int evdoDbm, int evdoEcio, int evdoSnr,
boolean gsm) {
this(gsmSignalStrength, gsmBitErrorRate, cdmaDbm, cdmaEcio,
- evdoDbm, evdoEcio, evdoSnr, -1, -1, -1, -1, -1, gsm);
+ evdoDbm, evdoEcio, evdoSnr, -1, -1,
+ -1, INVALID_SNR, -1, gsm);
}
/**
@@ -292,7 +296,7 @@ public class SignalStrength implements Parcelable {
if ((mLteSignalStrength == -1)
&& (mLteRsrp == -1)
&& (mLteRsrq == -1)
- && (mLteRssnr == -1)
+ && (mLteRssnr == INVALID_SNR)
&& (mLteCqi == -1)) {
level = getGsmLevel();
} else {
@@ -327,7 +331,7 @@ public class SignalStrength implements Parcelable {
if ((mLteSignalStrength == -1)
&& (mLteRsrp == -1)
&& (mLteRsrq == -1)
- && (mLteRssnr == -1)
+ && (mLteRssnr == INVALID_SNR)
&& (mLteCqi == -1)) {
asuLevel = getGsmAsuLevel();
} else {
@@ -363,7 +367,7 @@ public class SignalStrength implements Parcelable {
if ((mLteSignalStrength == -1)
&& (mLteRsrp == -1)
&& (mLteRsrq == -1)
- && (mLteRssnr == -1)
+ && (mLteRssnr == INVALID_SNR)
&& (mLteCqi == -1)) {
dBm = getGsmDbm();
} else {
@@ -566,6 +570,7 @@ public class SignalStrength implements Parcelable {
*/
public int getLteLevel() {
int levelLteRsrp = 0;
+ int levelLteRssnr = 0;
if (mLteRsrp == -1) levelLteRsrp = 0;
else if (mLteRsrp >= -95) levelLteRsrp = SIGNAL_STRENGTH_GREAT;
@@ -573,8 +578,23 @@ public class SignalStrength implements Parcelable {
else if (mLteRsrp >= -115) levelLteRsrp = SIGNAL_STRENGTH_MODERATE;
else levelLteRsrp = SIGNAL_STRENGTH_POOR;
- if (DBG) log("Lte level: "+levelLteRsrp);
- return levelLteRsrp;
+ if (mLteRssnr == INVALID_SNR) levelLteRssnr = 0;
+ else if (mLteRssnr >= 45) levelLteRssnr = SIGNAL_STRENGTH_GREAT;
+ else if (mLteRssnr >= 10) levelLteRssnr = SIGNAL_STRENGTH_GOOD;
+ else if (mLteRssnr >= -30) levelLteRssnr = SIGNAL_STRENGTH_MODERATE;
+ else levelLteRssnr = SIGNAL_STRENGTH_POOR;
+
+ int level;
+ if (mLteRsrp == -1)
+ level = levelLteRssnr;
+ else if (mLteRssnr == INVALID_SNR)
+ level = levelLteRsrp;
+ else
+ level = (levelLteRssnr < levelLteRsrp) ? levelLteRssnr : levelLteRsrp;
+
+ if (DBG) log("Lte rsrp level: "+levelLteRsrp
+ + " snr level: " + levelLteRssnr + " level: " + level);
+ return level;
}
/**