Omit the authority if moving returned cursor failed.

Bug: 31945164
Change-Id: I1b3a9e2dd389a7d178062f864755599df2a6d4eb
diff --git a/src/com/android/documentsui/RecentsLoader.java b/src/com/android/documentsui/RecentsLoader.java
index 6ce1896..c3ccbba 100644
--- a/src/com/android/documentsui/RecentsLoader.java
+++ b/src/com/android/documentsui/RecentsLoader.java
@@ -140,7 +140,7 @@
         // Collect all finished tasks
         boolean allDone = true;
         int totalQuerySize = 0;
-        List<Cursor> cursors = new ArrayList<>();
+        List<Cursor> cursors = new ArrayList<>(mTasks.size());
         for (RecentsTask task : mTasks.values()) {
             if (task.isDone()) {
                 try {
@@ -168,6 +168,10 @@
                     throw new RuntimeException(e);
                 } catch (ExecutionException e) {
                     // We already logged on other side
+                } catch (Exception e) {
+                    // Catch exceptions thrown when we read the cursor.
+                    Log.e(TAG, "Failed to query Recents for authority: " + task.authority
+                            + ". Skip this authority in Recents.", e);
                 }
             } else {
                 allDone = false;
@@ -189,7 +193,6 @@
             merged = new MatrixCursor(new String[0]);
         }
 
-
         final Cursor sorted = mState.sortModel.sortCursor(merged);
 
         // Tell the UI if this is an in-progress result. When loading is complete, another update is