diff options
| author | Ivan Chiang <chiangi@google.com> | 2019-08-21 16:12:54 +0800 |
|---|---|---|
| committer | Ivan Chiang <chiangi@google.com> | 2019-10-02 06:01:36 +0000 |
| commit | 730b3a3a452afb9be38bbef9f7ba36bdbd392b89 (patch) | |
| tree | e3f1bbea42c7b03ecdf020eae2ecdc1406037790 /core/java/android | |
| parent | 92818ea47c11c63d2b92f44acddcf603f65aebc0 (diff) | |
Allow providers block folders in ACTION_OPEN_DOCUMENT_TREE
DocumentsContract
- Add new flag FLAG_DIR_BLOCKS_TREE in Document
ExternalStorageProvider
- Add flag into DocumentInfo for blocking folder
Change-Id: Ib557fe99d330788a3bd968bffd43b6658761514f
Bug: 32370759
Test: atest DocumentsTest
Diffstat (limited to 'core/java/android')
| -rw-r--r-- | core/java/android/provider/DocumentsContract.java | 32 |
1 files changed, 28 insertions, 4 deletions
diff --git a/core/java/android/provider/DocumentsContract.java b/core/java/android/provider/DocumentsContract.java index fd81178d2cfb..eb09930005b5 100644 --- a/core/java/android/provider/DocumentsContract.java +++ b/core/java/android/provider/DocumentsContract.java @@ -363,15 +363,22 @@ public final class DocumentsContract { * <p> * Type: INTEGER (int) * - * @see #FLAG_SUPPORTS_WRITE - * @see #FLAG_SUPPORTS_DELETE - * @see #FLAG_SUPPORTS_THUMBNAIL + * @see #FLAG_DIR_BLOCKS_TREE * @see #FLAG_DIR_PREFERS_GRID * @see #FLAG_DIR_PREFERS_LAST_MODIFIED - * @see #FLAG_VIRTUAL_DOCUMENT + * @see #FLAG_DIR_SUPPORTS_CREATE + * @see #FLAG_PARTIAL * @see #FLAG_SUPPORTS_COPY + * @see #FLAG_SUPPORTS_DELETE + * @see #FLAG_SUPPORTS_METADATA * @see #FLAG_SUPPORTS_MOVE * @see #FLAG_SUPPORTS_REMOVE + * @see #FLAG_SUPPORTS_RENAME + * @see #FLAG_SUPPORTS_SETTINGS + * @see #FLAG_SUPPORTS_THUMBNAIL + * @see #FLAG_SUPPORTS_WRITE + * @see #FLAG_VIRTUAL_DOCUMENT + * @see #FLAG_WEB_LINKABLE */ public static final String COLUMN_FLAGS = "flags"; @@ -542,6 +549,23 @@ public final class DocumentsContract { * @see DocumentsContract#getDocumentMetadata(ContentInterface, Uri) */ public static final int FLAG_SUPPORTS_METADATA = 1 << 14; + + /** + * Flag indicating that a document is a directory that wants to block itself + * from being selected when the user launches an {@link Intent#ACTION_OPEN_DOCUMENT_TREE} + * intent. Only valid when {@link #COLUMN_MIME_TYPE} is {@link #MIME_TYPE_DIR}. + * <p> + * Note that this flag <em>only</em> applies to the single directory to which it is + * applied. It does <em>not</em> block the user from selecting either a parent or + * child directory during an {@link Intent#ACTION_OPEN_DOCUMENT_TREE} request. + * In particular, the only way to guarantee that a specific directory can never + * be granted via an {@link Intent#ACTION_OPEN_DOCUMENT_TREE} request is to ensure + * that both it and <em>all of its parent directories</em> have set this flag. + * + * @see Intent#ACTION_OPEN_DOCUMENT_TREE + * @see #COLUMN_FLAGS + */ + public static final int FLAG_DIR_BLOCKS_TREE = 1 << 15; } /** |
