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

Commit d9db861b authored by Aishwarya Mallampati's avatar Aishwarya Mallampati
Browse files

Clear calling identity before calling getSubscriptionUserHandle

Bug: 320599071
Bug: 308033518
Test: Sending and receiving SMS/MMS,
      atest FrameworkTelephonyTests,
      atest CtsTelephonyTestCases
Change-Id: I84c74a81207d54f394721918e59eac2d89ef59e2
Merged-In: I84c74a81207d54f394721918e59eac2d89ef59e2
(cherry picked from commit 470051c4)
parent 7f28fd57
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -2466,7 +2466,13 @@ public abstract class SMSDispatcher extends Handler {
        /** Return if the SMS was originated from the default SMS application. */
        public boolean isFromDefaultSmsApplication(Context context) {
            if (mIsFromDefaultSmsApplication == null) {
                UserHandle userHandle = TelephonyUtils.getSubscriptionUserHandle(context, mSubId);
                UserHandle userHandle;
                final long identity = Binder.clearCallingIdentity();
                try {
                    userHandle = TelephonyUtils.getSubscriptionUserHandle(context, mSubId);
                } finally {
                    Binder.restoreCallingIdentity(identity);
                }
                // Perform a lazy initialization, due to the cost of the operation.
                mIsFromDefaultSmsApplication = SmsApplication.isDefaultSmsApplicationAsUser(context,
                                    getAppPackageName(), userHandle);