
This API additions help an app to implement the lifecycle of a MediaSessionService properly and in consistency with the `MediaSessionService` being in the foreground or not. Not properly implementing `onTaskRemoved` is the main reason for crashes and confusion. This change provides `MediaSessionService` with a default implementation that avoids crashes of the service. This default implementation uses the new API provided with this change just as an app can do. Issue: androidx/media#1219 PiperOrigin-RevId: 621874838
Demo MediaLibraryService
implementation
A library module with a demo implementation of MediaLibraryService
and
MediaLibrarySession.Callback
.
See the PlaybackService
of the session demo how to use
it. Override assets/cataglog.json
by creating such a file in the same format
in your application module that the service will use.