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
This commit is contained in:
olly 2019-04-10 15:49:01 +01:00 committed by Oliver Woodman
parent c830c8dc63
commit 68993f233d

View file

@ -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;