From: Jaewan Kim Date: Thu, 22 Feb 2018 07:46:17 +0000 (+0900) Subject: MediaMetadata2: Add radio frequency and callsigns X-Git-Tag: android-x86-9.0-r1~196^2~61^2 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=004ff3f579a3c68967d2bc4bb6101979b75b2b3d;p=android-x86%2Fframeworks-base.git MediaMetadata2: Add radio frequency and callsigns This is request from the Android Auto Embeded, where the Android is running on the car kit and needs support radio application Test: Run all MediaComponents tests once Change-Id: I09780878ac3a1075c79f51879ffb76913a8215a2 --- diff --git a/media/java/android/media/MediaMetadata2.java b/media/java/android/media/MediaMetadata2.java index fabf42bde3c1..1f856bcc117d 100644 --- a/media/java/android/media/MediaMetadata2.java +++ b/media/java/android/media/MediaMetadata2.java @@ -220,13 +220,25 @@ 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: * * * @param key The key for referencing this value @@ -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: + * + * + * @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) { - return mProvider.setExtra_impl(bundle); + public Builder setExtras(@Nullable Bundle extras) { + return mProvider.setExtras_impl(extras); } /** diff --git a/media/java/android/media/update/MediaMetadata2Provider.java b/media/java/android/media/update/MediaMetadata2Provider.java index 55ac43d797d4..b6e5c8a1e7e3 100644 --- a/media/java/android/media/update/MediaMetadata2Provider.java +++ b/media/java/android/media/update/MediaMetadata2Provider.java @@ -23,7 +23,8 @@ public interface MediaMetadata2Provider { Set keySet_impl(); int size_impl(); Bitmap getBitmap_impl(String key); - Bundle getExtra_impl(); + float getFloat_impl(String key); + Bundle getExtras_impl(); interface BuilderProvider { Builder putText_impl(String key, CharSequence value); @@ -31,7 +32,8 @@ public interface MediaMetadata2Provider { Builder putLong_impl(String key, long value); Builder putRating_impl(String key, Rating2 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(); } }