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

Commit afcdfa26 authored by Tyler Gunn's avatar Tyler Gunn
Browse files

Fix inability to reject call as secondary user from lock screen.

The rejectCall method in InCallAdapter was performing a check to see if
reply via sms is allowed, however it was doing this outside of the
"clearCallingIdentity" block.  This was causing a crash when trying to
determine if the device is locked.

Test: Reject call as primary user from lock screen.
Test: Reject call as secondary user from lock screen.
Bug: 78463911

Merged-In: I85b5793a1e64c2567df035cfb3d7b6e0daa3181f
Change-Id: I85b5793a1e64c2567df035cfb3d7b6e0daa3181f
(cherry picked from commit a286b7b8)
parent 67ff0378
Loading
Loading
Loading
Loading
+10 −6
Original line number Diff line number Diff line
@@ -96,15 +96,19 @@ class InCallAdapter extends IInCallAdapter.Stub {
    public void rejectCall(String callId, boolean rejectWithMessage, String textMessage) {
        try {
            Log.startSession(LogUtils.Sessions.ICA_REJECT_CALL, mOwnerComponentName);
            // Check to make sure the in-call app's user isn't restricted from sending SMS. If so,
            // silently drop the outgoing message. Also drop message if the screen is locked.
            if (!mCallsManager.isReplyWithSmsAllowed(Binder.getCallingUid())) {
                rejectWithMessage = false;
                textMessage = null;
            }

            int callingUid = Binder.getCallingUid();
            long token = Binder.clearCallingIdentity();
            try {
                synchronized (mLock) {
                    // Check to make sure the in-call app's user isn't restricted from sending SMS.
                    // If so, silently drop the outgoing message. Also drop message if the screen is
                    // locked.
                    if (!mCallsManager.isReplyWithSmsAllowed(callingUid)) {
                        rejectWithMessage = false;
                        textMessage = null;
                    }

                    Log.d(this, "rejectCall(%s,%b,%s)", callId, rejectWithMessage, textMessage);
                    Call call = mCallIdMapper.getCall(callId);
                    if (call != null) {