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

Restore player service start handling before player UI separation and fix some issues in this service #10578

Merged

Conversation

AudricV
Copy link
Member

@AudricV AudricV commented Nov 15, 2023

What is it?

  • Bugfix (user facing)

Description of the changes in your PR

This PR restores the player service start handling before player UI separation, shipped with 0.24.0. This handling avoided crashes about the service service not starting in the foreground, in time or not at all (so crashes for which their exception contained Context.startForegroundService() did not then call Service.startForeground()). See #9358 (comment) for more details.

This PR also adds some player nullability checks, and the player service is now stopped when it has been started from a media button and there is nothing to play, which should avoid empty player notifications with the previous behavior.

A proper and better player code and architecture is required in order to solve this player service issue in the good way, which must be made in the upcoming app rewrite.

Fixes the following issue(s)

Although this PR should fixes these issues, there is a chance, thanks to the current bad player code, that it may not fix them entirely; if so, it should mitigate them a lot.

APK testing

The APK can be found by going to the "Checks" tab below the title. On the left pane, click on "CI", scroll down to "artifacts" and click "app" to download the zip file which contains the debug APK of this PR. You can find more info and a video demonstration on this wiki page.

Due diligence

@AudricV AudricV added bug Issue is related to a bug player Issues related to any player (main, popup and background) player notification Anything to do with the MediaStyle notification labels Nov 15, 2023
This behavior was present before 0.24.0 and the player UI separation and
avoided crashes for which their exception contained
"Context.startForegroundService() did not then call Service.startForeground()".

Some player nullability checks have been also added, and the player service is
now stopped when it has been started from a media button and there is nothing
to play.
@AudricV AudricV force-pushed the try-fix-player-service-foreground-start branch from 69e1e7d to 84d50da Compare November 15, 2023 22:21
Copy link

sonarcloud bot commented Nov 15, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

0.0% 0.0% Coverage
0.0% 0.0% Duplication

Copy link
Member

@Stypox Stypox left a comment

Choose a reason for hiding this comment

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

Code looks good to me. I tested on my phone (API 32) and on some emulators (API 27, API 33), both in debug and in release mode, and did not encounter any issue. Thank you for fixing this longstanding bug! :-D

@Stypox Stypox merged commit e8ed18f into TeamNewPipe:dev Nov 16, 2023
8 of 9 checks passed
@AudricV AudricV deleted the try-fix-player-service-foreground-start branch November 16, 2023 08:21
@opusforlife2
Copy link
Collaborator

I'm so looking forward to not being nagged by my friends about this. Is there any scope of this being backported to the current RC for a quicker turnaround? It's a pretty widespread set of bugs, after all.

@Stypox
Copy link
Member

Stypox commented Nov 16, 2023

Yes this is going in the current RC as soon as I get to it

@Stypox Stypox mentioned this pull request Nov 16, 2023
21 tasks
@Stypox Stypox mentioned this pull request Dec 13, 2023
6 tasks
@AudricV AudricV mentioned this pull request Feb 8, 2024
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue is related to a bug player notification Anything to do with the MediaStyle notification player Issues related to any player (main, popup and background)
Projects
None yet
3 participants