Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a8ec531a authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Run ImsSmsListener callbacks as self."

parents bc9bd7ef f8e0f65e
Loading
Loading
Loading
Loading
+100 −84
Original line number Diff line number Diff line
@@ -117,6 +117,8 @@ public class ImsSmsDispatcher extends SMSDispatcher {
        @Override
        public void onSendSmsResult(int token, int messageRef, @SendStatusResult int status,
                int reason, int networkReasonCode) {
            final long identity = Binder.clearCallingIdentity();
            try {
                logd("onSendSmsResult token=" + token + " messageRef=" + messageRef
                        + " status=" + status + " reason=" + reason + " networkReasonCode="
                        + networkReasonCode);
@@ -152,11 +154,16 @@ public class ImsSmsDispatcher extends SMSDispatcher {
                        break;
                    default:
                }
            } finally {
                Binder.restoreCallingIdentity(identity);
            }
        }

        @Override
        public void onSmsStatusReportReceived(int token, String format, byte[] pdu)
                throws RemoteException {
            final long identity = Binder.clearCallingIdentity();
            try {
                logd("Status report received.");
                android.telephony.SmsMessage message =
                        android.telephony.SmsMessage.createFromPdu(pdu, format);
@@ -178,10 +185,15 @@ public class ImsSmsDispatcher extends SMSDispatcher {
                } catch (ImsException e) {
                    loge("Failed to acknowledgeSmsReport(). Error: " + e.getMessage());
                }
            } finally {
                Binder.restoreCallingIdentity(identity);
            }
        }

        @Override
        public void onSmsReceived(int token, String format, byte[] pdu) {
            final long identity = Binder.clearCallingIdentity();
            try {
                logd("SMS received.");
                android.telephony.SmsMessage message =
                        android.telephony.SmsMessage.createFromPdu(pdu, format);
@@ -196,7 +208,8 @@ public class ImsSmsDispatcher extends SMSDispatcher {
                            mappedResult = ImsSmsImplBase.DELIVER_STATUS_ERROR_NO_MEMORY;
                            break;
                        case Intents.RESULT_SMS_UNSUPPORTED:
                        mappedResult = ImsSmsImplBase.DELIVER_STATUS_ERROR_REQUEST_NOT_SUPPORTED;
                            mappedResult =
                                    ImsSmsImplBase.DELIVER_STATUS_ERROR_REQUEST_NOT_SUPPORTED;
                            break;
                        default:
                            mappedResult = ImsSmsImplBase.DELIVER_STATUS_ERROR_GENERIC;
@@ -214,6 +227,9 @@ public class ImsSmsDispatcher extends SMSDispatcher {
                        loge("Failed to acknowledgeSms(). Error: " + e.getMessage());
                    }
                }, true);
            } finally {
                Binder.restoreCallingIdentity(identity);
            }
        }
    };