Loading media/java/android/media/MediaMetadata2.java +61 −12 Original line number Original line Diff line number Diff line Loading @@ -220,12 +220,24 @@ public final class MediaMetadata2 { /** /** * A Uri formatted String representing the content. This value is specific to the * A Uri formatted String representing the content. This value is specific to the * service providing the content. It may be used with * service providing the content. It may be used with * {@link MediaController2#playFromUri(String, Bundle)} * {@link MediaController2#playFromUri(Uri, Bundle)} * to initiate playback when provided by a {@link MediaBrowser2} connected to * to initiate playback when provided by a {@link MediaBrowser2} connected to * the same app. * the same app. */ */ public static final String METADATA_KEY_MEDIA_URI = "android.media.metadata.MEDIA_URI"; public static final String METADATA_KEY_MEDIA_URI = "android.media.metadata.MEDIA_URI"; /** * The radio frequency in Float format if this metdata representing radio content. */ public static final String METADATA_KEY_RADIO_FREQUENCY = "android.media.metadata.RADIO_FREQUENCY"; /** * The radio callsign in String format if this metdata representing radio content. */ public static final String METADATA_KEY_RADIO_CALLSIGN = "android.media.metadata.RADIO_CALLSIGN"; /** /** * The bluetooth folder type of the media specified in the section 6.10.2.2 of the Bluetooth * The bluetooth folder type of the media specified in the section 6.10.2.2 of the Bluetooth * AVRCP 1.5. It should be one of the following: * AVRCP 1.5. It should be one of the following: Loading Loading @@ -327,9 +339,8 @@ public final class MediaMetadata2 { /** /** * A {@link Bundle} extra. * A {@link Bundle} extra. * @hide */ */ public static final String METADATA_KEY_EXTRA = "android.media.metadata.EXTRA"; public static final String METADATA_KEY_EXTRAS = "android.media.metadata.EXTRAS"; /** /** * @hide * @hide Loading @@ -339,7 +350,7 @@ public final class MediaMetadata2 { METADATA_KEY_DATE, METADATA_KEY_GENRE, METADATA_KEY_ALBUM_ARTIST, METADATA_KEY_ART_URI, METADATA_KEY_DATE, METADATA_KEY_GENRE, METADATA_KEY_ALBUM_ARTIST, METADATA_KEY_ART_URI, METADATA_KEY_ALBUM_ART_URI, METADATA_KEY_DISPLAY_TITLE, METADATA_KEY_DISPLAY_SUBTITLE, METADATA_KEY_ALBUM_ART_URI, METADATA_KEY_DISPLAY_TITLE, METADATA_KEY_DISPLAY_SUBTITLE, METADATA_KEY_DISPLAY_DESCRIPTION, METADATA_KEY_DISPLAY_ICON_URI, METADATA_KEY_DISPLAY_DESCRIPTION, METADATA_KEY_DISPLAY_ICON_URI, METADATA_KEY_MEDIA_ID, METADATA_KEY_MEDIA_URI}) METADATA_KEY_MEDIA_ID, METADATA_KEY_MEDIA_URI, METADATA_KEY_RADIO_CALLSIGN}) @Retention(RetentionPolicy.SOURCE) @Retention(RetentionPolicy.SOURCE) public @interface TextKey {} public @interface TextKey {} Loading @@ -366,6 +377,13 @@ public final class MediaMetadata2 { @Retention(RetentionPolicy.SOURCE) @Retention(RetentionPolicy.SOURCE) public @interface RatingKey {} public @interface RatingKey {} /** * @hide */ @StringDef({METADATA_KEY_RADIO_FREQUENCY}) @Retention(RetentionPolicy.SOURCE) public @interface FloatKey {} private final MediaMetadata2Provider mProvider; private final MediaMetadata2Provider mProvider; /** /** Loading Loading @@ -399,9 +417,9 @@ public final class MediaMetadata2 { } } /** /** * Returns the value associated with the given key, or null if no mapping of * Returns the media id, or {@code null} if the id doesn't exist. * the desired type exists for the given key or a null value is explicitly *<p> * associated with the key. * This is equivalent to the {@link #getString(String)} with the {@link #METADATA_KEY_MEDIA_ID}. * * * @return media id. Can be {@code null} * @return media id. Can be {@code null} * @see #METADATA_KEY_MEDIA_ID * @see #METADATA_KEY_MEDIA_ID Loading Loading @@ -458,13 +476,24 @@ public final class MediaMetadata2 { return mProvider.getBitmap_impl(key); return mProvider.getBitmap_impl(key); } } /** * Return the value associated with the given key, or 0.0f if no long exists * for the given key. * * @param key The key the value is stored under * @return a float value */ public float getFloat(@NonNull @FloatKey String key) { return mProvider.getFloat_impl(key); } /** /** * Get the extra {@link Bundle} from the metadata object. * Get the extra {@link Bundle} from the metadata object. * * * @return A {@link Bundle} or {@code null} * @return A {@link Bundle} or {@code null} */ */ public @Nullable Bundle getExtra() { public @Nullable Bundle getExtras() { return mProvider.getExtra_impl(); return mProvider.getExtras_impl(); } } /** /** Loading Loading @@ -594,6 +623,7 @@ public final class MediaMetadata2 { * <li>{@link #METADATA_KEY_DISPLAY_SUBTITLE}</li> * <li>{@link #METADATA_KEY_DISPLAY_SUBTITLE}</li> * <li>{@link #METADATA_KEY_DISPLAY_DESCRIPTION}</li> * <li>{@link #METADATA_KEY_DISPLAY_DESCRIPTION}</li> * <li>{@link #METADATA_KEY_DISPLAY_ICON_URI}</li> * <li>{@link #METADATA_KEY_DISPLAY_ICON_URI}</li> * <li>{@link #METADATA_KEY_RADIO_CALLSIGN}</li> * </ul> * </ul> * * * @param key The key for referencing this value * @param key The key for referencing this value Loading Loading @@ -667,10 +697,29 @@ public final class MediaMetadata2 { } } /** /** * Set an extra {@link Bundle} into the metadata. * Put a float value into the metadata. Custom keys may be used, but if * the METADATA_KEYs defined in this class are used they may only be one * of the following: * <ul> * <li>{@link #METADATA_KEY_RADIO_FREQUENCY}</li> * </ul> * * @param key The key for referencing this value * @param value The float value to store * @return The Builder to allow chaining */ public @NonNull Builder putFloat(@NonNull @LongKey String key, float value) { return mProvider.putFloat_impl(key, value); } /** * Set a bundle of extras. * * @param extras The extras to include with this description or null. * @return The Builder to allow chaining */ */ public @NonNull Builder setExtra(@Nullable Bundle bundle) { public Builder setExtras(@Nullable Bundle extras) { return mProvider.setExtra_impl(bundle); return mProvider.setExtras_impl(extras); } } /** /** Loading media/java/android/media/update/MediaMetadata2Provider.java +4 −2 Original line number Original line Diff line number Diff line Loading @@ -23,7 +23,8 @@ public interface MediaMetadata2Provider { Set<String> keySet_impl(); Set<String> keySet_impl(); int size_impl(); int size_impl(); Bitmap getBitmap_impl(String key); Bitmap getBitmap_impl(String key); Bundle getExtra_impl(); float getFloat_impl(String key); Bundle getExtras_impl(); interface BuilderProvider { interface BuilderProvider { Builder putText_impl(String key, CharSequence value); Builder putText_impl(String key, CharSequence value); Loading @@ -31,7 +32,8 @@ public interface MediaMetadata2Provider { Builder putLong_impl(String key, long value); Builder putLong_impl(String key, long value); Builder putRating_impl(String key, Rating2 value); Builder putRating_impl(String key, Rating2 value); Builder putBitmap_impl(String key, Bitmap value); Builder putBitmap_impl(String key, Bitmap value); Builder setExtra_impl(Bundle bundle); Builder putFloat_impl(String key, float value); Builder setExtras_impl(Bundle bundle); MediaMetadata2 build_impl(); MediaMetadata2 build_impl(); } } } } Loading
media/java/android/media/MediaMetadata2.java +61 −12 Original line number Original line Diff line number Diff line Loading @@ -220,12 +220,24 @@ public final class MediaMetadata2 { /** /** * A Uri formatted String representing the content. This value is specific to the * A Uri formatted String representing the content. This value is specific to the * service providing the content. It may be used with * service providing the content. It may be used with * {@link MediaController2#playFromUri(String, Bundle)} * {@link MediaController2#playFromUri(Uri, Bundle)} * to initiate playback when provided by a {@link MediaBrowser2} connected to * to initiate playback when provided by a {@link MediaBrowser2} connected to * the same app. * the same app. */ */ public static final String METADATA_KEY_MEDIA_URI = "android.media.metadata.MEDIA_URI"; public static final String METADATA_KEY_MEDIA_URI = "android.media.metadata.MEDIA_URI"; /** * The radio frequency in Float format if this metdata representing radio content. */ public static final String METADATA_KEY_RADIO_FREQUENCY = "android.media.metadata.RADIO_FREQUENCY"; /** * The radio callsign in String format if this metdata representing radio content. */ public static final String METADATA_KEY_RADIO_CALLSIGN = "android.media.metadata.RADIO_CALLSIGN"; /** /** * The bluetooth folder type of the media specified in the section 6.10.2.2 of the Bluetooth * The bluetooth folder type of the media specified in the section 6.10.2.2 of the Bluetooth * AVRCP 1.5. It should be one of the following: * AVRCP 1.5. It should be one of the following: Loading Loading @@ -327,9 +339,8 @@ public final class MediaMetadata2 { /** /** * A {@link Bundle} extra. * A {@link Bundle} extra. * @hide */ */ public static final String METADATA_KEY_EXTRA = "android.media.metadata.EXTRA"; public static final String METADATA_KEY_EXTRAS = "android.media.metadata.EXTRAS"; /** /** * @hide * @hide Loading @@ -339,7 +350,7 @@ public final class MediaMetadata2 { METADATA_KEY_DATE, METADATA_KEY_GENRE, METADATA_KEY_ALBUM_ARTIST, METADATA_KEY_ART_URI, METADATA_KEY_DATE, METADATA_KEY_GENRE, METADATA_KEY_ALBUM_ARTIST, METADATA_KEY_ART_URI, METADATA_KEY_ALBUM_ART_URI, METADATA_KEY_DISPLAY_TITLE, METADATA_KEY_DISPLAY_SUBTITLE, METADATA_KEY_ALBUM_ART_URI, METADATA_KEY_DISPLAY_TITLE, METADATA_KEY_DISPLAY_SUBTITLE, METADATA_KEY_DISPLAY_DESCRIPTION, METADATA_KEY_DISPLAY_ICON_URI, METADATA_KEY_DISPLAY_DESCRIPTION, METADATA_KEY_DISPLAY_ICON_URI, METADATA_KEY_MEDIA_ID, METADATA_KEY_MEDIA_URI}) METADATA_KEY_MEDIA_ID, METADATA_KEY_MEDIA_URI, METADATA_KEY_RADIO_CALLSIGN}) @Retention(RetentionPolicy.SOURCE) @Retention(RetentionPolicy.SOURCE) public @interface TextKey {} public @interface TextKey {} Loading @@ -366,6 +377,13 @@ public final class MediaMetadata2 { @Retention(RetentionPolicy.SOURCE) @Retention(RetentionPolicy.SOURCE) public @interface RatingKey {} public @interface RatingKey {} /** * @hide */ @StringDef({METADATA_KEY_RADIO_FREQUENCY}) @Retention(RetentionPolicy.SOURCE) public @interface FloatKey {} private final MediaMetadata2Provider mProvider; private final MediaMetadata2Provider mProvider; /** /** Loading Loading @@ -399,9 +417,9 @@ public final class MediaMetadata2 { } } /** /** * Returns the value associated with the given key, or null if no mapping of * Returns the media id, or {@code null} if the id doesn't exist. * the desired type exists for the given key or a null value is explicitly *<p> * associated with the key. * This is equivalent to the {@link #getString(String)} with the {@link #METADATA_KEY_MEDIA_ID}. * * * @return media id. Can be {@code null} * @return media id. Can be {@code null} * @see #METADATA_KEY_MEDIA_ID * @see #METADATA_KEY_MEDIA_ID Loading Loading @@ -458,13 +476,24 @@ public final class MediaMetadata2 { return mProvider.getBitmap_impl(key); return mProvider.getBitmap_impl(key); } } /** * Return the value associated with the given key, or 0.0f if no long exists * for the given key. * * @param key The key the value is stored under * @return a float value */ public float getFloat(@NonNull @FloatKey String key) { return mProvider.getFloat_impl(key); } /** /** * Get the extra {@link Bundle} from the metadata object. * Get the extra {@link Bundle} from the metadata object. * * * @return A {@link Bundle} or {@code null} * @return A {@link Bundle} or {@code null} */ */ public @Nullable Bundle getExtra() { public @Nullable Bundle getExtras() { return mProvider.getExtra_impl(); return mProvider.getExtras_impl(); } } /** /** Loading Loading @@ -594,6 +623,7 @@ public final class MediaMetadata2 { * <li>{@link #METADATA_KEY_DISPLAY_SUBTITLE}</li> * <li>{@link #METADATA_KEY_DISPLAY_SUBTITLE}</li> * <li>{@link #METADATA_KEY_DISPLAY_DESCRIPTION}</li> * <li>{@link #METADATA_KEY_DISPLAY_DESCRIPTION}</li> * <li>{@link #METADATA_KEY_DISPLAY_ICON_URI}</li> * <li>{@link #METADATA_KEY_DISPLAY_ICON_URI}</li> * <li>{@link #METADATA_KEY_RADIO_CALLSIGN}</li> * </ul> * </ul> * * * @param key The key for referencing this value * @param key The key for referencing this value Loading Loading @@ -667,10 +697,29 @@ public final class MediaMetadata2 { } } /** /** * Set an extra {@link Bundle} into the metadata. * Put a float value into the metadata. Custom keys may be used, but if * the METADATA_KEYs defined in this class are used they may only be one * of the following: * <ul> * <li>{@link #METADATA_KEY_RADIO_FREQUENCY}</li> * </ul> * * @param key The key for referencing this value * @param value The float value to store * @return The Builder to allow chaining */ public @NonNull Builder putFloat(@NonNull @LongKey String key, float value) { return mProvider.putFloat_impl(key, value); } /** * Set a bundle of extras. * * @param extras The extras to include with this description or null. * @return The Builder to allow chaining */ */ public @NonNull Builder setExtra(@Nullable Bundle bundle) { public Builder setExtras(@Nullable Bundle extras) { return mProvider.setExtra_impl(bundle); return mProvider.setExtras_impl(extras); } } /** /** Loading
media/java/android/media/update/MediaMetadata2Provider.java +4 −2 Original line number Original line Diff line number Diff line Loading @@ -23,7 +23,8 @@ public interface MediaMetadata2Provider { Set<String> keySet_impl(); Set<String> keySet_impl(); int size_impl(); int size_impl(); Bitmap getBitmap_impl(String key); Bitmap getBitmap_impl(String key); Bundle getExtra_impl(); float getFloat_impl(String key); Bundle getExtras_impl(); interface BuilderProvider { interface BuilderProvider { Builder putText_impl(String key, CharSequence value); Builder putText_impl(String key, CharSequence value); Loading @@ -31,7 +32,8 @@ public interface MediaMetadata2Provider { Builder putLong_impl(String key, long value); Builder putLong_impl(String key, long value); Builder putRating_impl(String key, Rating2 value); Builder putRating_impl(String key, Rating2 value); Builder putBitmap_impl(String key, Bitmap value); Builder putBitmap_impl(String key, Bitmap value); Builder setExtra_impl(Bundle bundle); Builder putFloat_impl(String key, float value); Builder setExtras_impl(Bundle bundle); MediaMetadata2 build_impl(); MediaMetadata2 build_impl(); } } } }