Commit 94fabd8c authored by Joy Ming's avatar Joy Ming Committed by Commit Bot

Fix bug where notifications for failed downloads are not dismissable.

There was a bug where notifications for failed downloads (specifically
offline pages) were not dismissable on Android O. This is because the
foreground service was accidentally being turned on as the download was
failed, leaving the summary notification pinned to the foreground.

Bug: 776998
Change-Id: I8780e6e0002939bfc186e38d18608a5845bb65a9
Reviewed-on: https://chromium-review.googlesource.com/742486Reviewed-by: default avatarMin Qin <qinmin@chromium.org>
Commit-Queue: Joy Ming <jming@chromium.org>
Cr-Commit-Position: refs/heads/master@{#512978}
parent 11bd4bc9
......@@ -874,7 +874,11 @@ public class DownloadNotificationService extends Service {
public void notifyDownloadCanceled(ContentId id) {
DownloadSharedPreferenceEntry entry =
mDownloadSharedPreferenceHelper.getDownloadSharedPreferenceEntry(id);
if (entry == null) return;
if (entry == null) {
// In case notifyDownloadCanceled was called after the entry has already been removed.
stopTrackingInProgressDownload(id, hasDownloadNotificationsInternal(-1));
return;
}
cancelNotification(entry.notificationId, id);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment