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

Commit 6492c9a4 authored by Amit Mahajan's avatar Amit Mahajan Committed by Automerger Merge Worker
Browse files

Run ImsSmsListener callbacks as self. am: f375a9d8

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/opt/telephony/+/12310217

Change-Id: I122844242b8767e9de18d27f96561e6ba93a9d82
parents 10cb7ddb f375a9d8
Loading
Loading
Loading
Loading
+101 −85
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);
@@ -153,11 +155,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);
@@ -179,10 +186,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);
@@ -197,7 +209,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;
@@ -215,6 +228,9 @@ public class ImsSmsDispatcher extends SMSDispatcher {
                        loge("Failed to acknowledgeSms(). Error: " + e.getMessage());
                    }
                }, true);
            } finally {
                Binder.restoreCallingIdentity(identity);
            }
        }
    };