MediaSession2: Implement getPlayerState/Position/BufferedPosition
Bug: 74578458 Test: Passed CTS Change-Id: If215e8e16bdce9fdc04ca18ed8d08ed374d13a98
This commit is contained in:
@@ -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; }
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -65,6 +65,9 @@ public interface MediaSession2Provider extends TransportControlProvider {
|
||||
void setPlaylist_impl(List<MediaItem2> 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();
|
||||
|
||||
Reference in New Issue
Block a user