summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Jaewan Kim <jaewan@google.com> 2018-03-20 14:22:45 +0900
committer Jaewan Kim <jaewan@google.com> 2018-03-23 16:08:33 +0900
commit888ccd17aa963f5e7438adcfbb09c292c2400a06 (patch)
tree6d4e51e9ab4d067621dc0cda17f77862204f4063
parent1f654aa24738233f872f708e4e13a9c02af5d6f4 (diff)
MediaSession2: Match APIs with MediaPlayerBase
Bug: 75500592 Test: Build Change-Id: Ic2cf1fc9a9d11752d84ff6f69905b5983e57d10a
-rw-r--r--media/java/android/media/MediaSession2.java25
-rw-r--r--media/java/android/media/update/MediaSession2Provider.java2
2 files changed, 16 insertions, 11 deletions
diff --git a/media/java/android/media/MediaSession2.java b/media/java/android/media/MediaSession2.java
index dc9561bb51ed..f9512fa3ff22 100644
--- a/media/java/android/media/MediaSession2.java
+++ b/media/java/android/media/MediaSession2.java
@@ -16,7 +16,7 @@
package android.media;
-import static android.media.MediaPlayerBase.PLAYER_STATE_IDLE;
+import static android.media.MediaPlayerBase.BUFFERING_STATE_UNKNOWN;
import android.annotation.CallbackExecutor;
import android.annotation.IntDef;
@@ -26,7 +26,6 @@ import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.media.MediaPlayerBase.BuffState;
-import android.media.MediaPlayerBase.PlayerEventCallback;
import android.media.MediaPlayerBase.PlayerState;
import android.media.MediaPlaylistAgent.RepeatMode;
import android.media.MediaPlaylistAgent.ShuffleMode;
@@ -1467,9 +1466,7 @@ public class MediaSession2 implements AutoCloseable {
* Gets the current player state.
*
* @return the current player state
- * @hide
*/
- // TODO(jaewan): Unhide (b/74578458)
public @PlayerState int getPlayerState() {
return mProvider.getPlayerState_impl();
}
@@ -1479,25 +1476,33 @@ public class MediaSession2 implements AutoCloseable {
*
* @return the current playback position in ms, or {@link MediaPlayerBase#UNKNOWN_TIME} if
* unknown.
- * @hide
*/
- // TODO(jaewan): Unhide (b/74578458)
- public long getPosition() {
- return mProvider.getPosition_impl();
+ public long getCurrentPosition() {
+ return mProvider.getCurrentPosition_impl();
}
/**
* Gets the buffered position, or {@link MediaPlayerBase#UNKNOWN_TIME} if unknown.
*
* @return the buffered position in ms, or {@link MediaPlayerBase#UNKNOWN_TIME}.
- * @hide
*/
- // TODO(jaewan): Unhide (b/74578458)
public long getBufferedPosition() {
return mProvider.getBufferedPosition_impl();
}
/**
+ * Gets the current buffering state of the player.
+ * During buffering, see {@link #getBufferedPosition()} for the quantifying the amount already
+ * buffered.
+ *
+ * @return the buffering state.
+ */
+ public @BuffState int getBufferingState() {
+ // TODO(jaewan): Implement this
+ return BUFFERING_STATE_UNKNOWN;
+ }
+
+ /**
* Get the playback speed.
*
* @return speed
diff --git a/media/java/android/media/update/MediaSession2Provider.java b/media/java/android/media/update/MediaSession2Provider.java
index e5ea38667983..5d26894e6563 100644
--- a/media/java/android/media/update/MediaSession2Provider.java
+++ b/media/java/android/media/update/MediaSession2Provider.java
@@ -66,7 +66,7 @@ public interface MediaSession2Provider extends TransportControlProvider {
MediaItem2 getCurrentPlaylistItem_impl();
void notifyError_impl(int errorCode, Bundle extras);
int getPlayerState_impl();
- long getPosition_impl();
+ long getCurrentPosition_impl();
long getBufferedPosition_impl();
interface CommandProvider {