Added in API level 19

Root


class Root
kotlin.Any
   ↳ 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
static String

Number of bytes available in this root.

static String

Capacity of a root in bytes.

static String

Document which is a directory that represents the top directory of this root.

static String

Flags that apply to a root.

static String

Icon resource ID for a root.

static String

MIME types supported by this root.

static String

Query arguments supported by this root.

static String

Unique ID of a root.

static String

Summary for this root, which may be shown to a user.

static String

Title for a root, which will be shown to a user.

static Int

Flag indicating that this root is currently empty.

static Int

Flag indicating that this root has limited functionality when the device does not have an internet connection.

static Int

Flag indicating that this root offers content that is strictly local on the device.

static Int

Flag indicating that at least one directory under this root supports creating content.

static Int

Flag indicating that this root can be ejected.

static Int

Flag indicating that this root supports testing parent child relationships.

static Int

Flag indicating that this root can be queried to provide trashed documents.

static Int

Flag indicating that this root can be queried to provide recently modified documents.

static Int

Flag indicating that this root supports search.

static String

MIME type for a root.

Constants

COLUMN_AVAILABLE_BYTES

Added in API level 19
static val COLUMN_AVAILABLE_BYTES: String

Number of bytes available in this root. This column is optional, and may be null if unknown or unbounded.

Type: INTEGER (long)

Value: "available_bytes"

COLUMN_CAPACITY_BYTES

Added in API level 24
static val COLUMN_CAPACITY_BYTES: String

Capacity of a root in bytes. This column is optional, and may be null if unknown or unbounded.

Type: INTEGER (long)

Value: "capacity_bytes"

COLUMN_DOCUMENT_ID

Added in API level 19
static val COLUMN_DOCUMENT_ID: String

Document which is a directory that represents the top directory of this root. This column is required.

Type: STRING

Value: "document_id"

COLUMN_FLAGS

Added in API level 19
static val COLUMN_FLAGS: String

Flags that apply to a root. This column is required.

Type: INTEGER (int)

Value: "flags"

COLUMN_ICON

Added in API level 19
static val COLUMN_ICON: String

Icon resource ID for a root. This column is required.

Type: INTEGER (int)

Value: "icon"

COLUMN_MIME_TYPES

Added in API level 19
static val COLUMN_MIME_TYPES: String

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

Value: "mime_types"

COLUMN_QUERY_ARGS

Added in API level 29
static val COLUMN_QUERY_ARGS: String

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 QUERY_ARG_DISPLAY_NAME search of Document.COLUMN_DISPLAY_NAME. Multiple query arguments can be separated by a newline. For example, a root supporting QUERY_ARG_MIME_TYPES and QUERY_ARG_DISPLAY_NAME might return "android:query-arg-mime-types\nandroid:query-arg-display-name".

Type: STRING

Value: "query_args"

COLUMN_ROOT_ID

Added in API level 19
static val COLUMN_ROOT_ID: String

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

Value: "root_id"

COLUMN_SUMMARY

Added in API level 19
static val COLUMN_SUMMARY: String

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

Value: "summary"

COLUMN_TITLE

Added in API level 19
static val COLUMN_TITLE: String

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

Value: "title"

FLAG_EMPTY

Added in API level 29
static val FLAG_EMPTY: Int

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).

Value: 64

FLAG_LIMITED_FUNCTIONALITY_WHEN_OFFLINE

Added in API level 19
static val FLAG_LIMITED_FUNCTIONALITY_WHEN_OFFLINE: Int

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.

Value: 2097152

FLAG_LOCAL_ONLY

Added in API level 19
static val FLAG_LOCAL_ONLY: Int

Flag indicating that this root offers content that is strictly local on the device. That is, no network requests are made for the content.

Value: 2

FLAG_SUPPORTS_CREATE

Added in API level 19
static val FLAG_SUPPORTS_CREATE: Int

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.

Value: 1

See Also

FLAG_SUPPORTS_EJECT

Added in API level 26
static val FLAG_SUPPORTS_EJECT: Int

Flag indicating that this root can be ejected.

Value: 32

FLAG_SUPPORTS_IS_CHILD

Added in API level 21
static val FLAG_SUPPORTS_IS_CHILD: Int

Flag indicating that this root supports testing parent child relationships.

Value: 16

FLAG_SUPPORTS_QUERY_TRASH

Added in API level 19
static val FLAG_SUPPORTS_QUERY_TRASH: Int

Flag indicating that this root can be queried to provide trashed documents.

Value: 1048576

FLAG_SUPPORTS_RECENTS

Added in API level 19
static val FLAG_SUPPORTS_RECENTS: Int

Flag indicating that this root can be queried to provide recently modified documents.

Value: 4

MIME_TYPE_ITEM

Added in API level 26
static val MIME_TYPE_ITEM: String

MIME type for a root.

Value: "vnd.android.document/root"