Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check permissions in hasPhoneAccount #556

Merged
merged 1 commit into from
Apr 15, 2022

Conversation

geraintwhite
Copy link
Contributor

Fixes crash on Samsung devices when the phone call permission is not granted.

Steps to reproduce:

  1. install app
  2. deny phone calls permission when asked
  3. call hasPhoneAccount
Exception in native call
java.lang.SecurityException: Neither user 10284 nor current process has android.permission.READ_PHONE_NUMBERS.
	at android.os.Parcel.createExceptionOrNull(Parcel.java:2437)
	at android.os.Parcel.createException(Parcel.java:2421)
	at android.os.Parcel.readException(Parcel.java:2404)
	at android.os.Parcel.readException(Parcel.java:2346)
	at com.android.internal.telecom.ITelecomService$Stub$Proxy.getPhoneAccount(ITelecomService.java:1926)
	at android.telecom.TelecomManager.getPhoneAccount(TelecomManager.java:1483)
	at io.wazo.callkeep.RNCallKeepModule.hasPhoneAccount(RNCallKeepModule.java:962)
	at io.wazo.callkeep.RNCallKeepModule.hasPhoneAccount(RNCallKeepModule.java:747)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:372)
	at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:188)
	at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
	at android.os.Handler.handleCallback(Handler.java:938)
	at android.os.Handler.dispatchMessage(Handler.java:99)
	at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:27)
	at android.os.Looper.loopOnce(Looper.java:226)
	at android.os.Looper.loop(Looper.java:313)
	at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:226)
	at java.lang.Thread.run(Thread.java:920)
Caused by: android.os.RemoteException: Remote stack trace:
	at android.app.ContextImpl.enforce(ContextImpl.java:2273)
	at android.app.ContextImpl.enforceCallingOrSelfPermission(ContextImpl.java:2301)
	at android.content.ContextWrapper.enforceCallingOrSelfPermission(ContextWrapper.java:922)
	at com.android.server.telecom.TelecomServiceImpl.canGetPhoneAccount(TelecomServiceImpl.java:2580)
	at com.android.server.telecom.TelecomServiceImpl.access$1100(TelecomServiceImpl.java:95)

image

Fixes crash on Samsung devices when the phone call permission is not granted
@manuquentin manuquentin merged commit 09b533a into react-native-webrtc:master Apr 15, 2022
@yotamishak
Copy link
Contributor

this fix breaks receiving calls from the background...
in hasPhoneAccount, in order to check permissions, there must be a current react activity which is not always the case.

In my opinion runtime permissions should be handled by the app itself and not the callkeep library

@geraintwhite
Copy link
Contributor Author

@yotamishak does #576 fix this?

@yotamishak
Copy link
Contributor

@yotamishak does #576 fix this?

Yes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants