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

Commit d9b41220 authored by Brad Ebinger's avatar Brad Ebinger
Browse files

Allow getCallState if called from SHELL_UID

Allow getCallState if called from SHELL_UID or READ_PHONE_STATE.

Fixes: 184372932
Test: atest CtsAppSecurityHostTestCases:ResumeOnRebootHostTest
Test: adb shell am switch-user
Change-Id: I3e24c7b37b9082481870156d5e5a6eb5d0a01950
parent b269920b
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -934,7 +934,9 @@ public class TelecomServiceImpl {
                if (CompatChanges.isChangeEnabled(
                        TelecomManager.ENABLE_GET_CALL_STATE_PERMISSION_PROTECTION, callingPackage,
                        Binder.getCallingUserHandle())) {
                    if (!canReadPhoneState(callingPackage, callingFeatureId, "getCallState")) {
                    // Bypass canReadPhoneState check if this is being called from SHELL UID
                    if (Binder.getCallingUid() != Process.SHELL_UID && !canReadPhoneState(
                            callingPackage, callingFeatureId, "getCallState")) {
                        throw new SecurityException("getCallState API requires READ_PHONE_STATE"
                                + " for API version 31+");
                    }