summaryrefslogtreecommitdiffstats
path: root/packages/DocumentsUI
diff options
context:
space:
mode:
authorJeff Sharkey <jsharkey@google.com>2015-11-09 21:53:02 +0000
committerandroid-build-merger <android-build-merger@google.com>2015-11-09 21:53:02 +0000
commitd9c10d7edd52f5c1efb6d40f1c36b376b7a34934 (patch)
tree8c4cd3df8c44cf802d712e5e2aea8207291c89fd /packages/DocumentsUI
parent8fb0121cb60ddf54a22bff088670594f422edea9 (diff)
parente6538dcc06c2547ac8a58c265e6b586fc9652ef3 (diff)
downloadframeworks_base-d9c10d7edd52f5c1efb6d40f1c36b376b7a34934.zip
frameworks_base-d9c10d7edd52f5c1efb6d40f1c36b376b7a34934.tar.gz
frameworks_base-d9c10d7edd52f5c1efb6d40f1c36b376b7a34934.tar.bz2
Merge "Block directory selection in openable modes." into mnc-dr-dev am: 00765ef5a2
am: e6538dcc06 * commit 'e6538dcc06c2547ac8a58c265e6b586fc9652ef3': Block directory selection in openable modes.
Diffstat (limited to 'packages/DocumentsUI')
-rw-r--r--packages/DocumentsUI/src/com/android/documentsui/DirectoryFragment.java17
1 files changed, 16 insertions, 1 deletions
diff --git a/packages/DocumentsUI/src/com/android/documentsui/DirectoryFragment.java b/packages/DocumentsUI/src/com/android/documentsui/DirectoryFragment.java
index 006f6e9..0d326ec 100644
--- a/packages/DocumentsUI/src/com/android/documentsui/DirectoryFragment.java
+++ b/packages/DocumentsUI/src/com/android/documentsui/DirectoryFragment.java
@@ -19,7 +19,10 @@ package com.android.documentsui;
import static com.android.documentsui.BaseActivity.State.ACTION_BROWSE;
import static com.android.documentsui.BaseActivity.State.ACTION_BROWSE_ALL;
import static com.android.documentsui.BaseActivity.State.ACTION_CREATE;
+import static com.android.documentsui.BaseActivity.State.ACTION_GET_CONTENT;
import static com.android.documentsui.BaseActivity.State.ACTION_MANAGE;
+import static com.android.documentsui.BaseActivity.State.ACTION_OPEN;
+import static com.android.documentsui.BaseActivity.State.ACTION_OPEN_TREE;
import static com.android.documentsui.BaseActivity.State.MODE_GRID;
import static com.android.documentsui.BaseActivity.State.MODE_LIST;
import static com.android.documentsui.BaseActivity.State.MODE_UNKNOWN;
@@ -578,11 +581,23 @@ public class DirectoryFragment extends Fragment {
// Directories and footer items cannot be checked
boolean valid = false;
+ final State state = getDisplayState(DirectoryFragment.this);
final Cursor cursor = mAdapter.getItem(position);
if (cursor != null) {
final String docMimeType = getCursorString(cursor, Document.COLUMN_MIME_TYPE);
final int docFlags = getCursorInt(cursor, Document.COLUMN_FLAGS);
- valid = isDocumentEnabled(docMimeType, docFlags);
+ switch (state.action) {
+ case ACTION_OPEN:
+ case ACTION_CREATE:
+ case ACTION_GET_CONTENT:
+ case ACTION_OPEN_TREE:
+ valid = isDocumentEnabled(docMimeType, docFlags)
+ && !Document.MIME_TYPE_DIR.equals(docMimeType);
+ break;
+ default:
+ valid = isDocumentEnabled(docMimeType, docFlags);
+ break;
+ }
}
if (!valid) {