From 5bf5cedcfbe27ae6febbc3871fdcc97494d3cfe6 Mon Sep 17 00:00:00 2001 From: Sudheer Shanka Date: Tue, 29 Jan 2019 14:53:58 -0800 Subject: Don't ignore COLUMN_MEDIA_SCANNED values from caller. Right now, DownloadProvider only uses the COLUMN_MEDIA_SCANNED value if it is coming from addCompletedDownload and for the rest of the requests, it ignores the incoming COLUMN_MEDIA_SCANNED value and always invokes mediascanner. This is not what the documentation says. For e.g., if the caller uses DownloadManager.setDestinationUri() API, then unless otherwise specified, the download doesn't need to be mediascanned. Also, since we are inserting user visible downloads to MediaProvider, use that info to populate the COLUMN_MEDIAPROVIDER_URI column as well and update DownloadProvider to not invoke MediaScanner. Bug: 123440050 Test: atest DownloadProviderTests Test: atest cts/tests/app/src/android/app/cts/DownloadManagerTest.java Test: atest cts/tests/tests/provider/src/android/provider/cts/MediaStore* Change-Id: Ia667319a811d502d42a0602581bdc34ed46d88f7 --- src/com/android/providers/downloads/DownloadInfo.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/com/android/providers/downloads/DownloadInfo.java') diff --git a/src/com/android/providers/downloads/DownloadInfo.java b/src/com/android/providers/downloads/DownloadInfo.java index bf9b08bf..a414bd86 100644 --- a/src/com/android/providers/downloads/DownloadInfo.java +++ b/src/com/android/providers/downloads/DownloadInfo.java @@ -447,7 +447,7 @@ public class DownloadInfo { * Returns whether a file should be scanned */ public boolean shouldScanFile(int status) { - return (mMediaScanned == 0) + return (mMediaScanned == Downloads.Impl.MEDIA_NOT_SCANNED) && (mDestination == Downloads.Impl.DESTINATION_EXTERNAL || mDestination == Downloads.Impl.DESTINATION_FILE_URI || mDestination == Downloads.Impl.DESTINATION_NON_DOWNLOADMANAGER_DOWNLOAD) -- cgit v1.2.3