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 |
|
Information about what capabilities a CloudMediaProvider can support. |
|
MediaCategory represents a broader structure that a |
|
Constants related to a media collection |
|
Constants related to a media item, including |
|
MediaSet represents a cohesive collection of related unique media items, sharing a common meaningful context or theme. |
|
Represents a search suggestion provided by the |
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 |
|
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 |
static String |
Extra used to specify the sorting behavior when querying from |
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 |
static Int |
Represents media category related to faces of people and pets. |
static String |
|
static Int |
Suggestion based on user albums. |
static Int |
Suggestion based on the date photos were taken. |
static Int |
Suggestion based on faces detected in photos. |
static Int |
Suggestion based on location data associated with photos. |
static Int |
Represents a generic text search suggestion. |
static Int |
Sort items in descending order by the |
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_SORT_ORDER
static val EXTRA_SORT_ORDER: String
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 SortOrders.
Type: INTEGER
Value: "android.provider.extra.SORT_ORDER"
See Also
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"
MEDIA_CATEGORY_TYPE_PEOPLE_AND_PETS
static val MEDIA_CATEGORY_TYPE_PEOPLE_AND_PETS: Int
Represents media category related to faces of people and pets.
Value: 1
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"
SEARCH_SUGGESTION_ALBUM
static val SEARCH_SUGGESTION_ALBUM: Int
Suggestion based on user albums.
Value: 4
SEARCH_SUGGESTION_DATE
static val SEARCH_SUGGESTION_DATE: Int
Suggestion based on the date photos were taken.
Value: 3
SEARCH_SUGGESTION_FACE
static val SEARCH_SUGGESTION_FACE: Int
Suggestion based on faces detected in photos.
Value: 1
SEARCH_SUGGESTION_LOCATION
static val SEARCH_SUGGESTION_LOCATION: Int
Suggestion based on location data associated with photos.
Value: 2
SEARCH_SUGGESTION_TEXT
static val SEARCH_SUGGESTION_TEXT: Int
Represents a generic text search suggestion. This can be treated as a default when the type of search suggestions is unknown.
Value: 0
SORT_ORDER_DESC_DATE_TAKEN
static val SORT_ORDER_DESC_DATE_TAKEN: Int
Sort items in descending order by the DATE_TAKEN_MILLIS
.
This means the most recently taken photos or videos will appear first.
Type: INTEGER
Value: 1