diff --git a/media/java/android/media/MediaPlayerBase.java b/media/java/android/media/MediaPlayerBase.java index 70a36bf201dd7..f18e347e56bdc 100644 --- a/media/java/android/media/MediaPlayerBase.java +++ b/media/java/android/media/MediaPlayerBase.java @@ -132,8 +132,8 @@ public abstract class MediaPlayerBase implements AutoCloseable { public static final long UNKNOWN_TIME = -1; /** - * Returns the current playback head position. - * @return the current play position in ms, or {@link #UNKNOWN_TIME} if unknown. + * Gets the current playback head position. + * @return the current playback position in ms, or {@link #UNKNOWN_TIME} if unknown. */ public long getCurrentPosition() { return UNKNOWN_TIME; } @@ -144,8 +144,8 @@ public abstract class MediaPlayerBase implements AutoCloseable { public long getDuration() { return UNKNOWN_TIME; } /** - * Returns the duration of the current data source, or {@link #UNKNOWN_TIME} if unknown. - * @return the duration in ms, or {@link #UNKNOWN_TIME}. + * Gets the buffered position of current playback, or {@link #UNKNOWN_TIME} if unknown. + * @return the buffered position in ms, or {@link #UNKNOWN_TIME}. */ public long getBufferedPosition() { return UNKNOWN_TIME; } diff --git a/media/java/android/media/MediaSession2.java b/media/java/android/media/MediaSession2.java index 2782a619bbe1b..60714df09a528 100644 --- a/media/java/android/media/MediaSession2.java +++ b/media/java/android/media/MediaSession2.java @@ -1465,39 +1465,37 @@ public class MediaSession2 implements AutoCloseable { } /** - * Get the player state. + * Gets the current player state. * - * @return player state + * @return the current player state * @hide */ // TODO(jaewan): Unhide (b/74578458) public @PlayerState int getPlayerState() { - // TODO(jaewan): implement this (b/74578458) - return PLAYER_STATE_IDLE; + return mProvider.getPlayerState_impl(); } /** - * Get the current position. + * Gets the current position. * - * @return position + * @return the current playback position in ms, or {@link MediaPlayerBase#UNKNOWN_TIME} if + * unknown. * @hide */ // TODO(jaewan): Unhide (b/74578458) - public long getCurrentPosition() { - // TODO(jaewan): implement this (b/74578458) - return -1; + public long getPosition() { + return mProvider.getPosition_impl(); } /** - * Get the buffered position. + * Gets the buffered position, or {@link MediaPlayerBase#UNKNOWN_TIME} if unknown. * - * @return buffered position + * @return the buffered position in ms, or {@link MediaPlayerBase#UNKNOWN_TIME}. * @hide */ // TODO(jaewan): Unhide (b/74578458) public long getBufferedPosition() { - // TODO(jaewan): implement this (b/74578458) - return -1; + return mProvider.getBufferedPosition_impl(); } /** diff --git a/media/java/android/media/update/MediaSession2Provider.java b/media/java/android/media/update/MediaSession2Provider.java index b5d7fd933d22b..e5ea386679838 100644 --- a/media/java/android/media/update/MediaSession2Provider.java +++ b/media/java/android/media/update/MediaSession2Provider.java @@ -65,6 +65,9 @@ public interface MediaSession2Provider extends TransportControlProvider { void setPlaylist_impl(List list, MediaMetadata2 metadata); MediaItem2 getCurrentPlaylistItem_impl(); void notifyError_impl(int errorCode, Bundle extras); + int getPlayerState_impl(); + long getPosition_impl(); + long getBufferedPosition_impl(); interface CommandProvider { int getCommandCode_impl();