-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Convert PlayerHolder to Singleton; cleanup in VideoDetailFragment; Player/MainPlayer do not call onDestroy() directly #6566
Convert PlayerHolder to Singleton; cleanup in VideoDetailFragment; Player/MainPlayer do not call onDestroy() directly #6566
Conversation
…ually instead use service.stopService() which inturn calls stopSelf() and triggers hopefully onDestroy() to be called. Eventually we have to make sure that all ServiceConnections are closed to successfully stop the service now! Cleanup within stopService() and not only onDestroy() So we make sure that all listeners can react to onServiceStopped() and close their ServiceConnections. Afterwards the android framework is ready to stop the Service.
68ae360
to
dc4443a
Compare
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.
Looks mostly good. Thank you!
I also tested a little bit on API 29 and the player worked flawlessly; I read the logcat logs but found no strage errors, not even on player closing, so I think this changes are ok.
app/src/main/java/org/schabi/newpipe/player/helper/PlayerHolder.java
Outdated
Show resolved
Hide resolved
app/src/main/java/org/schabi/newpipe/player/helper/PlayerHolder.java
Outdated
Show resolved
Hide resolved
app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java
Outdated
Show resolved
Hide resolved
app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java
Outdated
Show resolved
Hide resolved
- code is easier to read - duplication of code reduced
…iceConnection leak - bugfix: have ServiceConnection created only once! - select the context within the PlayerHolder to start, stop, bind or unbind the service -> we have to make sure the Service is started AND stopped within the same context -> so let PlayerHolder be the one to select the context - remove removeListener() and replace the call with setListener(null) - Compatibility: use ContextCompat.startForegroundService instead of startService()
dc4443a
to
48c2c15
Compare
I've merged the changes and updated the pull request |
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 also tested on API 19, everything works fine, thank you :-)
What is it?
Description of the changes in your PR
Fixes the following issue(s)
APK testing
On the website the APK can be found by going to the "Checks" tab below the title and then on "artifacts" on the right.
Due diligence