diff options
author | Brad Ebinger <breadley@google.com> | 2018-03-19 14:30:32 -0700 |
---|---|---|
committer | Brad Ebinger <breadley@google.com> | 2018-03-23 09:58:27 -0700 |
commit | d4285ad1232c87af6fad6ee68c04a2efb96aa924 (patch) | |
tree | f7102610f21d1452572b64166e7faae5d6bb1caa /telephony/java/android/telephony/ims/stub/ImsSmsImplBase.java | |
parent | de51e0c61523f948d9a9797fce1f07e2a67e99fd (diff) |
Parse SMS locally upon error to get message ref
Parse the SMS locally to get the message ref when
onSmsReceived fails due to the platform being
unavailable. This allows the correct message ref
to be sent back via acknowledgeSms, instead of
the incorrect "0" value.
Bug: 74551838
Test: Manual
Change-Id: I2f8128d8ff4e07bb3720a344cee70fa5fd5d7535
Diffstat (limited to 'telephony/java/android/telephony/ims/stub/ImsSmsImplBase.java')
-rw-r--r-- | telephony/java/android/telephony/ims/stub/ImsSmsImplBase.java | 12 |
1 files changed, 11 insertions, 1 deletions
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); + } } } } |