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

fix: keep OngoingCallService always running during call [WPB-10467] 🍒 #3302

Merged

Conversation

github-actions[bot]
Copy link
Contributor

@github-actions github-actions bot commented Aug 8, 2024

BugWPB-10467 [Android] crash after a call

This PR was automatically cherry-picked based on the following PR:

Original PR description:



PR Submission Checklist for internal contributors

  • The PR Title

    • conforms to the style of semantic commits messages¹ supported in Wire's Github Workflow²
    • contains a reference JIRA issue number like SQPIT-764
    • answers the question: If merged, this PR will: ... ³
  • The PR Description

    • is free of optional paragraphs and you have filled the relevant parts to the best of your ability

What's new in this PR?

Issues

There are some ForegroundServiceStartNotAllowedException crashes.

Causes (Optional)

This exception happens when when trying to start foreground service while the app is not allowed to do so, like when the app is considered to be in the background. More on that here: https://developer.android.com/develop/background-work/services/foreground-services#bg-access-restrictions
Sometimes the onStop event is emitted with some delay, we can't really make sure that the app will fit within the allowed time, it's not clear how the system determines whether the app is still able to start foreground service or not.

Solutions

Instead of starting the OngoingCallService only when the app goes into background, start it always when there's a new ongoing call and keep it running until it ends, so that the service is not stopped and started again when user puts app into foreground and background, so it's way less error-prone, and in that case starting foreground service should always be allowed because it happens right when the user makes an action to start or answer the call.
We actually already have that logic for Android 14 upwards, because of the microphone background restrictions, so another benefit of this change is that we will have that unified for all Android versions.

Testing

Test Coverage (Optional)

  • I have added automated test to this contribution

How to Test

Create or join a call, the notification about ongoing call indicating that the OngoingCallService is running should be visible during the entire call, no matter if the app is in the background or foreground and it shouldn't crash when putting the app into background during the call.


PR Post Submission Checklist for internal contributors (Optional)

  • Wire's Github Workflow has automatically linked the PR to a JIRA issue

PR Post Merge Checklist for internal contributors

  • If any soft of configuration variable was introduced by this PR, it has been added to the relevant documents and the CI jobs have been updated.

References
  1. https://sparkbox.com/foundry/semantic_commit_messages
  2. https://github.com/wireapp/.github#usage
  3. E.g. feat(conversation-list): Sort conversations by most emojis in the title #SQPIT-764.

@github-actions github-actions bot added cherry-pick PR is cherry-picking changes from another banch echoes: unplanned Any work item that isn’t part of the product or technical roadmap. size/S labels Aug 8, 2024
@saleniuk saleniuk requested review from a team, typfel, yamilmedina, MohamadJaara, vitorhugods and Garzas and removed request for a team August 8, 2024 15:48
@saleniuk saleniuk enabled auto-merge August 8, 2024 15:48
Copy link

sonarqubecloud bot commented Aug 8, 2024

@codecov-commenter
Copy link

codecov-commenter commented Aug 8, 2024

Codecov Report

Attention: Patch coverage is 88.88889% with 1 line in your changes missing coverage. Please review.

Project coverage is 44.42%. Comparing base (cdab6d0) to head (a3c9d92).

Files Patch % Lines
...re/android/notification/WireNotificationManager.kt 88.88% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #3302      +/-   ##
===========================================
- Coverage    44.42%   44.42%   -0.01%     
===========================================
  Files          453      453              
  Lines        15308    15299       -9     
  Branches      2558     2557       -1     
===========================================
- Hits          6801     6797       -4     
+ Misses        7791     7787       -4     
+ Partials       716      715       -1     
Files Coverage Δ
...re/android/notification/CallNotificationManager.kt 44.91% <ø> (ø)
...re/android/notification/WireNotificationManager.kt 81.15% <88.88%> (+1.52%) ⬆️

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update cdab6d0...a3c9d92. Read the comment docs.

Copy link
Contributor Author

github-actions bot commented Aug 8, 2024

Built wire-android-staging-compat-pr-3302.apk is available for download

Copy link
Contributor Author

github-actions bot commented Aug 8, 2024

Built wire-android-dev-debug-pr-3302.apk is available for download

@saleniuk saleniuk added this pull request to the merge queue Aug 9, 2024
Merged via the queue into develop with commit ee3e89e Aug 9, 2024
12 checks passed
@saleniuk saleniuk deleted the fix/keep-service-always-running-during-call-cherry-pick branch August 9, 2024 08:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cherry-pick PR is cherry-picking changes from another banch echoes: unplanned Any work item that isn’t part of the product or technical roadmap. size/S
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants