-
Notifications
You must be signed in to change notification settings - Fork 758
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
#8964 Fix app crash on incoming call when running Android 14+ #8989
Merged
bmarty
merged 3 commits into
element-hq:develop
from
christianrowlands:bugfix/cmr/incoming-call-crash
Feb 4, 2025
+19
−3
Merged
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
36a74f4
#8964 Fix app crash on incoming call when running Android 14+
christianrowlands af906ce
#8964 Start the MicrophoneAccessService during onPause if the call ha…
christianrowlands 2c2f8bd
#8964 Adds a callState null check before starting the MicrophoneAcces…
christianrowlands File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Fix incoming call crash on Android 14+. ([#8964](https://github.com/element-hq/element-android/issues/8964)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but in this block the app is in the foreground (since
isAppInForeground()
returnedtrue
), or am I misreading something?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assumed that too, but when I added logging it indicated the app is in the foreground. I am guessing this is the case because by the time this code is reached the app has been brought to the foreground with an incoming call UI, but because this was not triggered by a user action, it does not matter if the app is in the foreground. Maybe my comment is not the clearest. The app not only needs to be in the foreground, but it must have gotten there via a user interaction (or another exemption path).
As for my comment about creating the microphone foreground service while your app is in the background, it depends on how the activity was triggered. A user interaction with the foreground such as clicking on a UI button or on a notification will allow the microphone to be accessed. However, if the chain is triggered entirely from the background then the exception will occur.
I believe this approach works because now the app does not use the microphone permission until the "answer" button is clicked, which is a user interaction with the UI.
See the documentation here: https://developer.android.com/develop/background-work/services/fgs/restrictions-bg-start#background-start-restriction-exemptions
And the relevant section: