From f73bc870c0e07861019d4833c3ccb42d0af9fab0 Mon Sep 17 00:00:00 2001 From: Jaewan Kim Date: Tue, 20 Mar 2018 09:06:55 +0900 Subject: [PATCH] MediaSession2: Add more detailed documentation for addPlaylistItem() Bug: 73149584 Test: Run CTS with MediaComponents/runcts.sh Change-Id: Ifc16e9d4ee210ac901941d8f3a6a228aa3f1ddd8 --- media/java/android/media/MediaController2.java | 4 +++- media/java/android/media/MediaPlaylistAgent.java | 11 ++++++++--- media/java/android/media/MediaSession2.java | 3 ++- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/media/java/android/media/MediaController2.java b/media/java/android/media/MediaController2.java index 20c320947f453..9503226497a7b 100644 --- a/media/java/android/media/MediaController2.java +++ b/media/java/android/media/MediaController2.java @@ -735,8 +735,10 @@ public class MediaController2 implements AutoCloseable { return mProvider.getPlaylistMetadata_impl(); } + /** - * Inserts the media item to the playlist at position index. + * Adds the media item to the playlist at position index. Index equals or greater than + * the current playlist size will add the item at the end of the playlist. *

* This will not change the currently playing media item. * If index is less than or equal to the current index of the playlist, diff --git a/media/java/android/media/MediaPlaylistAgent.java b/media/java/android/media/MediaPlaylistAgent.java index 6b3620b62dc32..9490763a0de82 100644 --- a/media/java/android/media/MediaPlaylistAgent.java +++ b/media/java/android/media/MediaPlaylistAgent.java @@ -228,10 +228,15 @@ public abstract class MediaPlaylistAgent { } /** - * Adds the media item to the playlist at the index + * Adds the media item to the playlist at position index. Index equals or greater than + * the current playlist size will add the item at the end of the playlist. + *

+ * This will not change the currently playing media item. + * If index is less than or equal to the current index of the playlist, + * the current index of the playlist will be incremented correspondingly. * - * @param index index - * @param item media item to add + * @param index the index you want to add + * @param item the media item you want to add */ public void addPlaylistItem(int index, @NonNull MediaItem2 item) { mProvider.addPlaylistItem_impl(index, item); diff --git a/media/java/android/media/MediaSession2.java b/media/java/android/media/MediaSession2.java index 66478318eb3b8..abc260453730d 100644 --- a/media/java/android/media/MediaSession2.java +++ b/media/java/android/media/MediaSession2.java @@ -1648,7 +1648,8 @@ public class MediaSession2 implements AutoCloseable { } /** - * Adds the media item to the playlist at position index. + * Adds the media item to the playlist at position index. Index equals or greater than + * the current playlist size will add the item at the end of the playlist. *

* This will not change the currently playing media item. * If index is less than or equal to the current index of the play list,