From 68993f233d9c9acd43a20066f411ff3af6515bae Mon Sep 17 00:00:00 2001 From: olly Date: Wed, 10 Apr 2019 15:49:01 +0100 Subject: [PATCH] Improve DownloadNotificationHelper - Remove completed downloads from progress notification. - Treat restarting as a downloading, When there are both remove and download tasks ongoing, we prefer to show a download notification to a remove one. A restarting task encapsulates is basically a (remove+download) task. Given our preference, we should treat it as a download rather than as a removal. PiperOrigin-RevId: 242867228 --- .../android/exoplayer2/ui/DownloadNotificationHelper.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/library/ui/src/main/java/com/google/android/exoplayer2/ui/DownloadNotificationHelper.java b/library/ui/src/main/java/com/google/android/exoplayer2/ui/DownloadNotificationHelper.java index 775dea253f..278cfeca59 100644 --- a/library/ui/src/main/java/com/google/android/exoplayer2/ui/DownloadNotificationHelper.java +++ b/library/ui/src/main/java/com/google/android/exoplayer2/ui/DownloadNotificationHelper.java @@ -64,13 +64,12 @@ public final class DownloadNotificationHelper { boolean haveDownloadTasks = false; boolean haveRemoveTasks = false; for (Download download : downloads) { - if (download.state == Download.STATE_REMOVING - || download.state == Download.STATE_RESTARTING) { + if (download.state == Download.STATE_REMOVING) { haveRemoveTasks = true; continue; } - if (download.state != Download.STATE_DOWNLOADING - && download.state != Download.STATE_COMPLETED) { + if (download.state != Download.STATE_RESTARTING + && download.state != Download.STATE_DOWNLOADING) { continue; } haveDownloadTasks = true;