summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-12-18 10:55:13 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-12-18 10:55:13 +0000
commit773490c1f372ee4f2505cd5ea494cbfeeba3350a (patch)
tree7e015748db2c4c5c5a0074f693253d3fb8ae8680
parentab3e456cf51fbe0b849e93b0f979644dee79eaff (diff)
parent8b0222012d21f41da9a4ba4ed7b8e3ec09fbc497 (diff)
downloadDownloadProvider-android13-platform-release.tar.gz
Merge cherrypicks of ['googleplex-android-review.googlesource.com/25150560'] into tm-platform-release.android-platform-13.0.0_r18android-platform-13.0.0_r17android-platform-13.0.0_r16android13-platform-release
Change-Id: Id69d630c13674442c535fb058c5464bb1142ed03
-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 */);