MediaSessionLegacyStub.java
48.2 KB
-
Catch FgSStartNotAllowedException when playback resumes · 0d0cd786
This fix applies to Android 12 and above. In this fix, the `MediaSessionService` will try to start in the foreground before the session playback resumes, if ForegroundServiceStartNotAllowedException is thrown, then the app can handle the exception with their customized implementation of MediaSessionService.Listener.onForegroundServiceStartNotAllowedException. If no exception thrown, the a media notification corresponding to paused state will be sent as the consequence of successfully starting in the foreground. And when the player actually resumes, another media notification corresponding to playing state will be sent. PiperOrigin-RevId: 501803930
tianyifeng committed