diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2023-12-15 02:48:05 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2023-12-15 02:48:05 +0000 |
commit | b0c65e500c9cb590f9f14407a71baa8813db4940 (patch) | |
tree | c72ef578e141b4f5598dd3cf16b2b2ed7d89198c | |
parent | ff748e6fb0e709afbb1b609680d5b6cd90fc9388 (diff) | |
parent | 8afc209bc76c69b5c284e2b9cb46d7a97c05e126 (diff) | |
download | DownloadProvider-android14-qpr1-release.tar.gz |
Merge cherrypicks of ['googleplex-android-review.googlesource.com/25101135'] into udc-qpr1-release.android-14.0.0_r27android-14.0.0_r26android-14.0.0_r25android-14.0.0_r24android-14.0.0_r23android-14.0.0_r22android14-qpr1-release
Change-Id: I15507cc6f25a5881b9fb00af4fce20bb0afea624
-rw-r--r-- | src/com/android/providers/downloads/DownloadStorageProvider.java | 38 |
1 files changed, 12 insertions, 26 deletions
diff --git a/src/com/android/providers/downloads/DownloadStorageProvider.java b/src/com/android/providers/downloads/DownloadStorageProvider.java index 421c2613..f5ba1e5d 100644 --- a/src/com/android/providers/downloads/DownloadStorageProvider.java +++ b/src/com/android/providers/downloads/DownloadStorageProvider.java @@ -307,39 +307,26 @@ public class DownloadStorageProvider extends FileSystemProvider { } @Override - public Cursor queryChildDocuments(String parentDocId, String[] projection, String sortOrder) - throws FileNotFoundException { - return queryChildDocuments(parentDocId, projection, sortOrder, false); - } - - @Override - public Cursor queryChildDocumentsForManage( - String parentDocId, String[] projection, String sortOrder) - throws FileNotFoundException { - return queryChildDocuments(parentDocId, projection, sortOrder, true); - } - - private Cursor queryChildDocuments(String parentDocId, String[] projection, - String sortOrder, boolean manage) throws FileNotFoundException { - + protected Cursor queryChildDocuments(String documentId, String[] projection, String sortOrder, + boolean includeHidden) throws FileNotFoundException { // Delegate to real provider final long token = Binder.clearCallingIdentity(); Cursor cursor = null; try { - if (RawDocumentsHelper.isRawDocId(parentDocId)) { - return super.queryChildDocuments(parentDocId, projection, sortOrder); + if (RawDocumentsHelper.isRawDocId(documentId)) { + return super.queryChildDocuments(documentId, projection, sortOrder, includeHidden); } final DownloadsCursor result = new DownloadsCursor(projection, getContext().getContentResolver()); final ArrayList<Uri> notificationUris = new ArrayList<>(); - if (isMediaStoreDownloadDir(parentDocId)) { + if (isMediaStoreDownloadDir(documentId)) { includeDownloadsFromMediaStore(result, null /* queryArgs */, null /* filePaths */, notificationUris, - getMediaStoreIdString(parentDocId), NO_LIMIT, manage); + getMediaStoreIdString(documentId), NO_LIMIT, includeHidden); } else { - assert (DOC_ID_ROOT.equals(parentDocId)); - if (manage) { + assert (DOC_ID_ROOT.equals(documentId)); + if (includeHidden) { cursor = mDm.query( new DownloadManager.Query().setOnlyIncludeVisibleInDownloadsUi(true)); } else { @@ -354,7 +341,7 @@ public class DownloadStorageProvider extends FileSystemProvider { notificationUris.add(cursor.getNotificationUri()); includeDownloadsFromMediaStore(result, null /* queryArgs */, filePaths, notificationUris, - null /* parentId */, NO_LIMIT, manage); + null /* parentId */, NO_LIMIT, includeHidden); includeFilesFromSharedStorage(result, filePaths, null); } result.setNotificationUris(getContext().getContentResolver(), notificationUris); @@ -476,12 +463,11 @@ public class DownloadStorageProvider extends FileSystemProvider { return result; } - private void includeSearchFilesFromSharedStorage(DownloadsCursor result, - String[] projection, Set<String> filePaths, - Bundle queryArgs) throws FileNotFoundException { + private void includeSearchFilesFromSharedStorage(DownloadsCursor result, String[] projection, + Set<String> filePaths, Bundle queryArgs) throws FileNotFoundException { final File downloadDir = getPublicDownloadsDirectory(); try (Cursor rawFilesCursor = super.querySearchDocuments(downloadDir, - projection, filePaths, queryArgs)) { + projection, /* exclusion */ filePaths, queryArgs)) { final boolean shouldExcludeMedia = queryArgs.getBoolean( DocumentsContract.QUERY_ARG_EXCLUDE_MEDIA, false /* defaultValue */); |