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
This commit is contained in:
ibaker 2022-03-25 13:04:51 +00:00 committed by Ian Baker
parent 0f5686fe07
commit dc4dbe6a40

View File

@ -116,8 +116,11 @@ public class SampleChooserActivity extends AppCompatActivity
useExtensionRenderers = DemoUtil.useExtensionRenderers(); useExtensionRenderers = DemoUtil.useExtensionRenderers();
downloadTracker = DemoUtil.getDownloadTracker(/* context= */ this); downloadTracker = DemoUtil.getDownloadTracker(/* context= */ this);
loadSample(); 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 // 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 // action. Starting it in the background throws an exception if the app is in the background too
// (e.g. if device screen is locked). // (e.g. if device screen is locked).