summaryrefslogtreecommitdiffstats
path: root/telephony/java/com/android
diff options
context:
space:
mode:
authorDavid Ferguson <ferguson.david@gmail.com>2012-06-24 22:00:32 -0400
committerDavid Ferguson <ferguson.david@gmail.com>2012-06-28 19:25:13 -0400
commit0ae60a90ef4e033190cb9dfe095f50f5aca91f2a (patch)
treef83025bbecff4e020e1cdbaf2436f761e9035e6a /telephony/java/com/android
parent44f9c784306665b040acab64b37aa514f8e22920 (diff)
downloadframeworks_base-0ae60a90ef4e033190cb9dfe095f50f5aca91f2a.zip
frameworks_base-0ae60a90ef4e033190cb9dfe095f50f5aca91f2a.tar.gz
frameworks_base-0ae60a90ef4e033190cb9dfe095f50f5aca91f2a.tar.bz2
SamsungQualcommUiccRIL: use signalstrength value instead of # of bars
* Math error in GSM level calculation gave high probability that 4 Samsung bars would be shown as 3 AOSP bars. * Samsung sends # of bars in the signalstrength field of GSM and LTE, indexes 0 and 7. But this is on a 0-5 scale where AOSP uses 0-4 scale. The cutoff points for the bins are also different. Because of this confusion, just pass the measured signalstrength to the framework instead of computing signalstrength based on # of Samsung bars. * For debug and experimentation, Samsung's bar method can be enabled by setting telephony.sends_barcount=true Change-Id: I8238af83f3a597b32eb99f42c71cbc263ad5bc82
Diffstat (limited to 'telephony/java/com/android')
-rw-r--r--telephony/java/com/android/internal/telephony/SamsungQualcommUiccRIL.java56
1 files changed, 45 insertions, 11 deletions
diff --git a/telephony/java/com/android/internal/telephony/SamsungQualcommUiccRIL.java b/telephony/java/com/android/internal/telephony/SamsungQualcommUiccRIL.java
index c45ab19..2c942ea 100644
--- a/telephony/java/com/android/internal/telephony/SamsungQualcommUiccRIL.java
+++ b/telephony/java/com/android/internal/telephony/SamsungQualcommUiccRIL.java
@@ -38,6 +38,9 @@ public class SamsungQualcommUiccRIL extends QualcommSharedRIL implements Command
boolean RILJ_LOGV = true;
boolean RILJ_LOGD = true;
+ public static final int INVALID_SNR = 0x7fffffff;
+ private boolean mSignalbarCount = SystemProperties.getBoolean("ro.telephony.sends_barcount", false);
+
public SamsungQualcommUiccRIL(Context context, int networkMode, int cdmaSubscription) {
super(context, networkMode, cdmaSubscription);
}
@@ -225,18 +228,29 @@ public class SamsungQualcommUiccRIL extends QualcommSharedRIL implements Command
for (int i = 0 ; i < numInts ; i++) {
response[i] = p.readInt();
}
+ Log.d(LOG_TAG, "responseSignalStength BEFORE: mode=" + (mSignalbarCount ? "bars" : "raw") +
+ " gsmDbm=" + response[0] + " gsmEcio=" + response[1] +
+ " lteSignalStrength=" + response[7] + " lteRsrp=" + response[8] + " lteRsrq=" + response[9] +
+ " lteRssnr=" + response[10] + " lteCqi=" + response[11]);
// RIL_GW_SignalStrength
- boolean mSignalbarCount = SystemProperties.getBoolean("telephony.sends_barcount", true);
- if(mSignalbarCount) {
+ if (mSignalbarCount) {
//Samsung sends the count of bars that should be displayed instead of
//a real signal strength
- response[0] = ((response[0] & 0xFF00) >> 8) * 3; //gsmDbm
- if ((response[0] > 0) && (response[0] != 99)) {
- response[0]--; // correct down by 1 dBm to match stock's behavior
+ int num_bars = (response[0] & 0xff00) >> 8;
+
+ // Translate number of bars into something SignalStrength.java can understand
+ switch (num_bars) {
+ case 0 : response[0] = 1; break; // map to 0 bars
+ case 1 : response[0] = 3; break; // map to 1 bar
+ case 2 : response[0] = 5; break; // map to 2 bars
+ case 3 : response[0] = 8; break; // map to 3 bars
+ case 4 : response[0] = 12; break; // map to 4 bars
+ case 5 : response[0] = 15; break; // map to 4 bars but give an extra 10 dBm
+ default : response[0] &= 0xff; break; // no idea; just pass value through
}
} else {
- response[0] = response[0] & 0xFF; //gsmDbm
+ response[0] &= 0xff; //gsmDbm
}
response[1] = -1; // gsmEcio
@@ -253,15 +267,35 @@ public class SamsungQualcommUiccRIL extends QualcommSharedRIL implements Command
if (response[7] == 99) {
// If LTE is not enabled, clear LTE results
// 7-11 must be -1 for GSM signal strength to be used (see frameworks/base/telephony/java/android/telephony/SignalStrength.java)
- response[7] = -1;
- response[8] = -1;
- response[9] = -1;
- response[10] = -1;
- response[11] = -1;
+ response[7] = -1; // lteSignalStrength
+ response[8] = -1; // lteRsrp
+ response[9] = -1; // lteRsrq
+ response[10] = -1; // lteRssnr
+ response[11] = -1; // lteCqi
+ } else if (mSignalbarCount) {
+ int num_bars = (response[7] & 0xff00) >> 8;
+ response[7] &= 0xff; // remove the Samsung number of bars field
+ response[10] = INVALID_SNR; // mark lteRssnr invalid so it doesn't get used
+
+ // Translate number of bars into something SignalStrength.java can understand
+ switch (num_bars) {
+ case 0 : response[8] = -1; break; // map to 0 bars
+ case 1 : response[8] = -116; break; // map to 1 bar
+ case 2 : response[8] = -115; break; // map to 2 bars
+ case 3 : response[8] = -105; break; // map to 3 bars
+ case 4 : response[8] = -95; break; // map to 4 bars
+ case 5 : response[8] = -85; break; // map to 4 bars but give an extra 10 dBm
+ default : response[8] *= -1; break; // no idea; just pass value through
+ }
} else {
+ response[7] &= 0xff; // remove the Samsung number of bars field
response[8] *= -1;
}
+ Log.d(LOG_TAG, "responseSignalStength AFTER: mode=" + (mSignalbarCount ? "bars" : "raw") +
+ " gsmDbm=" + response[0] + " gsmEcio=" + response[1] +
+ " lteSignalStrength=" + response[7] + " lteRsrp=" + response[8] + " lteRsrq=" + response[9] +
+ " lteRssnr=" + response[10] + " lteCqi=" + response[11]);
return response;
}
}