diff options
author | Jeff Sharkey <jsharkey@android.com> | 2016-03-30 20:31:05 -0600 |
---|---|---|
committer | Jeff Sharkey <jsharkey@android.com> | 2016-03-30 20:31:07 -0600 |
commit | 08fa91badf0b34323c535dde6f8113e16ae94e21 (patch) | |
tree | 3ab7706d6a5480335d4941dd96822c366eb7d795 /src/com/android/providers/downloads/DownloadNotifier.java | |
parent | a071d48ec571dddcfcb01e4d2da2902d8d70e3d2 (diff) | |
download | android_packages_providers_DownloadProvider-08fa91badf0b34323c535dde6f8113e16ae94e21.tar.gz android_packages_providers_DownloadProvider-08fa91badf0b34323c535dde6f8113e16ae94e21.tar.bz2 android_packages_providers_DownloadProvider-08fa91badf0b34323c535dde6f8113e16ae94e21.zip |
Avoid flashing download notifications.
When service starts, use new API to read the current set of
notification tags from the system instead of clearing and starting
from scratch.
Bug: 27634130
Change-Id: I049fe5e445a62a52042d7638c2cb50417977435f
Diffstat (limited to 'src/com/android/providers/downloads/DownloadNotifier.java')
-rw-r--r-- | src/com/android/providers/downloads/DownloadNotifier.java | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/com/android/providers/downloads/DownloadNotifier.java b/src/com/android/providers/downloads/DownloadNotifier.java index 2ff8b634..a03f012c 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()); + } + } + } } /** |