diff options
author | Jeff Sharkey <jsharkey@android.com> | 2016-04-28 15:33:38 -0600 |
---|---|---|
committer | Jeff Sharkey <jsharkey@android.com> | 2016-04-29 12:30:02 -0600 |
commit | b3597b9d2fdde31bb0a8af821e3da3ca786e277b (patch) | |
tree | 375cd055478b96d305856e72b222e795decc1309 /src/com/android/providers/downloads/DownloadInfo.java | |
parent | 67db99b0fc55846a4fa6d4a134a0533426428e7f (diff) | |
download | android_packages_providers_DownloadProvider-b3597b9d2fdde31bb0a8af821e3da3ca786e277b.tar.gz android_packages_providers_DownloadProvider-b3597b9d2fdde31bb0a8af821e3da3ca786e277b.tar.bz2 android_packages_providers_DownloadProvider-b3597b9d2fdde31bb0a8af821e3da3ca786e277b.zip |
Visible downloads should run while blocked/dozing.
Downloads with visible notifications should behave as if the
requesting app was running a foreground service. The easiest way
to implement this for now is to ignore any BLOCKED network status
and use the new setWillBeForeground() API so job scheduling ignores
any active blocked/dozing status.
Bug: 26571724
Change-Id: I8ea2b2a7cdb5f469adc11b4d897ff55bd8a9db9a
Diffstat (limited to 'src/com/android/providers/downloads/DownloadInfo.java')
-rw-r--r-- | src/com/android/providers/downloads/DownloadInfo.java | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/com/android/providers/downloads/DownloadInfo.java b/src/com/android/providers/downloads/DownloadInfo.java index c94dd6c2..8996eded 100644 --- a/src/com/android/providers/downloads/DownloadInfo.java +++ b/src/com/android/providers/downloads/DownloadInfo.java @@ -16,6 +16,9 @@ package com.android.providers.downloads; +import static android.provider.Downloads.Impl.VISIBILITY_VISIBLE; +import static android.provider.Downloads.Impl.VISIBILITY_VISIBLE_NOTIFY_COMPLETED; + import static com.android.providers.downloads.Constants.TAG; import android.app.DownloadManager; @@ -247,6 +250,19 @@ public class DownloadInfo { } /** + * Return if this download is visible to the user while running. + */ + public boolean isVisible() { + switch (mVisibility) { + case VISIBILITY_VISIBLE: + case VISIBILITY_VISIBLE_NOTIFY_COMPLETED: + return true; + default: + return false; + } + } + + /** * Add random fuzz to the given delay so it's anywhere between 1-1.5x the * requested delay. */ |