diff options
author | Taesu Lee <taesu82.lee@samsung.com> | 2018-09-07 14:38:28 +0900 |
---|---|---|
committer | Michael Bestas <mkbestas@lineageos.org> | 2019-09-15 01:37:54 +0300 |
commit | a19b3f35f1b127e3b1ecbaeec8a68cf56555e2c2 (patch) | |
tree | ea8d7725734ddf0ce2d3d5aa8d85f37f4cbf5a64 | |
parent | 10e57b682d5c88ce36dbe2e03e2775dc999489ac (diff) | |
download | packages_apps_Messaging-a19b3f35f1b127e3b1ecbaeec8a68cf56555e2c2.tar.gz packages_apps_Messaging-a19b3f35f1b127e3b1ecbaeec8a68cf56555e2c2.tar.bz2 packages_apps_Messaging-a19b3f35f1b127e3b1ecbaeec8a68cf56555e2c2.zip |
Fix SMS status handling
Simple matching up CDMA status with GSM TP-Status for common handling.
And fix bugleStatusForSMS() for all the permanent error cases.
Note: Need to check SC operation for ERROR_TEMPORARY.
Test: Manual
Change-Id: Ic8136d273dc0c25a4f0690f951d4d8aca20579ff
Signed-off-by: Taesu Lee <taesu82.lee@samsung.com>
-rw-r--r-- | src/com/android/messaging/datamodel/action/SyncMessageBatch.java | 10 | ||||
-rw-r--r-- | src/com/android/messaging/receiver/SendStatusReceiver.java | 26 |
2 files changed, 30 insertions, 6 deletions
diff --git a/src/com/android/messaging/datamodel/action/SyncMessageBatch.java b/src/com/android/messaging/datamodel/action/SyncMessageBatch.java index 972d691..a623666 100644 --- a/src/com/android/messaging/datamodel/action/SyncMessageBatch.java +++ b/src/com/android/messaging/datamodel/action/SyncMessageBatch.java @@ -202,11 +202,11 @@ class SyncMessageBatch { // For a message we sync either if (isOutgoing) { // Outgoing message not yet been sent - if (type == Telephony.Sms.MESSAGE_TYPE_FAILED || - type == Telephony.Sms.MESSAGE_TYPE_OUTBOX || - type == Telephony.Sms.MESSAGE_TYPE_QUEUED || - (type == Telephony.Sms.MESSAGE_TYPE_SENT && - status == Telephony.Sms.STATUS_FAILED)) { + if (type == Telephony.Sms.MESSAGE_TYPE_FAILED + || type == Telephony.Sms.MESSAGE_TYPE_OUTBOX + || type == Telephony.Sms.MESSAGE_TYPE_QUEUED + || (type == Telephony.Sms.MESSAGE_TYPE_SENT + && status >= Telephony.Sms.STATUS_FAILED)) { // Not sent counts as failed and available for manual resend bugleStatus = MessageData.BUGLE_STATUS_OUTGOING_FAILED; } else if (status == Sms.STATUS_COMPLETE) { diff --git a/src/com/android/messaging/receiver/SendStatusReceiver.java b/src/com/android/messaging/receiver/SendStatusReceiver.java index fc0e8c9..3af65f2 100644 --- a/src/com/android/messaging/receiver/SendStatusReceiver.java +++ b/src/com/android/messaging/receiver/SendStatusReceiver.java @@ -20,6 +20,7 @@ import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.net.Uri; +import android.provider.Telephony.Sms; import android.telephony.SmsMessage; import com.android.messaging.datamodel.action.ProcessDeliveryReportAction; @@ -81,9 +82,32 @@ public class SendStatusReceiver extends BroadcastReceiver { LogUtil.e(LogUtil.BUGLE_TAG, "SendStatusReceiver: empty report message"); return; } - int status = 0; + int status = Sms.STATUS_COMPLETE; try { + final String format = intent.getStringExtra("format"); status = smsMessage.getStatus(); + // Simple matching up CDMA status with GSM status. + if (SmsMessage.FORMAT_3GPP2.equals(format)) { + final int errorClass = (status >> 24) & 0x03; + final int statusCode = (status >> 16) & 0x3f; + switch (errorClass) { + case 0: /*ERROR_NONE*/ + if (statusCode == 0x02 /*STATUS_DELIVERED*/) { + status = Sms.STATUS_COMPLETE; + } else status = Sms.STATUS_PENDING; + break; + case 2: /*ERROR_TEMPORARY*/ + // TODO: Need to check whether SC still trying to deliver the SMS to + // destination and will send the report again? + status = Sms.STATUS_PENDING; + break; + case 3: /*ERROR_PERMANENT*/ + status = Sms.STATUS_FAILED; + break; + default: + status = Sms.STATUS_PENDING; + } + } } catch (final NullPointerException e) { // Sometimes, SmsMessage.mWrappedSmsMessage is null causing NPE when we access // the methods on it although the SmsMessage itself is not null. |