aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdnan Begovic <adnan@cyngn.com>2014-11-25 07:41:06 -0600
committerAdnan Begovic <adnan@cyngn.com>2014-11-25 07:41:06 -0600
commit1554a1714e55ecab70a69384a5578502b6c45cab (patch)
tree2b32de6929ffe207001f0805d4129cf5263f6ce2
parentadd0f99ce41981f04dd8753a18fd06ea92f72881 (diff)
downloadandroid_frameworks_opt_telephony-1554a1714e55ecab70a69384a5578502b6c45cab.tar.gz
android_frameworks_opt_telephony-1554a1714e55ecab70a69384a5578502b6c45cab.tar.bz2
android_frameworks_opt_telephony-1554a1714e55ecab70a69384a5578502b6c45cab.zip
Telephony: Fall back on deprecated createFromPdu.
Since some of our legacy cdma devices utilizes legacy RIL blobs and hacky implementations, we can't wholly rely on getting a correct format from the InboundSmsTracker. Thus we fallback on the deprecated createFromPdu which attempts to guess the format of the SmsMessage by looking at the voice tech and falling back to the other format if it's incorrect. Change-Id: I90dc185071de827510f2bcec1c837c0024182c41
-rwxr-xr-xsrc/java/android/provider/Telephony.java12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/java/android/provider/Telephony.java b/src/java/android/provider/Telephony.java
index b76c5f11a..46780156f 100755
--- a/src/java/android/provider/Telephony.java
+++ b/src/java/android/provider/Telephony.java
@@ -1164,6 +1164,18 @@ public final class Telephony {
for (int i = 0; i < pduCount; i++) {
byte[] pdu = (byte[]) pdus[i];
msgs[i] = SmsMessage.createFromPdu(pdu, format);
+ // If the originating address is null on our message
+ // then the format for SmsMessage createFromPdu is likely
+ // incorrect. SmsMessage createFromPdu(the new method)
+ // takes in a format parameter that it gets from the Tracker
+ // however, on some of our legacy devices using a legacy ril,
+ // since that format is derived by getting voice tech,
+ // we can get a bad format and no valid members.
+ // Thus we introduce a hack that utilizes the deprecated
+ // SmsMessage.createFromPdu if we get a null originating address.
+ if (msgs[i].getOriginatingAddress() == null) {
+ msgs[i] = SmsMessage.createFromPdu(pdu);
+ }
String originatingAddress = msgs[i].getOriginatingAddress();
if (!TextUtils.isEmpty(originatingAddress)) {
String normalized = normalizeDigitsOnly(originatingAddress);