diff options
author | Ricardo Cerqueira <cyanogenmod@cerqueira.org> | 2012-07-09 03:36:13 +0400 |
---|---|---|
committer | Gerrit Code Review <gerrit@review.cyanogenmod.com> | 2012-07-09 03:36:13 +0400 |
commit | 8239114f53043ed9fc5e6c64717230faeba928e9 (patch) | |
tree | 29cb918bb7b6830d7639c932b1afdff8ec052e6b | |
parent | 2cd5e9ae434207fc7ab94ccff2df57db343e20fd (diff) | |
parent | 0ae60a90ef4e033190cb9dfe095f50f5aca91f2a (diff) | |
download | frameworks_base-8239114f53043ed9fc5e6c64717230faeba928e9.zip frameworks_base-8239114f53043ed9fc5e6c64717230faeba928e9.tar.gz frameworks_base-8239114f53043ed9fc5e6c64717230faeba928e9.tar.bz2 |
Merge "SamsungQualcommUiccRIL: use signalstrength value instead of # of bars" into ics
-rw-r--r-- | telephony/java/com/android/internal/telephony/SamsungQualcommUiccRIL.java | 56 |
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; } } |