jitsi / jitsi-meet

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.
https://jitsi.org/meet
Apache License 2.0
23.07k stars 6.7k forks source link

App crashes upon joining a Room while the Mic Permission is NotAllowed #15194

Open HaythemMejerbi opened 4 days ago

HaythemMejerbi commented 4 days ago

What happened?

Steps to reproduce:

1- User opens Jitsi room link 2- Clicks on Don't Allow from the Allow Agnet to Record Audio Permission pop up 3- Clicks on Join Meeting

Platform

Browser / app / sdk version

8.6.1 | 10.2.1

Relevant log output

TAGS=release-keys
java.lang.RuntimeException: Unable to create service org.jitsi.meet.sdk.JitsiMeetOngoingConferenceService: java.lang.SecurityException: Starting FGS with type microphone callerApp=ProcessRecord{d06ca24 14426:com.teamontherun.preprod/u0a504} targetSDK=34 requires permissions: all of the permissions allOf=true [android.permission.FOREGROUND_SERVICE_MICROPHONE] any of the permissions allOf=false [android.permission.CAPTURE_AUDIO_HOTWORD, android.permission.CAPTURE_AUDIO_OUTPUT, android.permission.CAPTURE_MEDIA_OUTPUT, android.permission.CAPTURE_TUNER_AUDIO_INPUT, android.permission.CAPTURE_VOICE_COMMUNICATION_OUTPUT, android.permission.RECORD_AUDIO]  and the app must be in the eligible state/exemptions to access the foreground only permission
    at android.app.ActivityThread.handleCreateService(ActivityThread.java:5111)
    at android.app.ActivityThread.-$$Nest$mhandleCreateService(Unknown Source:0)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2506)
    at android.os.Handler.dispatchMessage(Handler.java:106)
    at android.os.Looper.loopOnce(Looper.java:230)
    at android.os.Looper.loop(Looper.java:319)
    at android.app.ActivityThread.main(ActivityThread.java:8919)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:578)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1103)
Caused by: java.lang.SecurityException: Starting FGS with type microphone callerApp=ProcessRecord{d06ca24 14426:com.teamontherun.preprod/u0a504} targetSDK=34 requires permissions: all of the permissions allOf=true [android.permission.FOREGROUND_SERVICE_MICROPHONE] any of the permissions allOf=false [android.permission.CAPTURE_AUDIO_HOTWORD, android.permission.CAPTURE_AUDIO_OUTPUT, android.permission.CAPTURE_MEDIA_OUTPUT, android.permission.CAPTURE_TUNER_AUDIO_INPUT, android.permission.CAPTURE_VOICE_COMMUNICATION_OUTPUT, android.permission.RECORD_AUDIO]  and the app must be in the eligible state/exemptions to access the foreground only permission
    at android.os.Parcel.createExceptionOrNull(Parcel.java:3069)
    at android.os.Parcel.createException(Parcel.java:3053)
    at android.os.Parcel.readException(Parcel.java:3036)
    at android.os.Parcel.readException(Parcel.java:2978)
    at android.app.IActivityManager$Stub$Proxy.setServiceForeground(IActivityManager.java:7234)
    at android.app.Service.startForeground(Service.java:775)
    at org.jitsi.meet.sdk.JitsiMeetOngoingConferenceService.onCreate(SourceFile:37)
    at android.app.ActivityThread.handleCreateService(ActivityThread.java:5098)
    ... 9 more
Caused by: android.os.RemoteException: Remote stack trace:
    at com.android.server.am.ActiveServices.validateForegroundServiceType(ActiveServices.java:2741)
    at com.android.server.am.ActiveServices.setServiceForegroundInnerLocked(ActiveServices.java:2452)
    at com.android.server.am.ActiveServices.setServiceForegroundLocked(ActiveServices.java:1797)
    at com.android.server.am.ActivityManagerService.setServiceForeground(ActivityManagerService.java:15948)
    at android.app.IActivityManager$Stub.onTransact$setServiceForeground$(IActivityManager.java:11974)

java.lang.SecurityException: Starting FGS with type microphone callerApp=ProcessRecord{d06ca24 14426:com.teamontherun.preprod/u0a504} targetSDK=34 requires permissions: all of the permissions allOf=true [android.permission.FOREGROUND_SERVICE_MICROPHONE] any of the permissions allOf=false [android.permission.CAPTURE_AUDIO_HOTWORD, android.permission.CAPTURE_AUDIO_OUTPUT, android.permission.CAPTURE_MEDIA_OUTPUT, android.permission.CAPTURE_TUNER_AUDIO_INPUT, android.permission.CAPTURE_VOICE_COMMUNICATION_OUTPUT, android.permission.RECORD_AUDIO]  and the app must be in the eligible state/exemptions to access the foreground only permission
    at android.os.Parcel.createExceptionOrNull(Parcel.java:3069)
    at android.os.Parcel.createException(Parcel.java:3053)
    at android.os.Parcel.readException(Parcel.java:3036)
    at android.os.Parcel.readException(Parcel.java:2978)
    at android.app.IActivityManager$Stub$Proxy.setServiceForeground(IActivityManager.java:7234)
    at android.app.Service.startForeground(Service.java:775)
    at org.jitsi.meet.sdk.JitsiMeetOngoingConferenceService.onCreate(SourceFile:37)
    at android.app.ActivityThread.handleCreateService(ActivityThread.java:5098)
    at android.app.ActivityThread.-$$Nest$mhandleCreateService(Unknown Source:0)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2506)
    at android.os.Handler.dispatchMessage(Handler.java:106)
    at android.os.Looper.loopOnce(Looper.java:230)
    at android.os.Looper.loop(Looper.java:319)
    at android.app.ActivityThread.main(ActivityThread.java:8919)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:578)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1103)
Caused by: android.os.RemoteException: Remote stack trace:
    at com.android.server.am.ActiveServices.validateForegroundServiceType(ActiveServices.java:2741)
    at com.android.server.am.ActiveServices.setServiceForegroundInnerLocked(ActiveServices.java:2452)
    at com.android.server.am.ActiveServices.setServiceForegroundLocked(ActiveServices.java:1797)
    at com.android.server.am.ActivityManagerService.setServiceForeground(ActivityManagerService.java:15948)
    at android.app.IActivityManager$Stub.onTransact$setServiceForeground$(IActivityManager.java:11974)

android.os.RemoteException: Remote stack trace:
    at com.android.server.am.ActiveServices.validateForegroundServiceType(ActiveServices.java:2741)
    at com.android.server.am.ActiveServices.setServiceForegroundInnerLocked(ActiveServices.java:2452)
    at com.android.server.am.ActiveServices.setServiceForegroundLocked(ActiveServices.java:1797)
    at com.android.server.am.ActivityManagerService.setServiceForeground(ActivityManagerService.java:15948)
    at android.app.IActivityManager$Stub.onTransact$setServiceForeground$(IActivityManager.java:11974)

Reproducibility

More details?

The issue is occurring on the Android 14 OS version. The scenario has been tested on Android 13, but it is not reproducible.

SakkyOP commented 1 day ago

This seems like an exception handling issue, newer version of Android ( after Android 13 ( API level 34 ) ), apps that start a foreground service and intend to use the microphone must have explicit permissions to do so, such as android.permission.FOREGROUND_SERVICE_MICROPHONE.

Looks like the current version of the app fails to gracefully handle the denial of permissions ( I need to look at the codebase before confirming ), this is just an insight that I get from looking at the issue.