READ_PRIVELEGED_PHONE_STATE vs READ_PHONE_STATE permissions check makes Signal crash when receiving calls
Hi,
I'm using a Poco X3 with Arrow OS vanilla A11 2021-03-07 build and MicroG, but the issue exist probably on all devices.
The Signal app crash when receiving calls. Its seems that this issue is known on several custom roms.
The problem is related to the permission required to access getDefaultOutgoingPhoneAccount() and getUserSelectedOutgoingPhoneAccountget()
Changing in the file /data/misc_de/0/apexdata/com.android.permission/runtime-permissions.xml
<item name="android.permission.READ_PHONE_STATE" granted="false" ...
with
<item name="android.permission.READ_PRIVILEGED_PHONE_STATE" granted="true" ...
fixed the issue, but I think haffenloher on this post is probably right: it's probably a ROM issue: the logs show that the system requires READ_PRIVILEGED_PHONE_STATE privilege to access getUserSelectedOutgoingPhoneAccountget and DefaultOutgoingPhoneAccount (see below), but the doc says that the READ_PHONE_STATE is sufficient.
Log extract:
03-07 11:06:26.017 1477 2702 I Telecom : CallAudioRouteStateMachine: Message received: SPEAKER_ON=1006, arg1=0: CARSM.mSPCR->CARSM.pM_SPEAKER_ON@AQY
03-07 11:06:26.017 1477 2702 I Telecom : QuiescentEarpieceRoute: Processing message SPEAKER_ON: CARSM.mSPCR->CARSM.pM_SPEAKER_ON@AQY
03-07 11:06:26.021 1477 3412 E Telecom : : getUserSelectedOutgoingPhoneAccount: TSI.gUSOPA@AQc
03-07 11:06:26.021 1477 3412 E Telecom : java.lang.SecurityException: getDefaultOutgoingPhoneAccount: Neither user 10205 nor current process has android.permission.READ_PRIVILEGED_PHONE_STATE.
03-07 11:06:26.021 1477 3412 E Telecom : at android.app.ContextImpl.enforce(ContextImpl.java:2018)
03-07 11:06:26.021 1477 3412 E Telecom : at android.app.ContextImpl.enforceCallingOrSelfPermission(ContextImpl.java:2046)
03-07 11:06:26.021 1477 3412 E Telecom : at android.content.ContextWrapper.enforceCallingOrSelfPermission(ContextWrapper.java:851)
03-07 11:06:26.021 1477 3412 E Telecom : at com.android.server.telecom.TelecomServiceImpl.isDialerOrPrivileged(TelecomServiceImpl.java:2242)
03-07 11:06:26.021 1477 3412 E Telecom : at com.android.server.telecom.TelecomServiceImpl.access$400(TelecomServiceImpl.java:75)
03-07 11:06:26.021 1477 3412 E Telecom : at com.android.server.telecom.TelecomServiceImpl$1.getUserSelectedOutgoingPhoneAccount(TelecomServiceImpl.java:150)
03-07 11:06:26.021 1477 3412 E Telecom : at com.android.internal.telecom.ITelecomService$Stub.onTransact(ITelecomService.java:762)
03-07 11:06:26.021 1477 3412 E Telecom : at android.os.Binder.execTransactInternal(Binder.java:1159)
03-07 11:06:26.021 1477 3412 E Telecom : at android.os.Binder.execTransact(Binder.java:1123)
--------- beginning of crash
03-07 11:06:26.024 6739 7723 E AndroidRuntime: FATAL EXCEPTION: pool-16-thread-1
03-07 11:06:26.024 6739 7723 E AndroidRuntime: Process: org.thoughtcrime.securesms, PID: 6739
03-07 11:06:26.024 6739 7723 E AndroidRuntime: java.lang.SecurityException: getDefaultOutgoingPhoneAccount: Neither user 10205 nor current process has android.permission.READ_PRIVILEGED_PHONE_STATE.
03-07 11:06:26.024 6739 7723 E AndroidRuntime: at android.os.Parcel.createExceptionOrNull(Parcel.java:2373)
03-07 11:06:26.024 6739 7723 E AndroidRuntime: at android.os.Parcel.createException(Parcel.java:2357)
03-07 11:06:26.024 6739 7723 E AndroidRuntime: at android.os.Parcel.readException(Parcel.java:2340)
03-07 11:06:26.024 6739 7723 E AndroidRuntime: at android.os.Parcel.readException(Parcel.java:2282)
03-07 11:06:26.024 6739 7723 E AndroidRuntime: at com.android.internal.telecom.ITelecomService$Stub$Proxy.getUserSelectedOutgoingPhoneAccount(ITelecomService.java:1647)
03-07 11:06:26.024 6739 7723 E AndroidRuntime: at android.telecom.TelecomManager.getUserSelectedOutgoingPhoneAccount(TelecomManager.java:1026)
03-07 11:06:26.024 6739 7723 E AndroidRuntime: at android.media.RingtoneManager.getDefaultPhoneAccountHandle(RingtoneManager.java:892)
03-07 11:06:26.024 6739 7723 E AndroidRuntime: at android.media.RingtoneManager.getCacheForType(RingtoneManager.java:1053)
03-07 11:06:26.024 6739 7723 E AndroidRuntime: at android.media.MediaPlayer.setDataSource(MediaPlayer.java:1066)
03-07 11:06:26.024 6739 7723 E AndroidRuntime: at android.media.MediaPlayer.setDataSource(MediaPlayer.java:1005)
03-07 11:06:26.024 6739 7723 E AndroidRuntime: at org.thoughtcrime.securesms.webrtc.audio.IncomingRinger.createPlayer(IncomingRinger.java:112)
03-07 11:06:26.024 6739 7723 E AndroidRuntime: at org.thoughtcrime.securesms.webrtc.audio.IncomingRinger.start(IncomingRinger.java:41)
03-07 11:06:26.024 6739 7723 E AndroidRuntime: at org.thoughtcrime.securesms.webrtc.audio.SignalAudioManager.startIncomingRinger(SignalAudioManager.java:53)
03-07 11:06:26.024 6739 7723 E AndroidRuntime: at org.thoughtcrime.securesms.service.webrtc.WebRtcInteractor.startIncomingRinger(WebRtcInteractor.java:142)
03-07 11:06:26.024 6739 7723 E AndroidRuntime: at org.thoughtcrime.securesms.service.webrtc.IncomingCallActionProcessor.handleLocalRinging(IncomingCallActionProcessor.java:172)
03-07 11:06:26.024 6739 7723 E AndroidRuntime: at org.thoughtcrime.securesms.service.webrtc.WebRtcActionProcessor.processAction(WebRtcActionProcessor.java:193)
03-07 11:06:26.024 6739 7723 E AndroidRuntime: at org.thoughtcrime.securesms.service.WebRtcCallService.lambda$onStartCommand$0(WebRtcCallService.java:292)
03-07 11:06:26.024 6739 7723 E AndroidRuntime: at org.thoughtcrime.securesms.service.WebRtcCallService.lambda$onStartCommand$0$WebRtcCallService(Unknown Source:0)
03-07 11:06:26.024 6739 7723 E AndroidRuntime: at org.thoughtcrime.securesms.service.-$$Lambda$WebRtcCallService$Yh6A0UG5XRlf3T0gTOG7ZD8M4xo.run(Unknown Source:4)
03-07 11:06:26.024 6739 7723 E AndroidRuntime: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
03-07 11:06:26.024 6739 7723 E AndroidRuntime: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
03-07 11:06:26.024 6739 7723 E AndroidRuntime: at java.lang.Thread.run(Thread.java:923)
03-07 11:06:26.024 6739 7723 E AndroidRuntime: Caused by: android.os.RemoteException: Remote stack trace:
03-07 11:06:26.024 6739 7723 E AndroidRuntime: at android.app.ContextImpl.enforce(ContextImpl.java:2018)
03-07 11:06:26.024 6739 7723 E AndroidRuntime: at android.app.ContextImpl.enforceCallingOrSelfPermission(ContextImpl.java:2046)
03-07 11:06:26.024 6739 7723 E AndroidRuntime: at android.content.ContextWrapper.enforceCallingOrSelfPermission(ContextWrapper.java:851)
03-07 11:06:26.024 6739 7723 E AndroidRuntime: at com.android.server.telecom.TelecomServiceImpl.isDialerOrPrivileged(TelecomServiceImpl.java:2242)
03-07 11:06:26.024 6739 7723 E AndroidRuntime: at com.android.server.telecom.TelecomServiceImpl.access$400(TelecomServiceImpl.java:75)
03-07 11:06:26.024 6739 7723 E AndroidRuntime: