summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorIvan Chiang <chiangi@google.com>2019-04-16 16:51:52 +0800
committerIvan Chiang <chiangi@google.com>2019-04-16 16:51:52 +0800
commit379aed22aa762b53d0956d0ef5d7dd0282fd412b (patch)
tree12210a985453d43ca48738eb965fa5ea7edf8179 /src
parentbdb81df50276bca029dca22799a25050e081ee89 (diff)
downloadandroid_packages_providers_DownloadProvider-379aed22aa762b53d0956d0ef5d7dd0282fd412b.tar.gz
android_packages_providers_DownloadProvider-379aed22aa762b53d0956d0ef5d7dd0282fd412b.tar.bz2
android_packages_providers_DownloadProvider-379aed22aa762b53d0956d0ef5d7dd0282fd412b.zip
Exclude media files in queryRecentDocuments
Exclude the media files when query recent files from mediastore Change-Id: If9cb87967b4cc21a7b14f1bc10e1a2349d06eb2b Fix: 130233533 Test: manual
Diffstat (limited to 'src')
-rw-r--r--src/com/android/providers/downloads/DownloadStorageProvider.java12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/com/android/providers/downloads/DownloadStorageProvider.java b/src/com/android/providers/downloads/DownloadStorageProvider.java
index 6683b308..042679fa 100644
--- a/src/com/android/providers/downloads/DownloadStorageProvider.java
+++ b/src/com/android/providers/downloads/DownloadStorageProvider.java
@@ -419,9 +419,15 @@ public class DownloadStorageProvider extends FileSystemProvider {
mediaStoreIds, null /* queryArgs */);
}
notificationUris.add(cursor.getNotificationUri());
- includeDownloadsFromMediaStore(result, null /* queryArgs */, mediaStoreIds,
- null /* filePaths */, notificationUris, null /* parentId */,
- (limit - result.getCount()), false /* includePending */);
+
+ // Skip media files that have been inserted into the MediaStore so we
+ // don't duplicate them in the recent list.
+ final Bundle args = new Bundle();
+ args.putBoolean(DocumentsContract.QUERY_ARG_EXCLUDE_MEDIA, true);
+
+ includeDownloadsFromMediaStore(result, args, mediaStoreIds, null /* filePaths */,
+ notificationUris, null /* parentId */, (limit - result.getCount()),
+ false /* includePending */);
} finally {
IoUtils.closeQuietly(cursor);
Binder.restoreCallingIdentity(token);