From 9c2ee5a224e470419905be8075113e316dae1f5b Mon Sep 17 00:00:00 2001 From: ibaker Date: Fri, 25 Mar 2022 13:04:51 +0000 Subject: [PATCH] Demo: Move DownloadService calls to new method in SampleChooserActivity This allows the whole startDownloadService() method to be opted into the unstable media3 API in a follow-up change. PiperOrigin-RevId: 437228776 --- .../android/exoplayer2/demo/SampleChooserActivity.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/demos/main/src/main/java/com/google/android/exoplayer2/demo/SampleChooserActivity.java b/demos/main/src/main/java/com/google/android/exoplayer2/demo/SampleChooserActivity.java index 45700891e9..83b94a28db 100644 --- a/demos/main/src/main/java/com/google/android/exoplayer2/demo/SampleChooserActivity.java +++ b/demos/main/src/main/java/com/google/android/exoplayer2/demo/SampleChooserActivity.java @@ -116,8 +116,11 @@ public class SampleChooserActivity extends AppCompatActivity useExtensionRenderers = DemoUtil.useExtensionRenderers(); downloadTracker = DemoUtil.getDownloadTracker(/* context= */ this); loadSample(); + startDownloadService(); + } - // Start the download service if it should be running but it's not currently. + /** Start the download service if it should be running but it's not currently. */ + private void startDownloadService() { // Starting the service in the foreground causes notification flicker if there is no scheduled // action. Starting it in the background throws an exception if the app is in the background too // (e.g. if device screen is locked).