diff --git a/media/java/android/media/MediaMetadata2.java b/media/java/android/media/MediaMetadata2.java index fabf42bde3c16..1f856bcc117d2 100644 --- a/media/java/android/media/MediaMetadata2.java +++ b/media/java/android/media/MediaMetadata2.java @@ -220,12 +220,24 @@ public final class MediaMetadata2 { /** * A Uri formatted String representing the content. This value is specific to the * 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 * the same app. */ 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 * AVRCP 1.5. It should be one of the following: @@ -327,9 +339,8 @@ public final class MediaMetadata2 { /** * 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 @@ -339,7 +350,7 @@ public final class MediaMetadata2 { 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_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) public @interface TextKey {} @@ -366,6 +377,13 @@ public final class MediaMetadata2 { @Retention(RetentionPolicy.SOURCE) public @interface RatingKey {} + /** + * @hide + */ + @StringDef({METADATA_KEY_RADIO_FREQUENCY}) + @Retention(RetentionPolicy.SOURCE) + public @interface FloatKey {} + private final MediaMetadata2Provider mProvider; /** @@ -399,9 +417,9 @@ public final class MediaMetadata2 { } /** - * Returns the value associated with the given key, or null if no mapping of - * the desired type exists for the given key or a null value is explicitly - * associated with the key. + * Returns the media id, or {@code null} if the id doesn't exist. + *
+ * This is equivalent to the {@link #getString(String)} with the {@link #METADATA_KEY_MEDIA_ID}. * * @return media id. Can be {@code null} * @see #METADATA_KEY_MEDIA_ID @@ -458,13 +476,24 @@ public final class MediaMetadata2 { 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. * * @return A {@link Bundle} or {@code null} */ - public @Nullable Bundle getExtra() { - return mProvider.getExtra_impl(); + public @Nullable Bundle getExtras() { + return mProvider.getExtras_impl(); } /** @@ -594,6 +623,7 @@ public final class MediaMetadata2 { *