diff options
Diffstat (limited to 'telephony/java')
-rw-r--r-- | telephony/java/android/telephony/SmsMessage.java | 5 | ||||
-rw-r--r-- | telephony/java/android/telephony/ims/stub/ImsSmsImplBase.java | 12 |
2 files changed, 15 insertions, 2 deletions
diff --git a/telephony/java/android/telephony/SmsMessage.java b/telephony/java/android/telephony/SmsMessage.java index 9d03b59797ac..57f89e316e1c 100644 --- a/telephony/java/android/telephony/SmsMessage.java +++ b/telephony/java/android/telephony/SmsMessage.java @@ -207,7 +207,10 @@ public class SmsMessage { */ public static SmsMessage createFromPdu(byte[] pdu, String format) { SmsMessageBase wrappedMessage; - + if (pdu == null) { + Rlog.i(LOG_TAG, "createFromPdu(): pdu is null"); + return null; + } if (SmsConstants.FORMAT_3GPP2.equals(format)) { wrappedMessage = com.android.internal.telephony.cdma.SmsMessage.createFromPdu(pdu); } else if (SmsConstants.FORMAT_3GPP.equals(format)) { diff --git a/telephony/java/android/telephony/ims/stub/ImsSmsImplBase.java b/telephony/java/android/telephony/ims/stub/ImsSmsImplBase.java index 0664a7e9a973..852c8e0618c8 100644 --- a/telephony/java/android/telephony/ims/stub/ImsSmsImplBase.java +++ b/telephony/java/android/telephony/ims/stub/ImsSmsImplBase.java @@ -197,6 +197,9 @@ public class ImsSmsImplBase { * platform will deliver the message to the messages database and notify the IMS provider of the * result by calling {@link #acknowledgeSms(int, int, int)}. * + * This method must not be called before {@link #onReady()} is called or the call will fail. If + * the platform is not available, {@link #acknowledgeSms(int, int, int)} will be called with the + * {@link #DELIVER_STATUS_ERROR_GENERIC} result code. * @param token unique token generated by IMS providers that the platform will use to trigger * callbacks for this message. * @param format the format of the message. Valid values are {@link SmsMessage#FORMAT_3GPP} and @@ -213,7 +216,14 @@ public class ImsSmsImplBase { mListener.onSmsReceived(token, format, pdu); } catch (RemoteException e) { Log.e(LOG_TAG, "Can not deliver sms: " + e.getMessage()); - acknowledgeSms(token, 0, DELIVER_STATUS_ERROR_GENERIC); + SmsMessage message = SmsMessage.createFromPdu(pdu, format); + if (message != null && message.mWrappedSmsMessage != null) { + acknowledgeSms(token, message.mWrappedSmsMessage.mMessageRef, + DELIVER_STATUS_ERROR_GENERIC); + } else { + Log.w(LOG_TAG, "onSmsReceived: Invalid pdu entered."); + acknowledgeSms(token, 0, DELIVER_STATUS_ERROR_GENERIC); + } } } } |