Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4839)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/download/DownloadNotificationService.java

Issue 2296913002: Fix an issue that download progress notification is shown when killing browser (Closed)
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/java/src/org/chromium/chrome/browser/download/DownloadNotificationService.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadNotificationService.java b/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadNotificationService.java
index b1eae15591a407831b1b75b2d5b63101cdef30bf..2f2168522d066b47cbb683b2a576cdad6e1e1677 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadNotificationService.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadNotificationService.java
@@ -82,6 +82,7 @@ public class DownloadNotificationService extends Service {
private Context mContext;
private int mNextNotificationId;
private int mNumAutoResumptionAttemptLeft;
+ private boolean mStopPostingProgressNotifications;
/**
* Class for clients to access.
@@ -94,6 +95,7 @@ public class DownloadNotificationService extends Service {
@Override
public void onTaskRemoved(Intent rootIntent) {
+ mStopPostingProgressNotifications = true;
// This funcion is called when Chrome is swiped away from the recent apps
// drawer. So it doesn't catch all scenarios that chrome can get killed.
// This will only help Android 4.4.2.
@@ -102,6 +104,7 @@ public class DownloadNotificationService extends Service {
@Override
public void onCreate() {
+ mStopPostingProgressNotifications = false;
mContext = getApplicationContext();
mNotificationManager = (NotificationManager) mContext.getSystemService(
Context.NOTIFICATION_SERVICE);
@@ -206,6 +209,7 @@ public class DownloadNotificationService extends Service {
public void notifyDownloadProgress(String downloadGuid, String fileName, int percentage,
long timeRemainingInMillis, long startTime, boolean isOffTheRecord,
boolean canDownloadWhileMetered, boolean isOfflinePage) {
+ if (mStopPostingProgressNotifications) return;
boolean indeterminate = percentage == INVALID_DOWNLOAD_PERCENTAGE;
NotificationCompat.Builder builder = buildNotification(
android.R.drawable.stat_sys_download, fileName, null);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698