diff options
author | Jeff Sharkey <jsharkey@android.com> | 2016-06-24 18:13:22 -0600 |
---|---|---|
committer | Jeff Sharkey <jsharkey@google.com> | 2016-06-25 00:15:03 +0000 |
commit | 3a4a3e7cd5a379e7e757177826ba935f000eb455 (patch) | |
tree | 93eaef8dbbd0885aac8562c37c3e3c0366375a78 /src/com | |
parent | b5ca499c7417fc5954b6914d6d52e6e2c02ce7d8 (diff) | |
download | android_packages_providers_DownloadProvider-3a4a3e7cd5a379e7e757177826ba935f000eb455.tar.gz android_packages_providers_DownloadProvider-3a4a3e7cd5a379e7e757177826ba935f000eb455.tar.bz2 android_packages_providers_DownloadProvider-3a4a3e7cd5a379e7e757177826ba935f000eb455.zip |
Make scanning decisions based on latest data.
When deciding to kick off a media scan of a newly-downloaded file,
use the latest values from InfoDelta, instead of stale values from
the last database read, which may lead us to skip the scan.
Bug: 29234780
Change-Id: I7ffbcdd1edb9965999b7f5f100f57a9c2933f3a5
Diffstat (limited to 'src/com')
-rw-r--r-- | src/com/android/providers/downloads/DownloadInfo.java | 4 | ||||
-rw-r--r-- | src/com/android/providers/downloads/DownloadThread.java | 5 |
2 files changed, 5 insertions, 4 deletions
diff --git a/src/com/android/providers/downloads/DownloadInfo.java b/src/com/android/providers/downloads/DownloadInfo.java index 00a2dd78..c571de4d 100644 --- a/src/com/android/providers/downloads/DownloadInfo.java +++ b/src/com/android/providers/downloads/DownloadInfo.java @@ -448,12 +448,12 @@ public class DownloadInfo { /** * Returns whether a file should be scanned */ - public boolean shouldScanFile() { + public boolean shouldScanFile(int status) { return (mMediaScanned == 0) && (mDestination == Downloads.Impl.DESTINATION_EXTERNAL || mDestination == Downloads.Impl.DESTINATION_FILE_URI || mDestination == Downloads.Impl.DESTINATION_NON_DOWNLOADMANAGER_DOWNLOAD) - && Downloads.Impl.isStatusSuccess(mStatus); + && Downloads.Impl.isStatusSuccess(status); } /** diff --git a/src/com/android/providers/downloads/DownloadThread.java b/src/com/android/providers/downloads/DownloadThread.java index 60a04ff1..40194038 100644 --- a/src/com/android/providers/downloads/DownloadThread.java +++ b/src/com/android/providers/downloads/DownloadThread.java @@ -383,8 +383,9 @@ public class DownloadThread extends Thread { if (Downloads.Impl.isStatusCompleted(mInfoDelta.mStatus)) { mInfo.sendIntentIfRequested(); - if (mInfo.shouldScanFile()) { - DownloadScanner.requestScanBlocking(mContext, mInfo); + if (mInfo.shouldScanFile(mInfoDelta.mStatus)) { + DownloadScanner.requestScanBlocking(mContext, mInfo.mId, mInfoDelta.mFileName, + mInfoDelta.mMimeType); } } else if (mInfoDelta.mStatus == STATUS_WAITING_TO_RETRY || mInfoDelta.mStatus == STATUS_WAITING_FOR_NETWORK |