summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Sharkey <jsharkey@android.com>2016-05-26 21:09:55 +0000
committerandroid-build-merger <android-build-merger@google.com>2016-05-26 21:09:55 +0000
commitfbcaac0bc928a7e8d050093829f903c06ef2bb64 (patch)
tree306ef5e2cee85fdde5b96be3db29ff22804a2f50
parent02fb4d19e2cc080b81bfea21670a04b260cf2b91 (diff)
parent2a34a9359dc199e98a45275a22027b5c367933a6 (diff)
downloadandroid_packages_providers_DownloadProvider-fbcaac0bc928a7e8d050093829f903c06ef2bb64.tar.gz
android_packages_providers_DownloadProvider-fbcaac0bc928a7e8d050093829f903c06ef2bb64.tar.bz2
android_packages_providers_DownloadProvider-fbcaac0bc928a7e8d050093829f903c06ef2bb64.zip
Only show queued notification when "visible."
am: 2a34a9359d * commit '2a34a9359dc199e98a45275a22027b5c367933a6': Only show queued notification when "visible." Change-Id: Id08020ee5514fe8e69276a03ea977b09811d905d
-rw-r--r--src/com/android/providers/downloads/DownloadNotifier.java9
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