DocumentsContract.Root
public
static
final
class
DocumentsContract.Root
extends Object
| java.lang.Object | |
| ↳ | android.provider.DocumentsContract.Root |
Constants related to a root of documents, including Cursor column
names and flags. A root is the start of a tree of documents, such as a
physical storage device, or an account. Each root starts at the directory
referenced by Root.COLUMN_DOCUMENT_ID, which can recursively
contain both documents and directories.
All columns are read-only to client applications.
Summary
Constants | |
|---|---|
String |
COLUMN_AVAILABLE_BYTES
Number of bytes available in this root. |
String |
COLUMN_CAPACITY_BYTES
Capacity of a root in bytes. |
String |
COLUMN_DOCUMENT_ID
Document which is a directory that represents the top directory of this root. |
String |
COLUMN_FLAGS
Flags that apply to a root. |
String |
COLUMN_ICON
Icon resource ID for a root. |
String |
COLUMN_MIME_TYPES
MIME types supported by this root. |
String |
COLUMN_QUERY_ARGS
Query arguments supported by this root. |
String |
COLUMN_ROOT_ID
Unique ID of a root. |
String |
COLUMN_SUMMARY
Summary for this root, which may be shown to a user. |
String |
COLUMN_TITLE
Title for a root, which will be shown to a user. |
int |
FLAG_EMPTY
Flag indicating that this root is currently empty. |
int |
FLAG_LIMITED_FUNCTIONALITY_WHEN_OFFLINE
Flag indicating that this root has limited functionality when the device does not have an internet connection. |
int |
FLAG_LOCAL_ONLY
Flag indicating that this root offers content that is strictly local on the device. |
int |
FLAG_SUPPORTS_CREATE
Flag indicating that at least one directory under this root supports creating content. |
int |
FLAG_SUPPORTS_EJECT
Flag indicating that this root can be ejected. |
int |
FLAG_SUPPORTS_IS_CHILD
Flag indicating that this root supports testing parent child relationships. |
int |
FLAG_SUPPORTS_QUERY_TRASH
Flag indicating that this root can be queried to provide trashed documents. |
int |
FLAG_SUPPORTS_RECENTS
Flag indicating that this root can be queried to provide recently modified documents. |
int |
FLAG_SUPPORTS_SEARCH
Flag indicating that this root supports search. |
String |
MIME_TYPE_ITEM
MIME type for a root. |
Inherited methods | |
|---|---|
Constants
COLUMN_AVAILABLE_BYTES
public static final String COLUMN_AVAILABLE_BYTES
Number of bytes available in this root. This column is optional, and
may be null if unknown or unbounded.
Type: INTEGER (long)
Constant Value: "available_bytes"
COLUMN_CAPACITY_BYTES
public static final String COLUMN_CAPACITY_BYTES
Capacity of a root in bytes. This column is optional, and may be
null if unknown or unbounded.
Type: INTEGER (long)
Constant Value: "capacity_bytes"
COLUMN_DOCUMENT_ID
public static final String COLUMN_DOCUMENT_ID
Document which is a directory that represents the top directory of this root. This column is required.
Type: STRING
See also:
Constant Value: "document_id"
COLUMN_FLAGS
public static final String COLUMN_FLAGS
Flags that apply to a root. This column is required.
Type: INTEGER (int)
See also:
Constant Value: "flags"
COLUMN_ICON
public static final String COLUMN_ICON
Icon resource ID for a root. This column is required.
Type: INTEGER (int)
Constant Value: "icon"
COLUMN_MIME_TYPES
public static final String COLUMN_MIME_TYPES
MIME types supported by this root. This column is optional, and if
null the root is assumed to support all MIME types. Multiple
MIME types can be separated by a newline. For example, a root
supporting audio might return "audio/*\napplication/x-flac".
Type: STRING
Constant Value: "mime_types"
COLUMN_QUERY_ARGS
public static final String COLUMN_QUERY_ARGS
Query arguments supported by this root. This column is optional
and related to COLUMN_FLAGS and FLAG_SUPPORTS_SEARCH.
If the flags include FLAG_SUPPORTS_SEARCH, and the column is
null, the root is assumed to support DocumentsContract.QUERY_ARG_DISPLAY_NAME
search of Document.COLUMN_DISPLAY_NAME. Multiple query arguments
can be separated by a newline. For example, a root supporting
DocumentsContract.QUERY_ARG_MIME_TYPES and DocumentsContract.QUERY_ARG_DISPLAY_NAME might
return "android:query-arg-mime-types\nandroid:query-arg-display-name".
Type: STRING
See also:
Constant Value: "query_args"
COLUMN_ROOT_ID
public static final String COLUMN_ROOT_ID
Unique ID of a root. This ID is both provided by and interpreted by a
DocumentsProvider, and should be treated as an opaque value
by client applications. This column is required.
Type: STRING
Constant Value: "root_id"
COLUMN_SUMMARY
public static final String COLUMN_SUMMARY
Summary for this root, which may be shown to a user. This column is
optional, and may be null. For a single storage service
surfacing multiple accounts as different roots, this summary should
be the name of the account.
Type: STRING
Constant Value: "summary"
COLUMN_TITLE
public static final String COLUMN_TITLE
Title for a root, which will be shown to a user. This column is required. For a single storage service surfacing multiple accounts as different roots, this title should be the name of the service.
Type: STRING
Constant Value: "title"
FLAG_EMPTY
public static final int FLAG_EMPTY
Flag indicating that this root is currently empty. This may be used
to hide the root when opening documents, but the root will still be
shown when creating documents and FLAG_SUPPORTS_CREATE is
also set. If the value of this flag changes, such as when a root
becomes non-empty, you must send a content changed notification for
DocumentsContract.buildRootsUri(String).
Constant Value: 64 (0x00000040)
FLAG_LIMITED_FUNCTIONALITY_WHEN_OFFLINE
public static final int FLAG_LIMITED_FUNCTIONALITY_WHEN_OFFLINE
Flag indicating that this root has limited functionality when the device does not have an
internet connection. This will affect how the system file picker and file manager
presents files to the user when the device does not have internet connection.
Operations such as open, copy and move, that require reading file contents, will be
disabled on files that do not have content available locally. Specifically, the following
conditions have to be met to disable these actions:
- the device does not have internet connection
- Document.COLUMN_CONTENT_SYNC_STATE_FLAGS is non-null and
Document.SYNC_STATE_FLAG_AVAILABLE_LOCALLY is not set
- FLAG_LIMITED_FUNCTIONALITY_WHEN_OFFLINE is set
- Document.FLAG_VIRTUAL_DOCUMENT is not set
- Document.COLUMN_MIME_TYPE does not equal Document.MIME_TYPE_DIR
Folder opens will be unaffected by the state of this flag to allow users to be able to
still navigate around the file system. However, other operations that require reading
file contents will be disabled on folders because they may contain files that don't have
content available locally. Specifically, the following conditions have to be met to
disable these actions:
- the device does not have internet connection
- FLAG_LIMITED_FUNCTIONALITY_WHEN_OFFLINE is set
- Document.COLUMN_MIME_TYPE equals Document.MIME_TYPE_DIR
Operations such as rename and delete, that don't require reading file contents, will be
unaffected by the state of this flag.
In addition, when this flag is set and the device if offline, the file picker and file
manager will show a message to the user indicating that there is limited functionality
when offline.
Note that even if the device has an internet connection, the documents provider
implementation may be limited or prevented from accessing it because of various system
restrictions and battery saving features. There will be no UI change for this case.
See also:
Constant Value: 2097152 (0x00200000)
FLAG_LOCAL_ONLY
public static final int FLAG_LOCAL_ONLY
Flag indicating that this root offers content that is strictly local on the device. That is, no network requests are made for the content.
See also:
Constant Value: 2 (0x00000002)
FLAG_SUPPORTS_CREATE
public static final int FLAG_SUPPORTS_CREATE
Flag indicating that at least one directory under this root supports
creating content. Roots with this flag will be shown when an
application interacts with Intent.ACTION_CREATE_DOCUMENT.
See also:
Constant Value: 1 (0x00000001)
FLAG_SUPPORTS_EJECT
public static final int FLAG_SUPPORTS_EJECT
Flag indicating that this root can be ejected.
See also:
Constant Value: 32 (0x00000020)
FLAG_SUPPORTS_IS_CHILD
public static final int FLAG_SUPPORTS_IS_CHILD
Flag indicating that this root supports testing parent child relationships.
Constant Value: 16 (0x00000010)
FLAG_SUPPORTS_QUERY_TRASH
public static final int FLAG_SUPPORTS_QUERY_TRASH
Flag indicating that this root can be queried to provide trashed documents.
See also:
Constant Value: 1048576 (0x00100000)
FLAG_SUPPORTS_RECENTS
public static final int FLAG_SUPPORTS_RECENTS
Flag indicating that this root can be queried to provide recently modified documents.
See also:
Constant Value: 4 (0x00000004)
FLAG_SUPPORTS_SEARCH
public static final int FLAG_SUPPORTS_SEARCH
Flag indicating that this root supports search.
See also:
Constant Value: 8 (0x00000008)
MIME_TYPE_ITEM
public static final String MIME_TYPE_ITEM
MIME type for a root.
Constant Value: "vnd.android.document/root"