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 |
class |
CloudMediaProviderContract.MediaCollectionInfo
Constants related to a media collection |
class |
CloudMediaProviderContract.MediaColumns
Constants related to a media item, including |
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
|
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 |
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 |
String |
PROVIDER_INTERFACE
|
Inherited methods | |
---|---|
Constants
EXTRA_ALBUM_ID
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
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.
See also:
Constant Value: "android.provider.extra.LOOPING_PLAYBACK_ENABLED"
EXTRA_MEDIA_COLLECTION_ID
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.
See also:
Constant Value: "android.provider.extra.MEDIA_COLLECTION_ID"
EXTRA_PAGE_SIZE
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
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
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_SURFACE_CONTROLLER_AUDIO_MUTE_ENABLED
public static final String EXTRA_SURFACE_CONTROLLER_AUDIO_MUTE_ENABLED
Indicates whether to mute audio during preview of media items.
See also:
Constant Value: "android.provider.extra.SURFACE_CONTROLLER_AUDIO_MUTE_ENABLED"
EXTRA_SYNC_GENERATION
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
.
See also:
Constant Value: "android.provider.extra.SYNC_GENERATION"
MANAGE_CLOUD_MEDIA_PROVIDERS_PERMISSION
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"
PROVIDER_INTERFACE
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"
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2024-06-18 UTC.