CloudMediaProviderContract

class CloudMediaProviderContract
kotlin.Any
   ↳ android.provider.CloudMediaProviderContract

Defines the contract between a cloud media provider and the OS.

To create a cloud media provider, extend CloudMediaProvider, which provides a foundational implementation of this contract.

Summary

Nested classes

Constants related to an album item, including Cursor column names

Constants related to a media collection

Constants related to a media item, including Cursor column names

Constants
static String

Limits the query results to only media items matching the given album id.

static String

Indicates whether to enable looping playback of media items.

static String

MediaCollectionInfo#MEDIA_COLLECTION_ID on which the media or album query occurred.

static String

The maximum number of query results that should be included in a batch when syncing metadata with cloud provider.

static String

Opaque pagination token to retrieve the next page (cursor) from a media or album query.

static String

Forces the CloudMediaProvider#onOpenPreview file descriptor to return a thumbnail image.

static String

Indicates whether to mute audio during preview of media items.

static String

Generation number to fetch the latest media or album metadata changes from the media collection.

static String

Permission required to protect CloudMediaProvider instances.

static String

Intent action used to identify CloudMediaProvider instances.

Constants

EXTRA_ALBUM_ID

static val EXTRA_ALBUM_ID: String

Limits the query results to only media items matching the given album id.

If the provider handled the album filter, they must also add the EXTRA_ALBUM_ID key to the array of ContentResolver#EXTRA_HONORED_ARGS as part of the returned Cursor#setExtras Bundle.

Value: "android.provider.extra.ALBUM_ID"

EXTRA_LOOPING_PLAYBACK_ENABLED

static val EXTRA_LOOPING_PLAYBACK_ENABLED: String

Indicates whether to enable looping playback of media items.

In case this is not present, the default value should be false.

Value: "android.provider.extra.LOOPING_PLAYBACK_ENABLED"

EXTRA_MEDIA_COLLECTION_ID

static val EXTRA_MEDIA_COLLECTION_ID: String

MediaCollectionInfo#MEDIA_COLLECTION_ID on which the media or album query occurred.

Providers must set this token as part of the Cursor#setExtras Bundle returned from the cursors on query. This allows the OS to verify that the returned results match the MediaCollectionInfo#MEDIA_COLLECTION_ID queried via CloudMediaProvider#onGetMediaCollectionInfo. If the collection differs, the OS will ignore the result and may try again.

Value: "android.provider.extra.MEDIA_COLLECTION_ID"

EXTRA_PAGE_SIZE

static val EXTRA_PAGE_SIZE: String

The maximum number of query results that should be included in a batch when syncing metadata with cloud provider. This extra can be passed as a Bundle parameter to the media or album query methods. It is optional for the provider to honor this extra and return results at max page size.

Value: "android.provider.extra.PAGE_SIZE"

EXTRA_PAGE_TOKEN

static val EXTRA_PAGE_TOKEN: String

Opaque pagination token to retrieve the next page (cursor) from a media or album query.

Providers can optionally set this token as part of the Cursor#setExtras Bundle. If a token is set, the OS can pass it as a Bundle parameter when querying for media or albums to fetch subsequent pages. The provider can keep returning pagination tokens until the last page at which point it should not set a token on the Cursor.

If the provider handled the page token as part of the query, they must add the EXTRA_PAGE_TOKEN key to the array of ContentResolver#EXTRA_HONORED_ARGS as part of the returned Cursor#setExtras Bundle.

Value: "android.provider.extra.PAGE_TOKEN"

EXTRA_PREVIEW_THUMBNAIL

static val EXTRA_PREVIEW_THUMBNAIL: String

Forces the CloudMediaProvider#onOpenPreview file descriptor to return a thumbnail image. This is only useful for videos where the OS can either request a video or image for preview.

Value: "android.provider.extra.PREVIEW_THUMBNAIL"

EXTRA_SURFACE_CONTROLLER_AUDIO_MUTE_ENABLED

static val EXTRA_SURFACE_CONTROLLER_AUDIO_MUTE_ENABLED: String

Indicates whether to mute audio during preview of media items.

Value: "android.provider.extra.SURFACE_CONTROLLER_AUDIO_MUTE_ENABLED"

EXTRA_SYNC_GENERATION

static val EXTRA_SYNC_GENERATION: String

Generation number to fetch the latest media or album metadata changes from the media collection.

The provider should associate a monotonically increasing sync generation to each media item change (insertion/deletion/update). This is useful to quickly identify exactly which media items have changed since a previous point in time.

Providers should also associate a separate monotonically increasing sync generation for album changes (insertion/deletion/update). This album sync generation, should record both changes to the album metadata itself and changes to the media items contained in the album. E.g. a direct change to an album's CloudMediaProviderContract.AlbumColumns#DISPLAY_NAME will increase the album sync generation, likewise adding a photo to that album should also increase the sync generation.

Note that multiple media (or album) items can share a sync generation as long as the entire change appears atomic from the perspective of the query APIs. E.g. each item in a batch photo sync from the cloud can have the same sync generation if they were all synced atomically into the collection from the perspective of an external observer.

This extra can be passed as a Bundle parameter to the media or album query methods and the provider should only return items with a sync generation that is strictly greater than the one provided in the filter.

If the provider supports this filter, it must support the respective CloudMediaProvider#onGetMediaCollectionInfo methods to return the count and max generation for media or albums.

If the provider handled the generation, they must add the EXTRA_SYNC_GENERATION key to the array of ContentResolver#EXTRA_HONORED_ARGS as part of the returned Cursor#setExtras Bundle.

Value: "android.provider.extra.SYNC_GENERATION"

MANAGE_CLOUD_MEDIA_PROVIDERS_PERMISSION

static val MANAGE_CLOUD_MEDIA_PROVIDERS_PERMISSION: String

Permission required to protect CloudMediaProvider instances. Providers should require this in the permission attribute in their <provider> tag. The OS will not connect to a provider without this protection.

Value: "com.android.providers.media.permission.MANAGE_CLOUD_MEDIA_PROVIDERS"

PROVIDER_INTERFACE

static val PROVIDER_INTERFACE: String

Intent action used to identify CloudMediaProvider instances. This is used in the <intent-filter> of the <provider>.

Value: "android.content.action.CLOUD_MEDIA_PROVIDER"