summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--media/java/android/media/MediaMetadata2.java73
-rw-r--r--media/java/android/media/update/MediaMetadata2Provider.java6
2 files changed, 65 insertions, 14 deletions
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:
* <ul>
@@ -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.
+ *<p>
+ * 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
@@ -459,12 +477,23 @@ public final class MediaMetadata2 {
}
/**
+ * 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 {
* <li>{@link #METADATA_KEY_DISPLAY_SUBTITLE}</li>
* <li>{@link #METADATA_KEY_DISPLAY_DESCRIPTION}</li>
* <li>{@link #METADATA_KEY_DISPLAY_ICON_URI}</li>
+ * <li>{@link #METADATA_KEY_RADIO_CALLSIGN}</li>
* </ul>
*
* @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:
+ * <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) {
- 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<String> 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();
}
}