diff --git a/api/current.txt b/api/current.txt index 27a848062a4c3..1af1226eccbf1 100644 --- a/api/current.txt +++ b/api/current.txt @@ -13065,6 +13065,7 @@ package android.media { ctor public RemoteControlClient(android.app.PendingIntent); ctor public RemoteControlClient(android.app.PendingIntent, android.os.Looper); method public android.media.RemoteControlClient.MetadataEditor editMetadata(boolean); + method public void setMetadataUpdateListener(android.media.RemoteControlClient.OnMetadataUpdateListener); method public void setOnGetPlaybackPositionListener(android.media.RemoteControlClient.OnGetPlaybackPositionListener); method public void setPlaybackPositionUpdateListener(android.media.RemoteControlClient.OnPlaybackPositionUpdateListener); method public void setPlaybackState(int); @@ -13077,6 +13078,7 @@ package android.media { field public static final int FLAG_KEY_MEDIA_PLAY_PAUSE = 8; // 0x8 field public static final int FLAG_KEY_MEDIA_POSITION_UPDATE = 256; // 0x100 field public static final int FLAG_KEY_MEDIA_PREVIOUS = 1; // 0x1 + field public static final int FLAG_KEY_MEDIA_RATING = 512; // 0x200 field public static final int FLAG_KEY_MEDIA_REWIND = 2; // 0x2 field public static final int FLAG_KEY_MEDIA_STOP = 32; // 0x20 field public static final int PLAYSTATE_BUFFERING = 8; // 0x8 @@ -13091,18 +13093,32 @@ package android.media { } public class RemoteControlClient.MetadataEditor { + method public synchronized void addEditableKey(int); method public synchronized void apply(); method public synchronized void clear(); + method public synchronized void clearEditableKeys(); method public synchronized android.media.RemoteControlClient.MetadataEditor putBitmap(int, android.graphics.Bitmap) throws java.lang.IllegalArgumentException; method public synchronized android.media.RemoteControlClient.MetadataEditor putLong(int, long) throws java.lang.IllegalArgumentException; method public synchronized android.media.RemoteControlClient.MetadataEditor putString(int, java.lang.String) throws java.lang.IllegalArgumentException; field public static final int BITMAP_KEY_ARTWORK = 100; // 0x64 + field public static final int LONG_KEY_RATING_BY_OTHERS = 102; // 0x66 + field public static final int LONG_KEY_RATING_BY_USER = 268435457; // 0x10000001 + field public static final int LONG_KEY_RATING_TYPE = 101; // 0x65 + field public static final long RATING_HEART = -1L; // 0xffffffffffffffffL + field public static final long RATING_NOT_RATED = -101L; // 0xffffffffffffff9bL + field public static final long RATING_THUMB_UP_DOWN = -2L; // 0xfffffffffffffffeL } public static abstract interface RemoteControlClient.OnGetPlaybackPositionListener { method public abstract long onGetPlaybackPosition(); } + public static abstract interface RemoteControlClient.OnMetadataUpdateListener { + method public abstract void onMetadataUpdateBitmap(int, android.graphics.Bitmap); + method public abstract void onMetadataUpdateLong(int, long); + method public abstract void onMetadataUpdateString(int, java.lang.String); + } + public static abstract interface RemoteControlClient.OnPlaybackPositionUpdateListener { method public abstract void onPlaybackPositionUpdate(long); } diff --git a/media/java/android/media/RemoteControlClient.java b/media/java/android/media/RemoteControlClient.java index 4dcac31b19288..58f5d55369d03 100644 --- a/media/java/android/media/RemoteControlClient.java +++ b/media/java/android/media/RemoteControlClient.java @@ -294,14 +294,13 @@ public class RemoteControlClient */ public final static int FLAG_KEY_MEDIA_POSITION_UPDATE = 1 << 8; /** - * @hide - * CANDIDATE FOR PUBLIC API * Flag indicating a RemoteControlClient supports ratings. * This flag must be set in order for components that display the RemoteControlClient * information, to display ratings information, and, if ratings are declared editable * (by calling {@link MetadataEditor#addEditableKey(int)} with the * {@link MetadataEditor#LONG_KEY_RATING_BY_USER} key), it will enable the user to rate - * the media. + * the media, with values being received through the interface set with + * {@link #setMetadataUpdateListener(OnMetadataUpdateListener)}. * @see #setTransportControlFlags(int) */ public final static int FLAG_KEY_MEDIA_RATING = 1 << 9; @@ -452,8 +451,6 @@ public class RemoteControlClient */ public final static int BITMAP_KEY_ARTWORK = 100; /** - * @hide - * CANDIDATE FOR PUBLIC API * The metadata key qualifying the content rating. * The value associated with this key may be: {@link #RATING_HEART}, * {@link #RATING_THUMB_UP_DOWN}, or a non-null positive integer expressing a maximum @@ -461,8 +458,6 @@ public class RemoteControlClient */ public final static int LONG_KEY_RATING_TYPE = 101; /** - * @hide - * CANDIDATE FOR PUBLIC API * The metadata key for the content's average rating, not the user's rating. * The value associated with this key may be: an integer value between 0 and 100, * or {@link #RATING_NOT_RATED} to express that no average rating is available. @@ -472,11 +467,12 @@ public class RemoteControlClient *
* When the rating type is: *long.
+ * @param key the identifier of the updated metadata field of type long.
+ * @param newValue the new long value for the key
*/
void onMetadataUpdateLong(int key, long newValue);
/**
- * TODO ADD DESCRIPTION
- * @param key
- * @param newValue
+ * Called on the implementer to notify that the metadata field for the given key has
+ * been updated to the new String.
+ * @param key the identifier of the updated metadata field of type String.
+ * @param newValue the new String value for the key
*/
void onMetadataUpdateString(int key, String newValue);
/**
- * TODO ADD DESCRIPTION
- * @param key
- * @param newValue
+ * Called on the implementer to notify that the metadata field for the given key has
+ * been updated to the new {@link android.graphics.Bitmap}.
+ * @param key the identifier of the updated metadata field of type
+ * {@link android.graphics.Bitmap}.
+ * @param newValue the new {@link android.graphics.Bitmap} for the key
*/
void onMetadataUpdateBitmap(int key, Bitmap newValue);
}
/**
- * @hide
- * CANDIDATE FOR PUBLIC API
- * TODO ADD DESCRIPTION
- * @param l
+ * Sets the listener to be called whenever the metadata is updated.
+ * New metadata values will be received in the same thread as the one in which
+ * RemoteControlClient was created.
+ * @param l the metadata update listener
*/
public void setMetadataUpdateListener(OnMetadataUpdateListener l) {
synchronized(mCacheLock) {