CloudMediaProviderContract


public final class CloudMediaProviderContract
extends Object

java.lang.Object
   ↳ 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.

See also:

Summary

Nested classes

class CloudMediaProviderContract.AlbumColumns

Constants related to an album item, including Cursor column names 

class CloudMediaProviderContract.Capabilities

Information about what capabilities a CloudMediaProvider can support. 

class CloudMediaProviderContract.MediaCategoryColumns

MediaCategory represents a broader structure that a MediaSetColumns or another MediaCategoryColumns belongs to. 

class CloudMediaProviderContract.MediaCollectionInfo

Constants related to a media collection 

class CloudMediaProviderContract.MediaColumns

Constants related to a media item, including Cursor column names 

class CloudMediaProviderContract.MediaSetColumns

MediaSet represents a cohesive collection of related unique media items, sharing a common meaningful context or theme. 

class CloudMediaProviderContract.SearchSuggestionColumns

Represents a search suggestion provided by the CloudMediaProvider

Constants

String EXTRA_ALBUM_ID

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

String EXTRA_LOOPING_PLAYBACK_ENABLED

Indicates whether to enable looping playback of media items.

String EXTRA_MEDIA_COLLECTION_ID

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

String EXTRA_PAGE_SIZE

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

String EXTRA_PAGE_TOKEN

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

String EXTRA_PREVIEW_THUMBNAIL

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

String EXTRA_SORT_ORDER

Extra used to specify the sorting behavior when querying from CloudMediaProvider.

String EXTRA_SURFACE_CONTROLLER_AUDIO_MUTE_ENABLED

Indicates whether to mute audio during preview of media items.

String EXTRA_SYNC_GENERATION

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

String MANAGE_CLOUD_MEDIA_PROVIDERS_PERMISSION

Permission required to protect CloudMediaProvider instances.

int MEDIA_CATEGORY_TYPE_PEOPLE_AND_PETS

Represents media category related to faces of people and pets.

String PROVIDER_INTERFACE

Intent action used to identify CloudMediaProvider instances.

int SEARCH_SUGGESTION_ALBUM

Suggestion based on user albums.

int SEARCH_SUGGESTION_DATE

Suggestion based on the date photos were taken.

int SEARCH_SUGGESTION_FACE

Suggestion based on faces detected in photos.

int SEARCH_SUGGESTION_LOCATION

Suggestion based on location data associated with photos.

int SEARCH_SUGGESTION_TEXT

Represents a generic text search suggestion.

int SORT_ORDER_DESC_DATE_TAKEN

Sort items in descending order by the DATE_TAKEN_MILLIS.

Inherited methods

Constants

EXTRA_ALBUM_ID

Added in API level 33
Also in R Extensions 3
public static final String EXTRA_ALBUM_ID

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.

See also:

Constant Value: "android.provider.extra.ALBUM_ID"

EXTRA_LOOPING_PLAYBACK_ENABLED

Added in API level 33
Also in R Extensions 3
public static final String EXTRA_LOOPING_PLAYBACK_ENABLED

Indicates whether to enable looping playback of media items.

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

Constant Value: "android.provider.extra.LOOPING_PLAYBACK_ENABLED"

EXTRA_MEDIA_COLLECTION_ID

Added in API level 33
Also in R Extensions 3
public static final String EXTRA_MEDIA_COLLECTION_ID

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.

Constant Value: "android.provider.extra.MEDIA_COLLECTION_ID"

EXTRA_PAGE_SIZE

Added in API level 35
Also in R Extensions 8
public static final String EXTRA_PAGE_SIZE

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.

Constant Value: "android.provider.extra.PAGE_SIZE"

EXTRA_PAGE_TOKEN

Added in API level 33
Also in R Extensions 3
public static final String EXTRA_PAGE_TOKEN

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.

Constant Value: "android.provider.extra.PAGE_TOKEN"

EXTRA_PREVIEW_THUMBNAIL

Added in API level 33
Also in R Extensions 3
public static final String EXTRA_PREVIEW_THUMBNAIL

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.

See also:

Constant Value: "android.provider.extra.PREVIEW_THUMBNAIL"

EXTRA_SORT_ORDER

public static final String EXTRA_SORT_ORDER

Extra used to specify the sorting behavior when querying from CloudMediaProvider. The value associated with this extra should be one of the integer constants defined in the ERROR(/SortOrders).

Type: INTEGER

Constant Value: "android.provider.extra.SORT_ORDER"

EXTRA_SURFACE_CONTROLLER_AUDIO_MUTE_ENABLED

Added in API level 33
Also in R Extensions 3
public static final String EXTRA_SURFACE_CONTROLLER_AUDIO_MUTE_ENABLED

Indicates whether to mute audio during preview of media items.

Constant Value: "android.provider.extra.SURFACE_CONTROLLER_AUDIO_MUTE_ENABLED"

EXTRA_SYNC_GENERATION

Added in API level 33
Also in R Extensions 3
public static final String EXTRA_SYNC_GENERATION

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.

Constant Value: "android.provider.extra.SYNC_GENERATION"

MANAGE_CLOUD_MEDIA_PROVIDERS_PERMISSION

Added in API level 33
Also in R Extensions 3
public static final String MANAGE_CLOUD_MEDIA_PROVIDERS_PERMISSION

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.

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

MEDIA_CATEGORY_TYPE_PEOPLE_AND_PETS

public static final int MEDIA_CATEGORY_TYPE_PEOPLE_AND_PETS

Represents media category related to faces of people and pets.

See also:

Constant Value: 1 (0x00000001)

PROVIDER_INTERFACE

Added in API level 33
Also in R Extensions 3
public static final String PROVIDER_INTERFACE

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

Constant Value: "android.content.action.CLOUD_MEDIA_PROVIDER"

SEARCH_SUGGESTION_ALBUM

public static final int SEARCH_SUGGESTION_ALBUM

Suggestion based on user albums.

See also:

Constant Value: 4 (0x00000004)

SEARCH_SUGGESTION_DATE

public static final int SEARCH_SUGGESTION_DATE

Suggestion based on the date photos were taken.

See also:

Constant Value: 3 (0x00000003)

SEARCH_SUGGESTION_FACE

public static final int SEARCH_SUGGESTION_FACE

Suggestion based on faces detected in photos.

See also:

Constant Value: 1 (0x00000001)

SEARCH_SUGGESTION_LOCATION

public static final int SEARCH_SUGGESTION_LOCATION

Suggestion based on location data associated with photos.

See also:

Constant Value: 2 (0x00000002)

SEARCH_SUGGESTION_TEXT

public static final int SEARCH_SUGGESTION_TEXT

Represents a generic text search suggestion. This can be treated as a default when the type of search suggestions is unknown.

See also:

Constant Value: 0 (0x00000000)

SORT_ORDER_DESC_DATE_TAKEN

public static final int SORT_ORDER_DESC_DATE_TAKEN

Sort items in descending order by the DATE_TAKEN_MILLIS.

This means the most recently taken photos or videos will appear first.

Type: INTEGER

Constant Value: 1 (0x00000001)