| Index: chrome/android/java/src/org/chromium/chrome/browser/download/DownloadManagerService.java
|
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadManagerService.java b/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadManagerService.java
|
| index dd110a83ca38df459e3ecbfa63c8cb995b71ae63..6babe919f531d7b4b4a8a2488d6c3e2a2c7daeab 100644
|
| --- a/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadManagerService.java
|
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadManagerService.java
|
| @@ -100,7 +100,8 @@ public class DownloadManagerService extends BroadcastReceiver implements
|
| private enum DownloadStatus {
|
| IN_PROGRESS,
|
| COMPLETE,
|
| - FAILED
|
| + FAILED,
|
| + CANCELLED
|
| }
|
|
|
| /**
|
| @@ -275,6 +276,12 @@ public class DownloadManagerService extends BroadcastReceiver implements
|
| scheduleUpdateIfNeeded();
|
| }
|
|
|
| + @Override
|
| + public void onDownloadCancelled(final DownloadInfo downloadInfo) {
|
| + updateDownloadProgress(downloadInfo, DownloadStatus.CANCELLED);
|
| + scheduleUpdateIfNeeded();
|
| + }
|
| +
|
| /**
|
| * Clear any pending notifications for incomplete downloads by reading them from shared prefs.
|
| * When Clank is restarted it clears any old notifications for incomplete downloads.
|
| @@ -514,7 +521,8 @@ public class DownloadManagerService extends BroadcastReceiver implements
|
| *
|
| * @return A map that maps all download info to their corresponding download IDs in the
|
| * download manager and whether the download can be resolved. If a download fails,
|
| - * its download ID is INVALID_DOWNLOAD_ID and the launching intent is null.
|
| + * its download ID is INVALID_DOWNLOAD_ID and the launching intent is null. If a
|
| + * download is cancelled, return an empty map so that no action needs to be taken.
|
| */
|
| private Map<DownloadInfo, Pair<Long, Boolean>> updateAllNotifications() {
|
| assert !ThreadUtils.runningOnUiThread();
|
| @@ -553,6 +561,11 @@ public class DownloadManagerService extends BroadcastReceiver implements
|
| case IN_PROGRESS:
|
| mDownloadNotifier.notifyDownloadProgress(progress.mDownloadInfo,
|
| progress.mStartTimeInMillis);
|
| + break;
|
| + case CANCELLED:
|
| + removeProgressNotificationForDownload(
|
| + progress.mDownloadInfo.getDownloadId());
|
| + break;
|
| }
|
| }
|
| }
|
|
|