Use SessionPlaylistAgent in MediaSession2Impl
Bug: 74090741
Test: SessionPlaylistAgentTest, MediaComponentTests
Change-Id: I3f5ad7ab233fb1be51c5211b12a8292b173f3738
diff --git a/media/java/android/media/MediaPlayerBase.java b/media/java/android/media/MediaPlayerBase.java
index 48b7a51..35a3e50 100644
--- a/media/java/android/media/MediaPlayerBase.java
+++ b/media/java/android/media/MediaPlayerBase.java
@@ -306,8 +306,9 @@
public static abstract class PlayerEventCallback {
/**
* Called when the player's current data source has changed.
+ *
* @param mpb the player whose data source changed.
- * @param dsd the new current data source.
+ * @param dsd the new current data source. null, if no more data sources available.
*/
public void onCurrentDataSourceChanged(@NonNull MediaPlayerBase mpb,
@Nullable DataSourceDesc dsd) { }
diff --git a/media/java/android/media/MediaSession2.java b/media/java/android/media/MediaSession2.java
index 6647831..037750f 100644
--- a/media/java/android/media/MediaSession2.java
+++ b/media/java/android/media/MediaSession2.java
@@ -1543,7 +1543,7 @@
* @see #COMMAND_CODE_PLAYLIST_REPLACE_ITEM
*/
public void setOnDataSourceMissingHelper(@NonNull OnDataSourceMissingHelper helper) {
- // TODO(jaewan): Implement (b/74090741).
+ mProvider.setOnDataSourceMissingHelper_impl(helper);
}
/**
@@ -1552,7 +1552,7 @@
* @see #setOnDataSourceMissingHelper(OnDataSourceMissingHelper)
*/
public void clearOnDataSourceMissingHelper() {
- // TODO(jaewan): Implement (b/74090741)
+ mProvider.clearOnDataSourceMissingHelper_impl();
}
/**
diff --git a/media/java/android/media/update/MediaSession2Provider.java b/media/java/android/media/update/MediaSession2Provider.java
index e5ea386..0faed9d 100644
--- a/media/java/android/media/update/MediaSession2Provider.java
+++ b/media/java/android/media/update/MediaSession2Provider.java
@@ -21,7 +21,6 @@
import android.media.MediaItem2;
import android.media.MediaMetadata2;
import android.media.MediaPlayerBase;
-import android.media.MediaPlayerBase.PlayerEventCallback;
import android.media.MediaPlaylistAgent;
import android.media.MediaSession2;
import android.media.MediaSession2.Command;
@@ -29,6 +28,7 @@
import android.media.MediaSession2.CommandButton.Builder;
import android.media.MediaSession2.CommandGroup;
import android.media.MediaSession2.ControllerInfo;
+import android.media.MediaSession2.OnDataSourceMissingHelper;
import android.media.MediaSession2.SessionCallback;
import android.media.SessionToken2;
import android.media.VolumeProvider2;
@@ -68,6 +68,8 @@
int getPlayerState_impl();
long getPosition_impl();
long getBufferedPosition_impl();
+ void setOnDataSourceMissingHelper_impl(OnDataSourceMissingHelper helper);
+ void clearOnDataSourceMissingHelper_impl();
interface CommandProvider {
int getCommandCode_impl();