Commit a720380e by olly Committed by Oliver Woodman

Update DownloadService for Android 12

- If DownloadService is configured to run as a foreground service,
  it will remain started and in the foreground when downloads are
  waiting for requirements to be met, with a suitable "waiting for
  XYZ" message in the notification. This is necessary because new
  foreground service restrictions in Android 12 prevent to service
  from being restarted from the background.
- Cases where requirements are not supported by the Scheduler will
  be handled in the same way, even on earlier versions of Android.
  So will cases where a Scheduler is not provided.
- The Scheduler will still be used on earlier versions of Android
  where possible.

Note: We could technically continue to use the old behavior on
Android 12 in cases where the containing application still has a
targetSdkVersion corresponding to Android 11 or earlier. However,
in practice, there seems to be little value in doing this.
PiperOrigin-RevId: 398720114
parent fecb8b7e
...@@ -14,6 +14,10 @@ ...@@ -14,6 +14,10 @@
* Move `Player.addListener(EventListener)` and * Move `Player.addListener(EventListener)` and
`Player.removeListener(EventListener)` out of `Player` into subclasses. `Player.removeListener(EventListener)` out of `Player` into subclasses.
* Android 12 compatibility: * Android 12 compatibility:
* Keep `DownloadService` started and in the foreground whilst waiting for
requirements to be met on Android 12. This is necessary due to new
[foreground service launch restrictions](https://developer.android.com/about/versions/12/foreground-services).
`DownloadService.getScheduler` will not be called on Android 12 devices.
* Disable platform transcoding when playing content URIs on Android 12. * Disable platform transcoding when playing content URIs on Android 12.
* Add `ExoPlayer.setVideoChangeFrameRateStrategy` to allow disabling of * Add `ExoPlayer.setVideoChangeFrameRateStrategy` to allow disabling of
calls from the player to `Surface.setFrameRate`. This is useful for calls from the player to `Surface.setFrameRate`. This is useful for
...@@ -23,6 +27,14 @@ ...@@ -23,6 +27,14 @@
* `SubtitleView` no longer implements `TextOutput`. `SubtitleView` * `SubtitleView` no longer implements `TextOutput`. `SubtitleView`
implements `Player.Listener`, so can be registered to a player with implements `Player.Listener`, so can be registered to a player with
`Player.addListener`. `Player.addListener`.
* Downloads and caching:
* Modify `DownloadService` behavior when `DownloadService.getScheduler`
returns `null`, or returns a `Scheduler` that does not support the
requirements for downloads to continue. In both cases, `DownloadService`
will now remain started and in the foreground whilst waiting for
requirements to be met.
* Modify `DownlaodService` behavior when running on Android 12 and above.
See the "Android 12 compatibility" section above.
* RTSP: * RTSP:
* Support RFC4566 SDP attribute field grammar * Support RFC4566 SDP attribute field grammar
([#9430](https://github.com/google/ExoPlayer/issues/9430)). ([#9430](https://github.com/google/ExoPlayer/issues/9430)).
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment