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

[Bugfix] Fix microphone loss during background voice calls on Android 14 #8914

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

amitshilo11
Copy link

@amitshilo11 amitshilo11 commented Sep 20, 2024

Implemented a microphone access service to ensure uninterrupted microphone usage during voice calls, even when the app is running in the background.

Left photo represent when the call is in the background, and right when the app is open (no change in this case).
Screenshot_20240920_153509Screenshot_2
0240920_153721

Type of change

  • Feature
  • Bugfix
  • Technical
  • Other :

Content

This pull request fixes a bug where the app loses microphone access when it goes into the background during a voice call. The issue has been resolved by ensuring that microphone access is maintained during background operations and that the microphone service continues running as needed.

Motivation and context

Issue: App loses microphone access when not active on v 1.6.20 #8881

Steps to reproduce:

  1. Start a voice call.
  2. Click the Home button or switch to another app.

Expected outcome:
The conversation should continue without interruptions, and the app should maintain access to the microphone even when switching to other apps or locking the phone.

Actual outcome:
The other party cannot hear the user because the app loses access to the microphone, which is indicated by the disappearance of the green dot on Samsung S24 devices.

Operating system: Android 14
App version: Element 1.6.20 (Google Play Store)

Screenshots / GIFs

Tests

  • Step 1: Reproduce the issue by placing a voice call and switching to another app.
  • Step 2: Confirm that the microphone service continues to run and maintains access to the microphone after switching to the background.
  • Step 3: Test that the microphone is properly stopped when the call is ended.
  • Step 4: Ensure that the app works as expected on different devices with Android 14 and Android 12.

Tested devices

  • Physical
  • Emulator
  • OS version(s): Android 14, Android 12

Checklist

@bro2020
Copy link
Contributor

bro2020 commented Sep 21, 2024

@bmarty It is very important to check this as soon as possible and release a new version of the application.

Copy link
Member

@bmarty bmarty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR.

Only one remark at first sight.

Also, can you add a sign off to the PR please, so I can merge it?

android:foregroundServiceType="microphone"
android:permission="android.permission.FOREGROUND_SERVICE_MICROPHONE">
</service>

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you need to declare the permission as well. You can add around line 56:

    <!-- For MicrophoneAccessService -->
    <uses-permission android:name="android.permission.FOREGROUND_SERVICE_MICROPHONE" />

It is working since this permission comes with the Jitsi library, but better to explicitely add it in our manifest.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did it and pushed, tell me if there is any more comments of improvement that need to be done :)

@CLAassistant
Copy link

CLAassistant commented Sep 25, 2024

CLA assistant check
All committers have signed the CLA.

@amitshilo11 amitshilo11 force-pushed the bugfix/microphone-access-loss-on-background-8881 branch from fc05d99 to 53387e6 Compare September 26, 2024 07:17
@bro2020
Copy link
Contributor

bro2020 commented Oct 2, 2024

@bmarty Will this fix make it into the next release?

@amitshilo11
Copy link
Author

i fixed one bug that i found, it was a crash when getting incoming call from lock screen.
i want over all the edge cases now, seems stable to me.

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.

4 participants