From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Sergey Nikolaienkov Date: Mon, 3 Jul 2023 17:09:28 +0200 Subject: [PATCH] DO NOT MERGE: Consolidate queryChildDocumentsXxx() implementations Make sure to override the single right variant of the FileSystemProvider#queryChildDocuments() method: the one that takes the "includeHidden" boolean argument. Bug: 200034476 Bug: 220066255 Bug: 283962634 Test: make, install and run manually (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:e11e4ca6eef7e77042f2b27fce4fdb8a0b3d0371) Merged-In: I4c00693e28f3d50d716350a65e9e6bfd7482b085 Change-Id: I4c00693e28f3d50d716350a65e9e6bfd7482b085 --- .../downloads/DownloadStorageProvider.java | 25 +++++-------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/src/com/android/providers/downloads/DownloadStorageProvider.java b/src/com/android/providers/downloads/DownloadStorageProvider.java index efeb272b..9fd6f899 100644 --- a/src/com/android/providers/downloads/DownloadStorageProvider.java +++ b/src/com/android/providers/downloads/DownloadStorageProvider.java @@ -243,34 +243,21 @@ 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); } - assert (DOC_ID_ROOT.equals(parentDocId)); + assert (DOC_ID_ROOT.equals(documentId)); final DownloadsCursor result = new DownloadsCursor(projection, getContext().getContentResolver()); - if (manage) { + if (includeHidden) { cursor = mDm.query( new DownloadManager.Query().setOnlyIncludeVisibleInDownloadsUi(true)); } else {