Downloaded tracks can be quite precious when you have lots of them (as
redownloading all of them can be costly in terms of time and money).
This prevents downloaded tracks from being deleted along with your
session.
This must be included in 0.21, so we can safely implement Funkwhale's
new authentication mechanism in 0.22.
As per Android policy and internal logic, we stopped the playback
foreground service when playback was paused. This made our PlayService
elligible for garbage collection by the OS. This had the consequences of
not allowing someone to pause playback and resume it after some time.
Android would always kill the service after around one minute.
This commit, on supported Android version (7.0+) detaches the
notification when stopping the foreground service, leaving the
notification in place even when the service is killed, allowing the user
to resume playback whenever they please.
We also had to move the MediaSession out of the service, for it to
remain alive between service killing and resurrection.
quickly when the app is in the background and *not* playing music. This
had the effect of breaking all player actions within the app (queue
listing, playback control, etc.).
This "starts" PlayerService every time MainActivity is resumed, which is
a noop if the service is still running, but allows retrieving app
functionality otherwise.