summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-12-13 18:06:00 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-12-13 18:06:00 +0000
commit909a721f7bce29d189535adce19a4cd24ba4ccd1 (patch)
tree6ac66d4b2fd43a08932336d930580cbab336f2ae
parentd5f620a68ceed56249c629d90f611a0502096306 (diff)
parent16f4ac23091e4ab3a24d21cb739632e7b8872e62 (diff)
downloadDownloadProvider-android14-platform-release.tar.gz
Merge cherrypicks of ['googleplex-android-review.googlesource.com/25101135'] into udc-platform-release.android-platform-14.0.0_r6android-platform-14.0.0_r5android-platform-14.0.0_r4android14-platform-release
Change-Id: I79681f8c4272217a2e4fbff53af7a949d1e06dc4
-rw-r--r--src/com/android/providers/downloads/DownloadStorageProvider.java38
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 */);