CL/1522740/ followups.
Change-Id: I8b84a2de808f7111c1e40a5f9cab5713922dc59e
diff --git a/src/com/android/documentsui/dirlist/DirectoryFragment.java b/src/com/android/documentsui/dirlist/DirectoryFragment.java
index be0ee3f..84ad5f4 100644
--- a/src/com/android/documentsui/dirlist/DirectoryFragment.java
+++ b/src/com/android/documentsui/dirlist/DirectoryFragment.java
@@ -638,11 +638,10 @@
// Model must be accessed in UI thread, since underlying cursor is not threadsafe.
List<DocumentInfo> docs = mModel.getDocuments(selected);
- BaseActivity activity = mActivity;
if (docs.size() > 1) {
- activity.onDocumentsPicked(docs);
+ mActivity.onDocumentsPicked(docs);
} else {
- activity.onDocumentPicked(docs.get(0));
+ mActivity.onDocumentPicked(docs.get(0));
}
}
diff --git a/src/com/android/documentsui/dirlist/Model.java b/src/com/android/documentsui/dirlist/Model.java
index ea51e91..8bdf079 100644
--- a/src/com/android/documentsui/dirlist/Model.java
+++ b/src/com/android/documentsui/dirlist/Model.java
@@ -59,6 +59,8 @@
&& (flags & Document.FLAG_PARTIAL) == 0;
};
+ private static final Predicate<Cursor> ANY_FILE_FILTER = (Cursor c) -> true;
+
private static final String TAG = "Model";
private boolean mIsLoading;
@@ -204,19 +206,7 @@
}
public List<DocumentInfo> getDocuments(Selection selection) {
- final int size = (selection != null) ? selection.size() : 0;
-
- final List<DocumentInfo> docs = new ArrayList<>(size);
- // NOTE: That as this now iterates over only final (non-provisional) selection.
- for (String modelId: selection) {
- DocumentInfo doc = getDocument(modelId);
- if (doc == null) {
- Log.w(TAG, "Unable to obtain document for modelId: " + modelId);
- continue;
- }
- docs.add(doc);
- }
- return docs;
+ return loadDocuments(selection, ANY_FILE_FILTER);
}
public @Nullable DocumentInfo getDocument(String modelId) {