diff options
author | Jeff Sharkey <jsharkey@android.com> | 2016-05-26 10:35:18 -0600 |
---|---|---|
committer | Jeff Sharkey <jsharkey@android.com> | 2016-05-26 10:35:19 -0600 |
commit | 2a34a9359dc199e98a45275a22027b5c367933a6 (patch) | |
tree | 4f18dba56823b28f9610bea03c6efb7469411b98 /src/com/android/providers | |
parent | 5f97d54345d948a11bcefe1765864738f6dc30d4 (diff) | |
download | android_packages_providers_DownloadProvider-2a34a9359dc199e98a45275a22027b5c367933a6.tar.gz android_packages_providers_DownloadProvider-2a34a9359dc199e98a45275a22027b5c367933a6.tar.bz2 android_packages_providers_DownloadProvider-2a34a9359dc199e98a45275a22027b5c367933a6.zip |
Only show queued notification when "visible."
Otherwise it's confusing to see notifications for downloads that
are otherwise invisible.
Bug: 28623639
Change-Id: I1b2aeccfcca1369f66c56c441dfef68ee95c6d62
Diffstat (limited to 'src/com/android/providers')
-rw-r--r-- | src/com/android/providers/downloads/DownloadNotifier.java | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/com/android/providers/downloads/DownloadNotifier.java b/src/com/android/providers/downloads/DownloadNotifier.java index 558393d6..d5808690 100644 --- a/src/com/android/providers/downloads/DownloadNotifier.java +++ b/src/com/android/providers/downloads/DownloadNotifier.java @@ -19,6 +19,7 @@ package com.android.providers.downloads; import static android.app.DownloadManager.Request.VISIBILITY_VISIBLE; import static android.app.DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED; import static android.app.DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_ONLY_COMPLETION; +import static android.provider.Downloads.Impl.STATUS_QUEUED_FOR_WIFI; import static android.provider.Downloads.Impl.STATUS_RUNNING; import static com.android.providers.downloads.Constants.TAG; @@ -411,7 +412,7 @@ public class DownloadNotifier { final int visibility = cursor.getInt(UpdateQuery.VISIBILITY); final String notifPackage = cursor.getString(UpdateQuery.NOTIFICATION_PACKAGE); - if (status == Downloads.Impl.STATUS_QUEUED_FOR_WIFI) { + if (isQueuedAndVisible(status, visibility)) { return TYPE_WAITING + ":" + notifPackage; } else if (isActiveAndVisible(status, visibility)) { return TYPE_ACTIVE + ":" + notifPackage; @@ -431,6 +432,12 @@ public class DownloadNotifier { return Integer.parseInt(tag.substring(0, tag.indexOf(':'))); } + private static boolean isQueuedAndVisible(int status, int visibility) { + return status == STATUS_QUEUED_FOR_WIFI && + (visibility == VISIBILITY_VISIBLE + || visibility == VISIBILITY_VISIBLE_NOTIFY_COMPLETED); + } + private static boolean isActiveAndVisible(int status, int visibility) { return status == STATUS_RUNNING && (visibility == VISIBILITY_VISIBLE |