diff options
author | Jeff Sharkey <jsharkey@android.com> | 2016-08-23 15:09:08 -0600 |
---|---|---|
committer | Jeff Sharkey <jsharkey@android.com> | 2016-08-23 15:14:08 -0600 |
commit | efb1ac6b49692e62fde6830c3d20953c8632d2ba (patch) | |
tree | 4e707279f6fde43a062856ad68bc8bc4423598ef /src/com/android/providers/downloads/DownloadThread.java | |
parent | 3b956d36324ce7206bce8b1ec814eec71301fa5d (diff) | |
download | android_packages_providers_DownloadProvider-efb1ac6b49692e62fde6830c3d20953c8632d2ba.tar.gz android_packages_providers_DownloadProvider-efb1ac6b49692e62fde6830c3d20953c8632d2ba.tar.bz2 android_packages_providers_DownloadProvider-efb1ac6b49692e62fde6830c3d20953c8632d2ba.zip |
Send "completed" broadcast if download cancelled.
When a download is deleted, we may not have an active thread, so
always send the broadcast from the provider. If an active thread
encounters a deleted download, skip sending the broadcast twice.
Change-Id: If8d5b99a1b7232bb64c6d11f22fdb4f5d6dbbfec
Test: none
Bug: 30883889
Diffstat (limited to 'src/com/android/providers/downloads/DownloadThread.java')
-rw-r--r-- | src/com/android/providers/downloads/DownloadThread.java | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/com/android/providers/downloads/DownloadThread.java b/src/com/android/providers/downloads/DownloadThread.java index 40194038..33436f57 100644 --- a/src/com/android/providers/downloads/DownloadThread.java +++ b/src/com/android/providers/downloads/DownloadThread.java @@ -382,7 +382,11 @@ public class DownloadThread extends Thread { } if (Downloads.Impl.isStatusCompleted(mInfoDelta.mStatus)) { - mInfo.sendIntentIfRequested(); + // If download was canceled, we already sent requested intent when + // deleted in the provider + if (mInfoDelta.mStatus != STATUS_CANCELED) { + mInfo.sendIntentIfRequested(); + } if (mInfo.shouldScanFile(mInfoDelta.mStatus)) { DownloadScanner.requestScanBlocking(mContext, mInfo.mId, mInfoDelta.mFileName, mInfoDelta.mMimeType); |