summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/com/android/providers/downloads/DownloadNotifier.java15
-rw-r--r--src/com/android/providers/downloads/DownloadService.java2
2 files changed, 14 insertions, 3 deletions
diff --git a/src/com/android/providers/downloads/DownloadNotifier.java b/src/com/android/providers/downloads/DownloadNotifier.java
index 2ff8b63..a03f012 100644
--- a/src/com/android/providers/downloads/DownloadNotifier.java
+++ b/src/com/android/providers/downloads/DownloadNotifier.java
@@ -33,11 +33,14 @@ import android.content.res.Resources;
import android.net.Uri;
import android.os.SystemClock;
import android.provider.Downloads;
+import android.service.notification.StatusBarNotification;
import android.text.TextUtils;
import android.text.format.DateUtils;
import android.util.Log;
import android.util.LongSparseLongArray;
+import com.android.internal.util.ArrayUtils;
+
import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.Maps;
import com.google.common.collect.Multimap;
@@ -92,8 +95,16 @@ public class DownloadNotifier {
Context.NOTIFICATION_SERVICE);
}
- public void cancelAll() {
- mNotifManager.cancelAll();
+ public void init() {
+ synchronized (mActiveNotifs) {
+ mActiveNotifs.clear();
+ final StatusBarNotification[] notifs = mNotifManager.getActiveNotifications();
+ if (!ArrayUtils.isEmpty(notifs)) {
+ for (StatusBarNotification notif : notifs) {
+ mActiveNotifs.put(notif.getTag(), notif.getPostTime());
+ }
+ }
+ }
}
/**
diff --git a/src/com/android/providers/downloads/DownloadService.java b/src/com/android/providers/downloads/DownloadService.java
index 7845ce0..7d4392e 100644
--- a/src/com/android/providers/downloads/DownloadService.java
+++ b/src/com/android/providers/downloads/DownloadService.java
@@ -211,7 +211,7 @@ public class DownloadService extends Service {
mScanner = new DownloadScanner(this);
mNotifier = new DownloadNotifier(this);
- mNotifier.cancelAll();
+ mNotifier.init();
mObserver = new DownloadManagerContentObserver();
getContentResolver().registerContentObserver(Downloads.Impl.ALL_DOWNLOADS_CONTENT_URI,