Deprecate MediaMetadata folderType and stabilize mediaType+isBrowsable
PiperOrigin-RevId: 522058915
This commit is contained in:
parent
e4194fc862
commit
3fc61bb7c7
@ -52,6 +52,9 @@
|
||||
`onAudioCapabilitiesChanged` in `AudioSink.Listener` interface, and a
|
||||
new interface `RendererCapabilities.Listener` which triggers
|
||||
`onRendererCapabilitiesChanged` events.
|
||||
* Metadata:
|
||||
* Deprecate `MediaMetadata.folderType` in favor of `isBrowsable` and
|
||||
`mediaType`.
|
||||
* DRM:
|
||||
* Reduce the visibility of several internal-only methods on
|
||||
`DefaultDrmSession` that aren't expected to be called from outside the
|
||||
|
65
api.txt
65
api.txt
@ -369,14 +369,50 @@ package androidx.media3.common {
|
||||
public final class MediaMetadata {
|
||||
method public androidx.media3.common.MediaMetadata.Builder buildUpon();
|
||||
field public static final androidx.media3.common.MediaMetadata EMPTY;
|
||||
field public static final int FOLDER_TYPE_ALBUMS = 2; // 0x2
|
||||
field public static final int FOLDER_TYPE_ARTISTS = 3; // 0x3
|
||||
field public static final int FOLDER_TYPE_GENRES = 4; // 0x4
|
||||
field public static final int FOLDER_TYPE_MIXED = 0; // 0x0
|
||||
field public static final int FOLDER_TYPE_NONE = -1; // 0xffffffff
|
||||
field public static final int FOLDER_TYPE_PLAYLISTS = 5; // 0x5
|
||||
field public static final int FOLDER_TYPE_TITLES = 1; // 0x1
|
||||
field public static final int FOLDER_TYPE_YEARS = 6; // 0x6
|
||||
field @Deprecated public static final int FOLDER_TYPE_ALBUMS = 2; // 0x2
|
||||
field @Deprecated public static final int FOLDER_TYPE_ARTISTS = 3; // 0x3
|
||||
field @Deprecated public static final int FOLDER_TYPE_GENRES = 4; // 0x4
|
||||
field @Deprecated public static final int FOLDER_TYPE_MIXED = 0; // 0x0
|
||||
field @Deprecated public static final int FOLDER_TYPE_NONE = -1; // 0xffffffff
|
||||
field @Deprecated public static final int FOLDER_TYPE_PLAYLISTS = 5; // 0x5
|
||||
field @Deprecated public static final int FOLDER_TYPE_TITLES = 1; // 0x1
|
||||
field @Deprecated public static final int FOLDER_TYPE_YEARS = 6; // 0x6
|
||||
field public static final int MEDIA_TYPE_ALBUM = 10; // 0xa
|
||||
field public static final int MEDIA_TYPE_ARTIST = 11; // 0xb
|
||||
field public static final int MEDIA_TYPE_AUDIO_BOOK = 15; // 0xf
|
||||
field public static final int MEDIA_TYPE_AUDIO_BOOK_CHAPTER = 2; // 0x2
|
||||
field public static final int MEDIA_TYPE_FOLDER_ALBUMS = 21; // 0x15
|
||||
field public static final int MEDIA_TYPE_FOLDER_ARTISTS = 22; // 0x16
|
||||
field public static final int MEDIA_TYPE_FOLDER_AUDIO_BOOKS = 26; // 0x1a
|
||||
field public static final int MEDIA_TYPE_FOLDER_GENRES = 23; // 0x17
|
||||
field public static final int MEDIA_TYPE_FOLDER_MIXED = 20; // 0x14
|
||||
field public static final int MEDIA_TYPE_FOLDER_MOVIES = 35; // 0x23
|
||||
field public static final int MEDIA_TYPE_FOLDER_NEWS = 32; // 0x20
|
||||
field public static final int MEDIA_TYPE_FOLDER_PLAYLISTS = 24; // 0x18
|
||||
field public static final int MEDIA_TYPE_FOLDER_PODCASTS = 27; // 0x1b
|
||||
field public static final int MEDIA_TYPE_FOLDER_RADIO_STATIONS = 31; // 0x1f
|
||||
field public static final int MEDIA_TYPE_FOLDER_TRAILERS = 34; // 0x22
|
||||
field public static final int MEDIA_TYPE_FOLDER_TV_CHANNELS = 28; // 0x1c
|
||||
field public static final int MEDIA_TYPE_FOLDER_TV_SERIES = 29; // 0x1d
|
||||
field public static final int MEDIA_TYPE_FOLDER_TV_SHOWS = 30; // 0x1e
|
||||
field public static final int MEDIA_TYPE_FOLDER_VIDEOS = 33; // 0x21
|
||||
field public static final int MEDIA_TYPE_FOLDER_YEARS = 25; // 0x19
|
||||
field public static final int MEDIA_TYPE_GENRE = 12; // 0xc
|
||||
field public static final int MEDIA_TYPE_MIXED = 0; // 0x0
|
||||
field public static final int MEDIA_TYPE_MOVIE = 8; // 0x8
|
||||
field public static final int MEDIA_TYPE_MUSIC = 1; // 0x1
|
||||
field public static final int MEDIA_TYPE_NEWS = 5; // 0x5
|
||||
field public static final int MEDIA_TYPE_PLAYLIST = 13; // 0xd
|
||||
field public static final int MEDIA_TYPE_PODCAST = 16; // 0x10
|
||||
field public static final int MEDIA_TYPE_PODCAST_EPISODE = 3; // 0x3
|
||||
field public static final int MEDIA_TYPE_RADIO_STATION = 4; // 0x4
|
||||
field public static final int MEDIA_TYPE_TRAILER = 7; // 0x7
|
||||
field public static final int MEDIA_TYPE_TV_CHANNEL = 17; // 0x11
|
||||
field public static final int MEDIA_TYPE_TV_SEASON = 19; // 0x13
|
||||
field public static final int MEDIA_TYPE_TV_SERIES = 18; // 0x12
|
||||
field public static final int MEDIA_TYPE_TV_SHOW = 9; // 0x9
|
||||
field public static final int MEDIA_TYPE_VIDEO = 6; // 0x6
|
||||
field public static final int MEDIA_TYPE_YEAR = 14; // 0xe
|
||||
field public static final int PICTURE_TYPE_ARTIST_PERFORMER = 8; // 0x8
|
||||
field public static final int PICTURE_TYPE_A_BRIGHT_COLORED_FISH = 17; // 0x11
|
||||
field public static final int PICTURE_TYPE_BACK_COVER = 4; // 0x4
|
||||
@ -411,9 +447,11 @@ package androidx.media3.common {
|
||||
field @Nullable public final Integer discNumber;
|
||||
field @Nullable public final CharSequence displayTitle;
|
||||
field @Nullable public final android.os.Bundle extras;
|
||||
field @Nullable @androidx.media3.common.MediaMetadata.FolderType public final Integer folderType;
|
||||
field @Deprecated @Nullable @androidx.media3.common.MediaMetadata.FolderType public final Integer folderType;
|
||||
field @Nullable public final CharSequence genre;
|
||||
field @Nullable public final Boolean isBrowsable;
|
||||
field @Nullable public final Boolean isPlayable;
|
||||
field @Nullable @androidx.media3.common.MediaMetadata.MediaType public final Integer mediaType;
|
||||
field @Nullable public final androidx.media3.common.Rating overallRating;
|
||||
field @Nullable public final Integer recordingDay;
|
||||
field @Nullable public final Integer recordingMonth;
|
||||
@ -447,9 +485,11 @@ package androidx.media3.common {
|
||||
method public androidx.media3.common.MediaMetadata.Builder setDiscNumber(@Nullable Integer);
|
||||
method public androidx.media3.common.MediaMetadata.Builder setDisplayTitle(@Nullable CharSequence);
|
||||
method public androidx.media3.common.MediaMetadata.Builder setExtras(@Nullable android.os.Bundle);
|
||||
method public androidx.media3.common.MediaMetadata.Builder setFolderType(@Nullable @androidx.media3.common.MediaMetadata.FolderType Integer);
|
||||
method @Deprecated public androidx.media3.common.MediaMetadata.Builder setFolderType(@Nullable @androidx.media3.common.MediaMetadata.FolderType Integer);
|
||||
method public androidx.media3.common.MediaMetadata.Builder setGenre(@Nullable CharSequence);
|
||||
method public androidx.media3.common.MediaMetadata.Builder setIsBrowsable(@Nullable Boolean);
|
||||
method public androidx.media3.common.MediaMetadata.Builder setIsPlayable(@Nullable Boolean);
|
||||
method public androidx.media3.common.MediaMetadata.Builder setMediaType(@Nullable @androidx.media3.common.MediaMetadata.MediaType Integer);
|
||||
method public androidx.media3.common.MediaMetadata.Builder setOverallRating(@Nullable androidx.media3.common.Rating);
|
||||
method public androidx.media3.common.MediaMetadata.Builder setRecordingDay(@IntRange(from=1, to=31) @Nullable Integer);
|
||||
method public androidx.media3.common.MediaMetadata.Builder setRecordingMonth(@IntRange(from=1, to=12) @Nullable Integer);
|
||||
@ -467,7 +507,10 @@ package androidx.media3.common {
|
||||
method public androidx.media3.common.MediaMetadata.Builder setWriter(@Nullable CharSequence);
|
||||
}
|
||||
|
||||
@IntDef({androidx.media3.common.MediaMetadata.FOLDER_TYPE_NONE, androidx.media3.common.MediaMetadata.FOLDER_TYPE_MIXED, androidx.media3.common.MediaMetadata.FOLDER_TYPE_TITLES, androidx.media3.common.MediaMetadata.FOLDER_TYPE_ALBUMS, androidx.media3.common.MediaMetadata.FOLDER_TYPE_ARTISTS, androidx.media3.common.MediaMetadata.FOLDER_TYPE_GENRES, androidx.media3.common.MediaMetadata.FOLDER_TYPE_PLAYLISTS, androidx.media3.common.MediaMetadata.FOLDER_TYPE_YEARS}) @java.lang.annotation.Documented @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.SOURCE) @java.lang.annotation.Target({java.lang.annotation.ElementType.FIELD, java.lang.annotation.ElementType.METHOD, java.lang.annotation.ElementType.PARAMETER, java.lang.annotation.ElementType.LOCAL_VARIABLE, java.lang.annotation.ElementType.TYPE_USE}) public static @interface MediaMetadata.FolderType {
|
||||
@Deprecated @IntDef({androidx.media3.common.MediaMetadata.FOLDER_TYPE_NONE, androidx.media3.common.MediaMetadata.FOLDER_TYPE_MIXED, androidx.media3.common.MediaMetadata.FOLDER_TYPE_TITLES, androidx.media3.common.MediaMetadata.FOLDER_TYPE_ALBUMS, androidx.media3.common.MediaMetadata.FOLDER_TYPE_ARTISTS, androidx.media3.common.MediaMetadata.FOLDER_TYPE_GENRES, androidx.media3.common.MediaMetadata.FOLDER_TYPE_PLAYLISTS, androidx.media3.common.MediaMetadata.FOLDER_TYPE_YEARS}) @java.lang.annotation.Documented @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.SOURCE) @java.lang.annotation.Target({java.lang.annotation.ElementType.FIELD, java.lang.annotation.ElementType.METHOD, java.lang.annotation.ElementType.PARAMETER, java.lang.annotation.ElementType.LOCAL_VARIABLE, java.lang.annotation.ElementType.TYPE_USE}) public static @interface MediaMetadata.FolderType {
|
||||
}
|
||||
|
||||
@IntDef({androidx.media3.common.MediaMetadata.MEDIA_TYPE_MIXED, androidx.media3.common.MediaMetadata.MEDIA_TYPE_MUSIC, androidx.media3.common.MediaMetadata.MEDIA_TYPE_AUDIO_BOOK_CHAPTER, androidx.media3.common.MediaMetadata.MEDIA_TYPE_PODCAST_EPISODE, androidx.media3.common.MediaMetadata.MEDIA_TYPE_RADIO_STATION, androidx.media3.common.MediaMetadata.MEDIA_TYPE_NEWS, androidx.media3.common.MediaMetadata.MEDIA_TYPE_VIDEO, androidx.media3.common.MediaMetadata.MEDIA_TYPE_TRAILER, androidx.media3.common.MediaMetadata.MEDIA_TYPE_MOVIE, androidx.media3.common.MediaMetadata.MEDIA_TYPE_TV_SHOW, androidx.media3.common.MediaMetadata.MEDIA_TYPE_ALBUM, androidx.media3.common.MediaMetadata.MEDIA_TYPE_ARTIST, androidx.media3.common.MediaMetadata.MEDIA_TYPE_GENRE, androidx.media3.common.MediaMetadata.MEDIA_TYPE_PLAYLIST, androidx.media3.common.MediaMetadata.MEDIA_TYPE_YEAR, androidx.media3.common.MediaMetadata.MEDIA_TYPE_AUDIO_BOOK, androidx.media3.common.MediaMetadata.MEDIA_TYPE_PODCAST, androidx.media3.common.MediaMetadata.MEDIA_TYPE_TV_CHANNEL, androidx.media3.common.MediaMetadata.MEDIA_TYPE_TV_SERIES, androidx.media3.common.MediaMetadata.MEDIA_TYPE_TV_SEASON, androidx.media3.common.MediaMetadata.MEDIA_TYPE_FOLDER_MIXED, androidx.media3.common.MediaMetadata.MEDIA_TYPE_FOLDER_ALBUMS, androidx.media3.common.MediaMetadata.MEDIA_TYPE_FOLDER_ARTISTS, androidx.media3.common.MediaMetadata.MEDIA_TYPE_FOLDER_GENRES, androidx.media3.common.MediaMetadata.MEDIA_TYPE_FOLDER_PLAYLISTS, androidx.media3.common.MediaMetadata.MEDIA_TYPE_FOLDER_YEARS, androidx.media3.common.MediaMetadata.MEDIA_TYPE_FOLDER_AUDIO_BOOKS, androidx.media3.common.MediaMetadata.MEDIA_TYPE_FOLDER_PODCASTS, androidx.media3.common.MediaMetadata.MEDIA_TYPE_FOLDER_TV_CHANNELS, androidx.media3.common.MediaMetadata.MEDIA_TYPE_FOLDER_TV_SERIES, androidx.media3.common.MediaMetadata.MEDIA_TYPE_FOLDER_TV_SHOWS, androidx.media3.common.MediaMetadata.MEDIA_TYPE_FOLDER_RADIO_STATIONS, androidx.media3.common.MediaMetadata.MEDIA_TYPE_FOLDER_NEWS, androidx.media3.common.MediaMetadata.MEDIA_TYPE_FOLDER_VIDEOS, androidx.media3.common.MediaMetadata.MEDIA_TYPE_FOLDER_TRAILERS, androidx.media3.common.MediaMetadata.MEDIA_TYPE_FOLDER_MOVIES}) @java.lang.annotation.Documented @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.SOURCE) @java.lang.annotation.Target(java.lang.annotation.ElementType.TYPE_USE) public static @interface MediaMetadata.MediaType {
|
||||
}
|
||||
|
||||
@IntDef({androidx.media3.common.MediaMetadata.PICTURE_TYPE_OTHER, androidx.media3.common.MediaMetadata.PICTURE_TYPE_FILE_ICON, androidx.media3.common.MediaMetadata.PICTURE_TYPE_FILE_ICON_OTHER, androidx.media3.common.MediaMetadata.PICTURE_TYPE_FRONT_COVER, androidx.media3.common.MediaMetadata.PICTURE_TYPE_BACK_COVER, androidx.media3.common.MediaMetadata.PICTURE_TYPE_LEAFLET_PAGE, androidx.media3.common.MediaMetadata.PICTURE_TYPE_MEDIA, androidx.media3.common.MediaMetadata.PICTURE_TYPE_LEAD_ARTIST_PERFORMER, androidx.media3.common.MediaMetadata.PICTURE_TYPE_ARTIST_PERFORMER, androidx.media3.common.MediaMetadata.PICTURE_TYPE_CONDUCTOR, androidx.media3.common.MediaMetadata.PICTURE_TYPE_BAND_ORCHESTRA, androidx.media3.common.MediaMetadata.PICTURE_TYPE_COMPOSER, androidx.media3.common.MediaMetadata.PICTURE_TYPE_LYRICIST, androidx.media3.common.MediaMetadata.PICTURE_TYPE_RECORDING_LOCATION, androidx.media3.common.MediaMetadata.PICTURE_TYPE_DURING_RECORDING, androidx.media3.common.MediaMetadata.PICTURE_TYPE_DURING_PERFORMANCE, androidx.media3.common.MediaMetadata.PICTURE_TYPE_MOVIE_VIDEO_SCREEN_CAPTURE, androidx.media3.common.MediaMetadata.PICTURE_TYPE_A_BRIGHT_COLORED_FISH, androidx.media3.common.MediaMetadata.PICTURE_TYPE_ILLUSTRATION, androidx.media3.common.MediaMetadata.PICTURE_TYPE_BAND_ARTIST_LOGO, androidx.media3.common.MediaMetadata.PICTURE_TYPE_PUBLISHER_STUDIO_LOGO}) @java.lang.annotation.Documented @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.SOURCE) @java.lang.annotation.Target({java.lang.annotation.ElementType.FIELD, java.lang.annotation.ElementType.METHOD, java.lang.annotation.ElementType.PARAMETER, java.lang.annotation.ElementType.LOCAL_VARIABLE, java.lang.annotation.ElementType.TYPE_USE}) public static @interface MediaMetadata.PictureType {
|
||||
|
@ -60,7 +60,11 @@ public final class MediaMetadata implements Bundleable {
|
||||
@Nullable private Uri artworkUri;
|
||||
@Nullable private Integer trackNumber;
|
||||
@Nullable private Integer totalTrackCount;
|
||||
@Nullable private @FolderType Integer folderType;
|
||||
|
||||
@SuppressWarnings("deprecation") // Builder for deprecated field.
|
||||
@Nullable
|
||||
private @FolderType Integer folderType;
|
||||
|
||||
@Nullable private Boolean isBrowsable;
|
||||
@Nullable private Boolean isPlayable;
|
||||
@Nullable private Integer recordingYear;
|
||||
@ -82,6 +86,7 @@ public final class MediaMetadata implements Bundleable {
|
||||
|
||||
public Builder() {}
|
||||
|
||||
@SuppressWarnings("deprecation") // Assigning from deprecated fields.
|
||||
private Builder(MediaMetadata mediaMetadata) {
|
||||
this.title = mediaMetadata.title;
|
||||
this.artist = mediaMetadata.artist;
|
||||
@ -251,9 +256,11 @@ public final class MediaMetadata implements Bundleable {
|
||||
/**
|
||||
* Sets the {@link FolderType}.
|
||||
*
|
||||
* <p>This method will be deprecated. Use {@link #setIsBrowsable} to indicate if an item is a
|
||||
* browsable folder and use {@link #setMediaType} to indicate the type of the folder.
|
||||
* @deprecated Use {@link #setIsBrowsable} to indicate if an item is a browsable folder and use
|
||||
* {@link #setMediaType} to indicate the type of the folder.
|
||||
*/
|
||||
@SuppressWarnings("deprecation") // Using deprecated type.
|
||||
@Deprecated
|
||||
@CanIgnoreReturnValue
|
||||
public Builder setFolderType(@Nullable @FolderType Integer folderType) {
|
||||
this.folderType = folderType;
|
||||
@ -261,7 +268,6 @@ public final class MediaMetadata implements Bundleable {
|
||||
}
|
||||
|
||||
/** Sets whether the media is a browsable folder. */
|
||||
@UnstableApi
|
||||
@CanIgnoreReturnValue
|
||||
public Builder setIsBrowsable(@Nullable Boolean isBrowsable) {
|
||||
this.isBrowsable = isBrowsable;
|
||||
@ -402,7 +408,6 @@ public final class MediaMetadata implements Bundleable {
|
||||
|
||||
/** Sets the {@link MediaType}. */
|
||||
@CanIgnoreReturnValue
|
||||
@UnstableApi
|
||||
public Builder setMediaType(@Nullable @MediaType Integer mediaType) {
|
||||
this.mediaType = mediaType;
|
||||
return this;
|
||||
@ -458,6 +463,7 @@ public final class MediaMetadata implements Bundleable {
|
||||
}
|
||||
|
||||
/** Populates all the fields from {@code mediaMetadata}, provided they are non-null. */
|
||||
@SuppressWarnings("deprecation") // Populating deprecated fields.
|
||||
@CanIgnoreReturnValue
|
||||
@UnstableApi
|
||||
public Builder populate(@Nullable MediaMetadata mediaMetadata) {
|
||||
@ -595,7 +601,6 @@ public final class MediaMetadata implements Bundleable {
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
@Target(TYPE_USE)
|
||||
@UnstableApi
|
||||
@IntDef({
|
||||
MEDIA_TYPE_MIXED,
|
||||
MEDIA_TYPE_MUSIC,
|
||||
@ -637,111 +642,111 @@ public final class MediaMetadata implements Bundleable {
|
||||
public @interface MediaType {}
|
||||
|
||||
/** Media of undetermined type or a mix of multiple {@linkplain MediaType media types}. */
|
||||
@UnstableApi public static final int MEDIA_TYPE_MIXED = 0;
|
||||
public static final int MEDIA_TYPE_MIXED = 0;
|
||||
/** {@link MediaType} for music. */
|
||||
@UnstableApi public static final int MEDIA_TYPE_MUSIC = 1;
|
||||
public static final int MEDIA_TYPE_MUSIC = 1;
|
||||
/** {@link MediaType} for an audio book chapter. */
|
||||
@UnstableApi public static final int MEDIA_TYPE_AUDIO_BOOK_CHAPTER = 2;
|
||||
public static final int MEDIA_TYPE_AUDIO_BOOK_CHAPTER = 2;
|
||||
/** {@link MediaType} for a podcast episode. */
|
||||
@UnstableApi public static final int MEDIA_TYPE_PODCAST_EPISODE = 3;
|
||||
public static final int MEDIA_TYPE_PODCAST_EPISODE = 3;
|
||||
/** {@link MediaType} for a radio station. */
|
||||
@UnstableApi public static final int MEDIA_TYPE_RADIO_STATION = 4;
|
||||
public static final int MEDIA_TYPE_RADIO_STATION = 4;
|
||||
/** {@link MediaType} for news. */
|
||||
@UnstableApi public static final int MEDIA_TYPE_NEWS = 5;
|
||||
public static final int MEDIA_TYPE_NEWS = 5;
|
||||
/** {@link MediaType} for a video. */
|
||||
@UnstableApi public static final int MEDIA_TYPE_VIDEO = 6;
|
||||
public static final int MEDIA_TYPE_VIDEO = 6;
|
||||
/** {@link MediaType} for a movie trailer. */
|
||||
@UnstableApi public static final int MEDIA_TYPE_TRAILER = 7;
|
||||
public static final int MEDIA_TYPE_TRAILER = 7;
|
||||
/** {@link MediaType} for a movie. */
|
||||
@UnstableApi public static final int MEDIA_TYPE_MOVIE = 8;
|
||||
public static final int MEDIA_TYPE_MOVIE = 8;
|
||||
/** {@link MediaType} for a TV show. */
|
||||
@UnstableApi public static final int MEDIA_TYPE_TV_SHOW = 9;
|
||||
public static final int MEDIA_TYPE_TV_SHOW = 9;
|
||||
/**
|
||||
* {@link MediaType} for a group of items (e.g., {@link #MEDIA_TYPE_MUSIC music}) belonging to an
|
||||
* album.
|
||||
*/
|
||||
@UnstableApi public static final int MEDIA_TYPE_ALBUM = 10;
|
||||
public static final int MEDIA_TYPE_ALBUM = 10;
|
||||
/**
|
||||
* {@link MediaType} for a group of items (e.g., {@link #MEDIA_TYPE_MUSIC music}) from the same
|
||||
* artist.
|
||||
*/
|
||||
@UnstableApi public static final int MEDIA_TYPE_ARTIST = 11;
|
||||
public static final int MEDIA_TYPE_ARTIST = 11;
|
||||
/**
|
||||
* {@link MediaType} for a group of items (e.g., {@link #MEDIA_TYPE_MUSIC music}) of the same
|
||||
* genre.
|
||||
*/
|
||||
@UnstableApi public static final int MEDIA_TYPE_GENRE = 12;
|
||||
public static final int MEDIA_TYPE_GENRE = 12;
|
||||
/**
|
||||
* {@link MediaType} for a group of items (e.g., {@link #MEDIA_TYPE_MUSIC music}) forming a
|
||||
* playlist.
|
||||
*/
|
||||
@UnstableApi public static final int MEDIA_TYPE_PLAYLIST = 13;
|
||||
public static final int MEDIA_TYPE_PLAYLIST = 13;
|
||||
/**
|
||||
* {@link MediaType} for a group of items (e.g., {@link #MEDIA_TYPE_MUSIC music}) from the same
|
||||
* year.
|
||||
*/
|
||||
@UnstableApi public static final int MEDIA_TYPE_YEAR = 14;
|
||||
public static final int MEDIA_TYPE_YEAR = 14;
|
||||
/**
|
||||
* {@link MediaType} for a group of items forming an audio book. Items in this group are typically
|
||||
* of type {@link #MEDIA_TYPE_AUDIO_BOOK_CHAPTER}.
|
||||
*/
|
||||
@UnstableApi public static final int MEDIA_TYPE_AUDIO_BOOK = 15;
|
||||
public static final int MEDIA_TYPE_AUDIO_BOOK = 15;
|
||||
/**
|
||||
* {@link MediaType} for a group of items belonging to a podcast. Items in this group are
|
||||
* typically of type {@link #MEDIA_TYPE_PODCAST_EPISODE}.
|
||||
*/
|
||||
@UnstableApi public static final int MEDIA_TYPE_PODCAST = 16;
|
||||
public static final int MEDIA_TYPE_PODCAST = 16;
|
||||
/**
|
||||
* {@link MediaType} for a group of items that are part of a TV channel. Items in this group are
|
||||
* typically of type {@link #MEDIA_TYPE_TV_SHOW}, {@link #MEDIA_TYPE_TV_SERIES} or {@link
|
||||
* #MEDIA_TYPE_MOVIE}.
|
||||
*/
|
||||
@UnstableApi public static final int MEDIA_TYPE_TV_CHANNEL = 17;
|
||||
public static final int MEDIA_TYPE_TV_CHANNEL = 17;
|
||||
/**
|
||||
* {@link MediaType} for a group of items that are part of a TV series. Items in this group are
|
||||
* typically of type {@link #MEDIA_TYPE_TV_SHOW} or {@link #MEDIA_TYPE_TV_SEASON}.
|
||||
*/
|
||||
@UnstableApi public static final int MEDIA_TYPE_TV_SERIES = 18;
|
||||
public static final int MEDIA_TYPE_TV_SERIES = 18;
|
||||
/**
|
||||
* {@link MediaType} for a group of items that are part of a TV series. Items in this group are
|
||||
* typically of type {@link #MEDIA_TYPE_TV_SHOW}.
|
||||
*/
|
||||
@UnstableApi public static final int MEDIA_TYPE_TV_SEASON = 19;
|
||||
public static final int MEDIA_TYPE_TV_SEASON = 19;
|
||||
/** {@link MediaType} for a folder with mixed or undetermined content. */
|
||||
@UnstableApi public static final int MEDIA_TYPE_FOLDER_MIXED = 20;
|
||||
public static final int MEDIA_TYPE_FOLDER_MIXED = 20;
|
||||
/** {@link MediaType} for a folder containing {@linkplain #MEDIA_TYPE_ALBUM albums}. */
|
||||
@UnstableApi public static final int MEDIA_TYPE_FOLDER_ALBUMS = 21;
|
||||
public static final int MEDIA_TYPE_FOLDER_ALBUMS = 21;
|
||||
/** {@link MediaType} for a folder containing {@linkplain #FIELD_ARTIST artists}. */
|
||||
@UnstableApi public static final int MEDIA_TYPE_FOLDER_ARTISTS = 22;
|
||||
public static final int MEDIA_TYPE_FOLDER_ARTISTS = 22;
|
||||
/** {@link MediaType} for a folder containing {@linkplain #MEDIA_TYPE_GENRE genres}. */
|
||||
@UnstableApi public static final int MEDIA_TYPE_FOLDER_GENRES = 23;
|
||||
public static final int MEDIA_TYPE_FOLDER_GENRES = 23;
|
||||
/** {@link MediaType} for a folder containing {@linkplain #MEDIA_TYPE_PLAYLIST playlists}. */
|
||||
@UnstableApi public static final int MEDIA_TYPE_FOLDER_PLAYLISTS = 24;
|
||||
public static final int MEDIA_TYPE_FOLDER_PLAYLISTS = 24;
|
||||
/** {@link MediaType} for a folder containing {@linkplain #MEDIA_TYPE_YEAR years}. */
|
||||
@UnstableApi public static final int MEDIA_TYPE_FOLDER_YEARS = 25;
|
||||
public static final int MEDIA_TYPE_FOLDER_YEARS = 25;
|
||||
/** {@link MediaType} for a folder containing {@linkplain #MEDIA_TYPE_AUDIO_BOOK audio books}. */
|
||||
@UnstableApi public static final int MEDIA_TYPE_FOLDER_AUDIO_BOOKS = 26;
|
||||
public static final int MEDIA_TYPE_FOLDER_AUDIO_BOOKS = 26;
|
||||
/** {@link MediaType} for a folder containing {@linkplain #MEDIA_TYPE_PODCAST podcasts}. */
|
||||
@UnstableApi public static final int MEDIA_TYPE_FOLDER_PODCASTS = 27;
|
||||
public static final int MEDIA_TYPE_FOLDER_PODCASTS = 27;
|
||||
/** {@link MediaType} for a folder containing {@linkplain #MEDIA_TYPE_TV_CHANNEL TV channels}. */
|
||||
@UnstableApi public static final int MEDIA_TYPE_FOLDER_TV_CHANNELS = 28;
|
||||
public static final int MEDIA_TYPE_FOLDER_TV_CHANNELS = 28;
|
||||
/** {@link MediaType} for a folder containing {@linkplain #MEDIA_TYPE_TV_SERIES TV series}. */
|
||||
@UnstableApi public static final int MEDIA_TYPE_FOLDER_TV_SERIES = 29;
|
||||
public static final int MEDIA_TYPE_FOLDER_TV_SERIES = 29;
|
||||
/** {@link MediaType} for a folder containing {@linkplain #MEDIA_TYPE_TV_SHOW TV shows}. */
|
||||
@UnstableApi public static final int MEDIA_TYPE_FOLDER_TV_SHOWS = 30;
|
||||
public static final int MEDIA_TYPE_FOLDER_TV_SHOWS = 30;
|
||||
/**
|
||||
* {@link MediaType} for a folder containing {@linkplain #MEDIA_TYPE_RADIO_STATION radio
|
||||
* stations}.
|
||||
*/
|
||||
@UnstableApi public static final int MEDIA_TYPE_FOLDER_RADIO_STATIONS = 31;
|
||||
public static final int MEDIA_TYPE_FOLDER_RADIO_STATIONS = 31;
|
||||
/** {@link MediaType} for a folder containing {@linkplain #MEDIA_TYPE_NEWS news}. */
|
||||
@UnstableApi public static final int MEDIA_TYPE_FOLDER_NEWS = 32;
|
||||
public static final int MEDIA_TYPE_FOLDER_NEWS = 32;
|
||||
/** {@link MediaType} for a folder containing {@linkplain #MEDIA_TYPE_VIDEO videos}. */
|
||||
@UnstableApi public static final int MEDIA_TYPE_FOLDER_VIDEOS = 33;
|
||||
public static final int MEDIA_TYPE_FOLDER_VIDEOS = 33;
|
||||
/** {@link MediaType} for a folder containing {@linkplain #MEDIA_TYPE_TRAILER movie trailers}. */
|
||||
@UnstableApi public static final int MEDIA_TYPE_FOLDER_TRAILERS = 34;
|
||||
public static final int MEDIA_TYPE_FOLDER_TRAILERS = 34;
|
||||
/** {@link MediaType} for a folder containing {@linkplain #MEDIA_TYPE_MOVIE movies}. */
|
||||
@UnstableApi public static final int MEDIA_TYPE_FOLDER_MOVIES = 35;
|
||||
public static final int MEDIA_TYPE_FOLDER_MOVIES = 35;
|
||||
|
||||
/**
|
||||
* The folder type of the media item.
|
||||
@ -753,12 +758,17 @@ public final class MediaMetadata implements Bundleable {
|
||||
* <p>One of {@link #FOLDER_TYPE_NONE}, {@link #FOLDER_TYPE_MIXED}, {@link #FOLDER_TYPE_TITLES},
|
||||
* {@link #FOLDER_TYPE_ALBUMS}, {@link #FOLDER_TYPE_ARTISTS}, {@link #FOLDER_TYPE_GENRES}, {@link
|
||||
* #FOLDER_TYPE_PLAYLISTS} or {@link #FOLDER_TYPE_YEARS}.
|
||||
*
|
||||
* @deprecated Use {@link #isBrowsable} to indicate if an item is a browsable folder and use
|
||||
* {@link #mediaType} to indicate the type of the folder.
|
||||
*/
|
||||
// @Target list includes both 'default' targets and TYPE_USE, to ensure backwards compatibility
|
||||
// with Kotlin usages from before TYPE_USE was added.
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
@Target({FIELD, METHOD, PARAMETER, LOCAL_VARIABLE, TYPE_USE})
|
||||
@Deprecated
|
||||
@SuppressWarnings("deprecation") // Defining deprecated constants.
|
||||
@IntDef({
|
||||
FOLDER_TYPE_NONE,
|
||||
FOLDER_TYPE_MIXED,
|
||||
@ -771,22 +781,60 @@ public final class MediaMetadata implements Bundleable {
|
||||
})
|
||||
public @interface FolderType {}
|
||||
|
||||
/** Type for an item that is not a folder. */
|
||||
public static final int FOLDER_TYPE_NONE = -1;
|
||||
/** Type for a folder containing media of mixed types. */
|
||||
public static final int FOLDER_TYPE_MIXED = 0;
|
||||
/** Type for a folder containing only playable media. */
|
||||
public static final int FOLDER_TYPE_TITLES = 1;
|
||||
/** Type for a folder containing media categorized by album. */
|
||||
public static final int FOLDER_TYPE_ALBUMS = 2;
|
||||
/** Type for a folder containing media categorized by artist. */
|
||||
public static final int FOLDER_TYPE_ARTISTS = 3;
|
||||
/** Type for a folder containing media categorized by genre. */
|
||||
public static final int FOLDER_TYPE_GENRES = 4;
|
||||
/** Type for a folder containing a playlist. */
|
||||
public static final int FOLDER_TYPE_PLAYLISTS = 5;
|
||||
/** Type for a folder containing media categorized by year. */
|
||||
public static final int FOLDER_TYPE_YEARS = 6;
|
||||
/**
|
||||
* Type for an item that is not a folder.
|
||||
*
|
||||
* @deprecated Use {@link #isBrowsable} set to false instead.
|
||||
*/
|
||||
@Deprecated public static final int FOLDER_TYPE_NONE = -1;
|
||||
/**
|
||||
* Type for a folder containing media of mixed types.
|
||||
*
|
||||
* @deprecated Use {@link #isBrowsable} set to true and {@link #mediaType} set to {@link
|
||||
* #MEDIA_TYPE_FOLDER_MIXED} instead.
|
||||
*/
|
||||
@Deprecated public static final int FOLDER_TYPE_MIXED = 0;
|
||||
/**
|
||||
* Type for a folder containing only playable media.
|
||||
*
|
||||
* @deprecated Use {@link #isBrowsable} set to true instead.
|
||||
*/
|
||||
@Deprecated public static final int FOLDER_TYPE_TITLES = 1;
|
||||
/**
|
||||
* Type for a folder containing media categorized by album.
|
||||
*
|
||||
* @deprecated Use {@link #isBrowsable} set to true and {@link #mediaType} set to {@link
|
||||
* #MEDIA_TYPE_FOLDER_ALBUMS} instead.
|
||||
*/
|
||||
@Deprecated public static final int FOLDER_TYPE_ALBUMS = 2;
|
||||
/**
|
||||
* Type for a folder containing media categorized by artist.
|
||||
*
|
||||
* @deprecated Use {@link #isBrowsable} set to true and {@link #mediaType} set to {@link
|
||||
* #MEDIA_TYPE_FOLDER_ARTISTS} instead.
|
||||
*/
|
||||
@Deprecated public static final int FOLDER_TYPE_ARTISTS = 3;
|
||||
/**
|
||||
* Type for a folder containing media categorized by genre.
|
||||
*
|
||||
* @deprecated Use {@link #isBrowsable} set to true and {@link #mediaType} set to {@link
|
||||
* #MEDIA_TYPE_FOLDER_GENRES} instead.
|
||||
*/
|
||||
@Deprecated public static final int FOLDER_TYPE_GENRES = 4;
|
||||
/**
|
||||
* Type for a folder containing a playlist.
|
||||
*
|
||||
* @deprecated Use {@link #isBrowsable} set to true and {@link #mediaType} set to {@link
|
||||
* #MEDIA_TYPE_FOLDER_PLAYLISTS} instead.
|
||||
*/
|
||||
@Deprecated public static final int FOLDER_TYPE_PLAYLISTS = 5;
|
||||
/**
|
||||
* Type for a folder containing media categorized by year.
|
||||
*
|
||||
* @deprecated Use {@link #isBrowsable} set to true and {@link #mediaType} set to {@link
|
||||
* #MEDIA_TYPE_FOLDER_YEARS} instead.
|
||||
*/
|
||||
@Deprecated public static final int FOLDER_TYPE_YEARS = 6;
|
||||
|
||||
/**
|
||||
* The picture type of the artwork.
|
||||
@ -895,12 +943,15 @@ public final class MediaMetadata implements Bundleable {
|
||||
/**
|
||||
* Optional {@link FolderType}.
|
||||
*
|
||||
* <p>This field will be deprecated. Use {@link #isBrowsable} to indicate if an item is a
|
||||
* browsable folder and use {@link #mediaType} to indicate the type of the folder.
|
||||
* @deprecated Use {@link #isBrowsable} to indicate if an item is a browsable folder and use
|
||||
* {@link #mediaType} to indicate the type of the folder.
|
||||
*/
|
||||
@Nullable public final @FolderType Integer folderType;
|
||||
@SuppressWarnings("deprecation") // Defining field of deprecated type.
|
||||
@Deprecated
|
||||
@Nullable
|
||||
public final @FolderType Integer folderType;
|
||||
/** Optional boolean to indicate that the media is a browsable folder. */
|
||||
@UnstableApi @Nullable public final Boolean isBrowsable;
|
||||
@Nullable public final Boolean isBrowsable;
|
||||
/** Optional boolean to indicate that the media is playable. */
|
||||
@Nullable public final Boolean isPlayable;
|
||||
/**
|
||||
@ -953,7 +1004,7 @@ public final class MediaMetadata implements Bundleable {
|
||||
/** Optional name of the station streaming the media. */
|
||||
@Nullable public final CharSequence station;
|
||||
/** Optional {@link MediaType}. */
|
||||
@UnstableApi @Nullable public final @MediaType Integer mediaType;
|
||||
@Nullable public final @MediaType Integer mediaType;
|
||||
|
||||
/**
|
||||
* Optional extras {@link Bundle}.
|
||||
@ -963,6 +1014,7 @@ public final class MediaMetadata implements Bundleable {
|
||||
*/
|
||||
@Nullable public final Bundle extras;
|
||||
|
||||
@SuppressWarnings("deprecation") // Assigning deprecated fields.
|
||||
private MediaMetadata(Builder builder) {
|
||||
// Handle compatibility for deprecated fields.
|
||||
@Nullable Boolean isBrowsable = builder.isBrowsable;
|
||||
@ -1021,6 +1073,7 @@ public final class MediaMetadata implements Bundleable {
|
||||
return new Builder(/* mediaMetadata= */ this);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation") // Comparing deprecated fields.
|
||||
@Override
|
||||
public boolean equals(@Nullable Object obj) {
|
||||
if (this == obj) {
|
||||
@ -1064,6 +1117,7 @@ public final class MediaMetadata implements Bundleable {
|
||||
&& Util.areEqual(mediaType, that.mediaType);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation") // Hashing deprecated fields.
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(
|
||||
@ -1138,6 +1192,7 @@ public final class MediaMetadata implements Bundleable {
|
||||
private static final String FIELD_IS_BROWSABLE = Util.intToStringMaxRadix(32);
|
||||
private static final String FIELD_EXTRAS = Util.intToStringMaxRadix(1000);
|
||||
|
||||
@SuppressWarnings("deprecation") // Bundling deprecated fields.
|
||||
@UnstableApi
|
||||
@Override
|
||||
public Bundle toBundle() {
|
||||
@ -1247,6 +1302,7 @@ public final class MediaMetadata implements Bundleable {
|
||||
/** Object that can restore {@link MediaMetadata} from a {@link Bundle}. */
|
||||
@UnstableApi public static final Creator<MediaMetadata> CREATOR = MediaMetadata::fromBundle;
|
||||
|
||||
@SuppressWarnings("deprecation") // Unbundling deprecated fields.
|
||||
private static MediaMetadata fromBundle(Bundle bundle) {
|
||||
Builder builder = new Builder();
|
||||
builder
|
||||
@ -1329,6 +1385,7 @@ public final class MediaMetadata implements Bundleable {
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation") // Converting deprecated field.
|
||||
private static @FolderType int getFolderTypeFromMediaType(@MediaType int mediaType) {
|
||||
switch (mediaType) {
|
||||
case MEDIA_TYPE_ALBUM:
|
||||
@ -1378,6 +1435,7 @@ public final class MediaMetadata implements Bundleable {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation") // Converting deprecated field.
|
||||
private static @MediaType int getMediaTypeFromFolderType(@FolderType int folderType) {
|
||||
switch (folderType) {
|
||||
case FOLDER_TYPE_ALBUMS:
|
||||
|
@ -30,6 +30,7 @@ public class MediaMetadataTest {
|
||||
private static final String EXTRAS_KEY = "exampleKey";
|
||||
private static final String EXTRAS_VALUE = "exampleValue";
|
||||
|
||||
@SuppressWarnings("deprecation") // Testing deprecated field.
|
||||
@Test
|
||||
public void builder_minimal_correctDefaults() {
|
||||
MediaMetadata mediaMetadata = new MediaMetadata.Builder().build();
|
||||
@ -134,6 +135,7 @@ public class MediaMetadataTest {
|
||||
assertThat(mediaMetadataFromBundle.extras.getString(EXTRAS_KEY)).isEqualTo(EXTRAS_VALUE);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation") // Testing deprecated setter.
|
||||
@Test
|
||||
public void builderSetFolderType_toNone_setsIsBrowsableToFalse() {
|
||||
MediaMetadata mediaMetadata =
|
||||
@ -142,6 +144,7 @@ public class MediaMetadataTest {
|
||||
assertThat(mediaMetadata.isBrowsable).isFalse();
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation") // Testing deprecated setter.
|
||||
@Test
|
||||
public void builderSetFolderType_toNotNone_setsIsBrowsableToTrueAndMatchingMediaType() {
|
||||
MediaMetadata mediaMetadata =
|
||||
@ -151,6 +154,7 @@ public class MediaMetadataTest {
|
||||
assertThat(mediaMetadata.mediaType).isEqualTo(MediaMetadata.MEDIA_TYPE_FOLDER_PLAYLISTS);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation") // Testing deprecated setter.
|
||||
@Test
|
||||
public void
|
||||
builderSetFolderType_toNotNoneWithManualMediaType_setsIsBrowsableToTrueAndDoesNotOverrideMediaType() {
|
||||
@ -164,6 +168,7 @@ public class MediaMetadataTest {
|
||||
assertThat(mediaMetadata.mediaType).isEqualTo(MediaMetadata.MEDIA_TYPE_FOLDER_PODCASTS);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation") // Testing deprecated field.
|
||||
@Test
|
||||
public void builderSetIsBrowsable_toTrueWithoutMediaType_setsFolderTypeToMixed() {
|
||||
MediaMetadata mediaMetadata = new MediaMetadata.Builder().setIsBrowsable(true).build();
|
||||
@ -171,6 +176,7 @@ public class MediaMetadataTest {
|
||||
assertThat(mediaMetadata.folderType).isEqualTo(MediaMetadata.FOLDER_TYPE_MIXED);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation") // Testing deprecated field.
|
||||
@Test
|
||||
public void builderSetIsBrowsable_toTrueWithMediaType_setsFolderTypeToMatchMediaType() {
|
||||
MediaMetadata mediaMetadata =
|
||||
@ -182,6 +188,7 @@ public class MediaMetadataTest {
|
||||
assertThat(mediaMetadata.folderType).isEqualTo(MediaMetadata.FOLDER_TYPE_ARTISTS);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation") // Testing deprecated field.
|
||||
@Test
|
||||
public void builderSetFolderType_toFalse_setsFolderTypeToNone() {
|
||||
MediaMetadata mediaMetadata = new MediaMetadata.Builder().setIsBrowsable(false).build();
|
||||
@ -189,6 +196,7 @@ public class MediaMetadataTest {
|
||||
assertThat(mediaMetadata.folderType).isEqualTo(MediaMetadata.FOLDER_TYPE_NONE);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation") // Setting deprecated fields.
|
||||
private static MediaMetadata getFullyPopulatedMediaMetadata() {
|
||||
Bundle extras = new Bundle();
|
||||
extras.putString(EXTRAS_KEY, EXTRAS_VALUE);
|
||||
|
@ -176,8 +176,8 @@ public final class LibraryResult<V> implements Bundleable {
|
||||
/**
|
||||
* Creates an instance with a media item and {@link #resultCode}{@code ==}{@link #RESULT_SUCCESS}.
|
||||
*
|
||||
* <p>The {@link MediaItem#mediaMetadata} must specify {@link MediaMetadata#isBrowsable} (or
|
||||
* {@link MediaMetadata#folderType}) and {@link MediaMetadata#isPlayable} fields.
|
||||
* <p>The {@link MediaItem#mediaMetadata} must specify {@link MediaMetadata#isBrowsable} and
|
||||
* {@link MediaMetadata#isPlayable} fields.
|
||||
*
|
||||
* @param item The media item.
|
||||
* @param params The optional parameters to describe the media item.
|
||||
@ -193,8 +193,7 @@ public final class LibraryResult<V> implements Bundleable {
|
||||
* #RESULT_SUCCESS}.
|
||||
*
|
||||
* <p>The {@link MediaItem#mediaMetadata} of each item in the list must specify {@link
|
||||
* MediaMetadata#isBrowsable} (or {@link MediaMetadata#folderType}) and {@link
|
||||
* MediaMetadata#isPlayable} fields.
|
||||
* MediaMetadata#isBrowsable} and {@link MediaMetadata#isPlayable} fields.
|
||||
*
|
||||
* @param items The list of media items.
|
||||
* @param params The optional parameters to describe the list of media items.
|
||||
|
@ -119,9 +119,8 @@ public abstract class MediaLibraryService extends MediaSessionService {
|
||||
* An extended {@link MediaSession.Callback} for the {@link MediaLibrarySession}.
|
||||
*
|
||||
* <p>When you return {@link LibraryResult} with {@link MediaItem media items}, each item must
|
||||
* have valid {@link MediaItem#mediaId} and specify {@link MediaMetadata#isBrowsable} (or {@link
|
||||
* MediaMetadata#folderType}) and {@link MediaMetadata#isPlayable} in its {@link
|
||||
* MediaItem#mediaMetadata}.
|
||||
* have valid {@link MediaItem#mediaId} and specify {@link MediaMetadata#isBrowsable} and {@link
|
||||
* MediaMetadata#isPlayable} in its {@link MediaItem#mediaMetadata}.
|
||||
*/
|
||||
public interface Callback extends MediaSession.Callback {
|
||||
|
||||
|
@ -317,6 +317,7 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
|
||||
}
|
||||
|
||||
/** Converts a {@link MediaItem} to a {@link MediaDescriptionCompat} */
|
||||
@SuppressWarnings("deprecation") // Converting deprecated fields.
|
||||
public static MediaDescriptionCompat convertToMediaDescriptionCompat(
|
||||
MediaItem item, @Nullable Bitmap artworkBitmap) {
|
||||
MediaDescriptionCompat.Builder builder =
|
||||
@ -372,6 +373,7 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
|
||||
descriptionCompat, ratingType, /* browsable= */ false, /* playable= */ true);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation") // Populating deprecated fields.
|
||||
private static MediaMetadata convertToMediaMetadata(
|
||||
@Nullable MediaDescriptionCompat descriptionCompat,
|
||||
@RatingCompat.Style int ratingType,
|
||||
@ -425,6 +427,7 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
|
||||
}
|
||||
|
||||
/** Creates {@link MediaMetadata} from the {@link MediaMetadataCompat} and rating type. */
|
||||
@SuppressWarnings("deprecation") // Populating deprecated fields.
|
||||
public static MediaMetadata convertToMediaMetadata(
|
||||
@Nullable MediaMetadataCompat metadataCompat, @RatingCompat.Style int ratingType) {
|
||||
if (metadataCompat == null) {
|
||||
@ -547,6 +550,7 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
|
||||
* duration should be included.
|
||||
* @return An instance of the legacy {@link MediaMetadataCompat}.
|
||||
*/
|
||||
@SuppressWarnings("deprecation") // Converting deprecated fields.
|
||||
public static MediaMetadataCompat convertToMediaMetadataCompat(
|
||||
MediaMetadata metadata,
|
||||
String mediaId,
|
||||
@ -629,6 +633,7 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation") // Converting to deprecated constants.
|
||||
@MediaMetadata.FolderType
|
||||
private static int convertToFolderType(long extraBtFolderType) {
|
||||
if (extraBtFolderType == MediaDescriptionCompat.BT_FOLDER_TYPE_MIXED) {
|
||||
@ -650,6 +655,7 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation") // Converting from deprecated constants.
|
||||
private static long convertToExtraBtFolderType(@MediaMetadata.FolderType int folderType) {
|
||||
switch (folderType) {
|
||||
case MediaMetadata.FOLDER_TYPE_MIXED:
|
||||
|
Loading…
x
Reference in New Issue
Block a user