summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--api/current.txt100
-rw-r--r--media/java/android/media/MediaMetadata.java11
-rw-r--r--media/java/android/media/RemoteControlClient.java4
-rw-r--r--media/java/android/media/session/ISessionController.aidl2
-rw-r--r--media/java/android/media/session/MediaController.java29
-rw-r--r--media/java/android/media/session/MediaSession.java52
-rw-r--r--media/java/android/media/session/MediaSessionInfo.java2
-rw-r--r--media/java/android/media/session/MediaSessionLegacyHelper.java22
-rw-r--r--media/java/android/media/session/MediaSessionManager.java1
-rw-r--r--media/java/android/media/session/MediaSessionToken.java7
-rw-r--r--media/java/android/media/session/PlaybackState.java132
-rw-r--r--media/java/android/media/session/RemoteVolumeProvider.java37
-rw-r--r--media/java/android/media/session/TransportController.java6
-rw-r--r--media/java/android/media/session/TransportPerformer.java117
-rw-r--r--services/core/java/com/android/server/media/MediaSessionRecord.java36
-rw-r--r--services/core/java/com/android/server/media/MediaSessionStack.java14
-rw-r--r--tests/OneMedia/src/com/android/onemedia/OnePlayerActivity.java20
-rw-r--r--tests/OneMedia/src/com/android/onemedia/PlayerService.java6
-rw-r--r--tests/OneMedia/src/com/android/onemedia/PlayerSession.java30
-rw-r--r--tests/OneMedia/src/com/android/onemedia/provider/OneMediaRouteProvider.java16
20 files changed, 334 insertions, 310 deletions
diff --git a/api/current.txt b/api/current.txt
index df908e0..acf6e87 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -14583,6 +14583,7 @@ package android.media {
method public long getLong(java.lang.String);
method public android.media.Rating getRating(java.lang.String);
method public java.lang.String getString(java.lang.String);
+ method public java.util.Set<java.lang.String> keySet();
method public int size();
method public void writeToParcel(android.os.Parcel, int);
field public static final android.os.Parcelable.Creator CREATOR;
@@ -15720,16 +15721,16 @@ package android.media.session {
public final class MediaController {
method public void addCallback(android.media.session.MediaController.Callback);
method public void addCallback(android.media.session.MediaController.Callback, android.os.Handler);
+ method public boolean dispatchMediaButtonEvent(android.view.KeyEvent);
method public static android.media.session.MediaController fromToken(android.media.session.MediaSessionToken);
method public android.media.session.TransportController getTransportController();
method public void removeCallback(android.media.session.MediaController.Callback);
- method public void sendCommand(java.lang.String, android.os.Bundle, android.os.ResultReceiver);
- method public void sendMediaButton(int);
+ method public void sendControlCommand(java.lang.String, android.os.Bundle, android.os.ResultReceiver);
}
public static abstract class MediaController.Callback {
ctor public MediaController.Callback();
- method public void onEvent(java.lang.String, android.os.Bundle);
+ method public void onSessionEvent(java.lang.String, android.os.Bundle);
}
public final class MediaSession {
@@ -15740,36 +15741,27 @@ package android.media.session {
method public boolean isActive();
method public void release();
method public void removeCallback(android.media.session.MediaSession.Callback);
- method public void sendEvent(java.lang.String, android.os.Bundle);
+ method public void sendSessionEvent(java.lang.String, android.os.Bundle);
method public void setActive(boolean);
method public void setFlags(int);
method public void setLaunchPendingIntent(android.app.PendingIntent);
- method public void useLocalPlayback(int);
- method public void useRemotePlayback(android.media.session.RemoteVolumeProvider);
+ method public void setPlaybackToLocal(int);
+ method public void setPlaybackToRemote(android.media.session.RemoteVolumeProvider);
field public static final int FLAG_HANDLES_MEDIA_BUTTONS = 1; // 0x1
field public static final int FLAG_HANDLES_TRANSPORT_CONTROLS = 2; // 0x2
}
public static abstract class MediaSession.Callback {
ctor public MediaSession.Callback();
- method public void onCommand(java.lang.String, android.os.Bundle, android.os.ResultReceiver);
- method public void onMediaButton(android.content.Intent);
- }
-
- public final class MediaSessionInfo implements android.os.Parcelable {
- method public int describeContents();
- method public java.lang.String getId();
- method public java.lang.String getPackageName();
- method public void writeToParcel(android.os.Parcel, int);
- field public static final android.os.Parcelable.Creator CREATOR;
+ method public void onControlCommand(java.lang.String, android.os.Bundle, android.os.ResultReceiver);
+ method public void onMediaButtonEvent(android.content.Intent);
}
public final class MediaSessionManager {
method public android.media.session.MediaSession createSession(java.lang.String);
- method public java.util.List<android.media.session.MediaController> getActiveSessions(android.content.ComponentName);
}
- public class MediaSessionToken implements android.os.Parcelable {
+ public final class MediaSessionToken implements android.os.Parcelable {
method public int describeContents();
method public void writeToParcel(android.os.Parcel, int);
field public static final android.os.Parcelable.Creator CREATOR;
@@ -15781,49 +15773,50 @@ package android.media.session {
method public int describeContents();
method public long getActions();
method public long getBufferPosition();
- method public java.lang.String getErrorMessage();
+ method public java.lang.CharSequence getErrorMessage();
+ method public float getPlaybackRate();
method public long getPosition();
- method public float getRate();
method public int getState();
method public void setActions(long);
method public void setBufferPosition(long);
- method public void setErrorMessage(java.lang.String);
+ method public void setErrorMessage(java.lang.CharSequence);
method public void setState(int, long, float);
method public void writeToParcel(android.os.Parcel, int);
- field public static final long ACTION_FASTFORWARD = 64L; // 0x40L
- field public static final long ACTION_NEXT_ITEM = 32L; // 0x20L
+ field public static final long ACTION_FAST_FORWARD = 64L; // 0x40L
field public static final long ACTION_PAUSE = 2L; // 0x2L
field public static final long ACTION_PLAY = 4L; // 0x4L
field public static final long ACTION_PLAY_PAUSE = 512L; // 0x200L
- field public static final long ACTION_PREVIOUS_ITEM = 16L; // 0x10L
- field public static final long ACTION_RATING = 128L; // 0x80L
field public static final long ACTION_REWIND = 8L; // 0x8L
field public static final long ACTION_SEEK_TO = 256L; // 0x100L
+ field public static final long ACTION_SET_RATING = 128L; // 0x80L
+ field public static final long ACTION_SKIP_TO_NEXT = 32L; // 0x20L
+ field public static final long ACTION_SKIP_TO_PREVIOUS = 16L; // 0x10L
field public static final long ACTION_STOP = 1L; // 0x1L
field public static final android.os.Parcelable.Creator CREATOR;
field public static final long PLAYBACK_POSITION_UNKNOWN = -1L; // 0xffffffffffffffffL
- field public static final int PLAYSTATE_BUFFERING = 6; // 0x6
- field public static final int PLAYSTATE_ERROR = 7; // 0x7
- field public static final int PLAYSTATE_FAST_FORWARDING = 4; // 0x4
- field public static final int PLAYSTATE_NONE = 0; // 0x0
- field public static final int PLAYSTATE_PAUSED = 2; // 0x2
- field public static final int PLAYSTATE_PLAYING = 3; // 0x3
- field public static final int PLAYSTATE_REWINDING = 5; // 0x5
- field public static final int PLAYSTATE_SKIPPING_BACKWARDS = 9; // 0x9
- field public static final int PLAYSTATE_SKIPPING_FORWARDS = 10; // 0xa
- field public static final int PLAYSTATE_STOPPED = 1; // 0x1
+ field public static final int STATE_BUFFERING = 6; // 0x6
+ field public static final int STATE_ERROR = 7; // 0x7
+ field public static final int STATE_FAST_FORWARDING = 4; // 0x4
+ field public static final int STATE_NONE = 0; // 0x0
+ field public static final int STATE_PAUSED = 2; // 0x2
+ field public static final int STATE_PLAYING = 3; // 0x3
+ field public static final int STATE_REWINDING = 5; // 0x5
+ field public static final int STATE_SKIPPING_TO_NEXT = 10; // 0xa
+ field public static final int STATE_SKIPPING_TO_PREVIOUS = 9; // 0x9
+ field public static final int STATE_STOPPED = 1; // 0x1
}
public abstract class RemoteVolumeProvider {
ctor public RemoteVolumeProvider(int, int);
- method public abstract int getCurrentVolume();
method public final int getFlags();
method public final int getMaxVolume();
method public final void notifyVolumeChanged();
- method public void onAdjustVolume(int);
- method public void onSetVolume(int);
- field public static final int FLAG_VOLUME_ABSOLUTE = 2; // 0x2
- field public static final int FLAG_VOLUME_RELATIVE = 1; // 0x1
+ method public void onAdjustVolumeBy(int);
+ method public abstract int onGetCurrentVolume();
+ method public void onSetVolumeTo(int);
+ field public static final int VOLUME_CONTROL_ABSOLUTE = 4; // 0x4
+ field public static final int VOLUME_CONTROL_FIXED = 1; // 0x1
+ field public static final int VOLUME_CONTROL_RELATIVE = 2; // 0x2
}
public final class TransportController {
@@ -15833,14 +15826,14 @@ package android.media.session {
method public android.media.MediaMetadata getMetadata();
method public android.media.session.PlaybackState getPlaybackState();
method public int getRatingType();
- method public void next();
method public void pause();
method public void play();
- method public void previous();
- method public void rate(android.media.Rating);
method public void removeStateListener(android.media.session.TransportController.TransportStateListener);
method public void rewind();
method public void seekTo(long);
+ method public void setRating(android.media.Rating);
+ method public void skipToNext();
+ method public void skipToPrevious();
method public void stop();
}
@@ -15851,24 +15844,23 @@ package android.media.session {
}
public final class TransportPerformer {
- method public void addListener(android.media.session.TransportPerformer.Listener);
- method public void addListener(android.media.session.TransportPerformer.Listener, android.os.Handler);
- method public void removeListener(android.media.session.TransportPerformer.Listener);
- method public final void setMetadata(android.media.MediaMetadata);
- method public final void setPlaybackState(android.media.session.PlaybackState);
+ method public void addCallback(android.media.session.TransportPerformer.Callback);
+ method public void addCallback(android.media.session.TransportPerformer.Callback, android.os.Handler);
+ method public void removeCallback(android.media.session.TransportPerformer.Callback);
+ method public void setMetadata(android.media.MediaMetadata);
+ method public void setPlaybackState(android.media.session.PlaybackState);
}
- public static abstract class TransportPerformer.Listener {
- ctor public TransportPerformer.Listener();
+ public static abstract class TransportPerformer.Callback {
+ ctor public TransportPerformer.Callback();
method public void onFastForward();
- method public void onNext();
method public void onPause();
method public void onPlay();
- method public void onPrevious();
- method public void onRate(android.media.Rating);
method public void onRewind();
- method public void onRouteFocusChange(int);
method public void onSeekTo(long);
+ method public void onSetRating(android.media.Rating);
+ method public void onSkipToNext();
+ method public void onSkipToPrevious();
method public void onStop();
}
diff --git a/media/java/android/media/MediaMetadata.java b/media/java/android/media/MediaMetadata.java
index ff73a10..5dc8e1b 100644
--- a/media/java/android/media/MediaMetadata.java
+++ b/media/java/android/media/MediaMetadata.java
@@ -23,6 +23,8 @@ import android.util.ArrayMap;
import android.util.Log;
import android.util.SparseArray;
+import java.util.Set;
+
/**
* Contains metadata about an item, such as the title, artist, etc.
*/
@@ -301,6 +303,15 @@ public final class MediaMetadata implements Parcelable {
}
/**
+ * Returns a Set containing the Strings used as keys in this metadata.
+ *
+ * @return a Set of String keys
+ */
+ public Set<String> keySet() {
+ return mBundle.keySet();
+ }
+
+ /**
* Helper for getting the String key used by {@link MediaMetadata} from the
* integer key that {@link MediaMetadataEditor} uses.
*
diff --git a/media/java/android/media/RemoteControlClient.java b/media/java/android/media/RemoteControlClient.java
index 26ae3cc..b89affd 100644
--- a/media/java/android/media/RemoteControlClient.java
+++ b/media/java/android/media/RemoteControlClient.java
@@ -1317,7 +1317,7 @@ public class RemoteControlClient
}
// USE_SESSIONS
- private TransportPerformer.Listener mTransportListener = new TransportPerformer.Listener() {
+ private TransportPerformer.Callback mTransportListener = new TransportPerformer.Callback() {
@Override
public void onSeekTo(long pos) {
@@ -1325,7 +1325,7 @@ public class RemoteControlClient
}
@Override
- public void onRate(Rating rating) {
+ public void onSetRating(Rating rating) {
if ((mTransportControlFlags & FLAG_KEY_MEDIA_RATING) != 0) {
if (mEventHandler != null) {
mEventHandler.sendMessage(mEventHandler.obtainMessage(
diff --git a/media/java/android/media/session/ISessionController.aidl b/media/java/android/media/session/ISessionController.aidl
index 5ddb6db..9ce0692 100644
--- a/media/java/android/media/session/ISessionController.aidl
+++ b/media/java/android/media/session/ISessionController.aidl
@@ -30,7 +30,7 @@ import android.view.KeyEvent;
*/
interface ISessionController {
void sendCommand(String command, in Bundle extras, in ResultReceiver cb);
- void sendMediaButton(in KeyEvent mediaButton);
+ boolean sendMediaButton(in KeyEvent mediaButton);
void registerCallbackListener(in ISessionControllerCallback cb);
void unregisterCallbackListener(in ISessionControllerCallback cb);
boolean isTransportControlEnabled();
diff --git a/media/java/android/media/session/MediaController.java b/media/java/android/media/session/MediaController.java
index 642ac2f..63c0839 100644
--- a/media/java/android/media/session/MediaController.java
+++ b/media/java/android/media/session/MediaController.java
@@ -103,24 +103,25 @@ public final class MediaController {
}
/**
- * Send the specified media button to the session. Only media keys can be
- * sent using this method.
+ * Send the specified media button event to the session. Only media keys can
+ * be sent by this method, other keys will be ignored.
*
- * @param keycode The media button keycode, such as
- * {@link KeyEvent#KEYCODE_MEDIA_PLAY}.
+ * @param keyEvent The media button event to dispatch.
+ * @return true if the event was sent to the session, false otherwise.
*/
- public void sendMediaButton(int keycode) {
- if (!KeyEvent.isMediaKey(keycode)) {
- throw new IllegalArgumentException("May only send media buttons through "
- + "sendMediaButton");
+ public boolean dispatchMediaButtonEvent(KeyEvent keyEvent) {
+ if (keyEvent == null) {
+ throw new IllegalArgumentException("KeyEvent may not be null");
+ }
+ if (!KeyEvent.isMediaKey(keyEvent.getKeyCode())) {
+ return false;
}
- // TODO do something better than key down/up events
- KeyEvent event = new KeyEvent(KeyEvent.ACTION_UP, keycode);
try {
- mSessionBinder.sendMediaButton(event);
+ return mSessionBinder.sendMediaButton(keyEvent);
} catch (RemoteException e) {
Log.d(TAG, "Dead object in sendMediaButton", e);
}
+ return false;
}
/**
@@ -171,7 +172,7 @@ public final class MediaController {
* @param params Any parameters to include with the command
* @param cb The callback to receive the result on
*/
- public void sendCommand(String command, Bundle params, ResultReceiver cb) {
+ public void sendControlCommand(String command, Bundle params, ResultReceiver cb) {
if (TextUtils.isEmpty(command)) {
throw new IllegalArgumentException("command cannot be null or empty");
}
@@ -282,7 +283,7 @@ public final class MediaController {
*
* @param event
*/
- public void onEvent(String event, Bundle extras) {
+ public void onSessionEvent(String event, Bundle extras) {
}
/**
@@ -354,7 +355,7 @@ public final class MediaController {
public void handleMessage(Message msg) {
switch (msg.what) {
case MSG_EVENT:
- mCallback.onEvent((String) msg.obj, msg.getData());
+ mCallback.onSessionEvent((String) msg.obj, msg.getData());
break;
case MSG_ROUTE:
mCallback.onRouteChanged((RouteInfo) msg.obj);
diff --git a/media/java/android/media/session/MediaSession.java b/media/java/android/media/session/MediaSession.java
index 539dc3c..51dcee1 100644
--- a/media/java/android/media/session/MediaSession.java
+++ b/media/java/android/media/session/MediaSession.java
@@ -49,12 +49,8 @@ import java.util.List;
* <p>
* A MediaSession is created by calling
* {@link MediaSessionManager#createSession(String)}. Once a session is created
- * apps that have the MEDIA_CONTENT_CONTROL permission can interact with the
- * session through
- * {@link MediaSessionManager#getActiveSessions(android.content.ComponentName)}.
- * The owner of the session may also use {@link #getSessionToken()} to allow
- * apps without this permission to create a {@link MediaController} to interact
- * with this session.
+ * the owner of the session may use {@link #getSessionToken()} to allow apps to
+ * create a {@link MediaController} to interact with this session.
* <p>
* To receive commands, media keys, and other events a Callback must be set with
* {@link #addCallback(Callback)}.
@@ -166,7 +162,9 @@ public final class MediaSession {
}
/**
- * Set the callback to receive updates on.
+ * Add a callback to receive updates on for the MediaSession. This includes
+ * media button and volume events. The caller's thread will be used to post
+ * events.
*
* @param callback The callback object
*/
@@ -246,7 +244,7 @@ public final class MediaSession {
/**
* Set the stream this session is playing on. This will affect the system's
- * volume handling for this session. If {@link #useRemotePlayback} was
+ * volume handling for this session. If {@link #setPlaybackToRemote} was
* previously called it will stop receiving volume commands and the system
* will begin sending volume changes to the appropriate stream.
* <p>
@@ -254,21 +252,21 @@ public final class MediaSession {
*
* @param stream The {@link AudioManager} stream this session is playing on.
*/
- public void useLocalPlayback(int stream) {
+ public void setPlaybackToLocal(int stream) {
// TODO
}
/**
* Configure this session to use remote volume handling. This must be called
* to receive volume button events, otherwise the system will adjust the
- * current stream volume for this session. If {@link #useLocalPlayback} was
- * previously called that stream will stop receiving volume changes for this
- * session.
+ * current stream volume for this session. If {@link #setPlaybackToLocal}
+ * was previously called that stream will stop receiving volume changes for
+ * this session.
*
* @param volumeProvider The provider that will handle volume changes. May
* not be null.
*/
- public void useRemotePlayback(RemoteVolumeProvider volumeProvider) {
+ public void setPlaybackToRemote(RemoteVolumeProvider volumeProvider) {
if (volumeProvider == null) {
throw new IllegalArgumentException("volumeProvider may not be null!");
}
@@ -312,7 +310,7 @@ public final class MediaSession {
* @param event The name of the event to send
* @param extras Any extras included with the event
*/
- public void sendEvent(String event, Bundle extras) {
+ public void sendSessionEvent(String event, Bundle extras) {
if (TextUtils.isEmpty(event)) {
throw new IllegalArgumentException("event cannot be null or empty");
}
@@ -525,7 +523,7 @@ public final class MediaSession {
* @param mediaButtonIntent an intent containing the KeyEvent as an
* extra
*/
- public void onMediaButton(Intent mediaButtonIntent) {
+ public void onMediaButtonEvent(Intent mediaButtonIntent) {
}
/**
@@ -536,7 +534,7 @@ public final class MediaSession {
* @param command
* @param extras optional
*/
- public void onCommand(String command, Bundle extras, ResultReceiver cb) {
+ public void onControlCommand(String command, Bundle extras, ResultReceiver cb) {
}
/**
@@ -645,7 +643,7 @@ public final class MediaSession {
if (session != null) {
TransportPerformer tp = session.getTransportPerformer();
if (tp != null) {
- tp.onPlay();
+ tp.dispatchPlay();
}
}
}
@@ -656,7 +654,7 @@ public final class MediaSession {
if (session != null) {
TransportPerformer tp = session.getTransportPerformer();
if (tp != null) {
- tp.onPause();
+ tp.dispatchPause();
}
}
}
@@ -667,7 +665,7 @@ public final class MediaSession {
if (session != null) {
TransportPerformer tp = session.getTransportPerformer();
if (tp != null) {
- tp.onStop();
+ tp.dispatchStop();
}
}
}
@@ -678,7 +676,7 @@ public final class MediaSession {
if (session != null) {
TransportPerformer tp = session.getTransportPerformer();
if (tp != null) {
- tp.onNext();
+ tp.dispatchNext();
}
}
}
@@ -689,7 +687,7 @@ public final class MediaSession {
if (session != null) {
TransportPerformer tp = session.getTransportPerformer();
if (tp != null) {
- tp.onPrevious();
+ tp.dispatchPrevious();
}
}
}
@@ -700,7 +698,7 @@ public final class MediaSession {
if (session != null) {
TransportPerformer tp = session.getTransportPerformer();
if (tp != null) {
- tp.onFastForward();
+ tp.dispatchFastForward();
}
}
}
@@ -711,7 +709,7 @@ public final class MediaSession {
if (session != null) {
TransportPerformer tp = session.getTransportPerformer();
if (tp != null) {
- tp.onRewind();
+ tp.dispatchRewind();
}
}
}
@@ -722,7 +720,7 @@ public final class MediaSession {
if (session != null) {
TransportPerformer tp = session.getTransportPerformer();
if (tp != null) {
- tp.onSeekTo(pos);
+ tp.dispatchSeekTo(pos);
}
}
}
@@ -733,7 +731,7 @@ public final class MediaSession {
if (session != null) {
TransportPerformer tp = session.getTransportPerformer();
if (tp != null) {
- tp.onRate(rating);
+ tp.dispatchRate(rating);
}
}
}
@@ -776,11 +774,11 @@ public final class MediaSession {
}
switch (msg.what) {
case MSG_MEDIA_BUTTON:
- mCallback.onMediaButton((Intent) msg.obj);
+ mCallback.onMediaButtonEvent((Intent) msg.obj);
break;
case MSG_COMMAND:
Command cmd = (Command) msg.obj;
- mCallback.onCommand(cmd.command, cmd.extras, cmd.stub);
+ mCallback.onControlCommand(cmd.command, cmd.extras, cmd.stub);
break;
case MSG_ROUTE_CHANGE:
mCallback.onRequestRouteChange((RouteInfo) msg.obj);
diff --git a/media/java/android/media/session/MediaSessionInfo.java b/media/java/android/media/session/MediaSessionInfo.java
index 3d8d33f..f701211 100644
--- a/media/java/android/media/session/MediaSessionInfo.java
+++ b/media/java/android/media/session/MediaSessionInfo.java
@@ -20,6 +20,8 @@ import android.os.Parcelable;
/**
* Information about a media session, including the owner's package name.
+ *
+ * @hide
*/
public final class MediaSessionInfo implements Parcelable {
private final String mId;
diff --git a/media/java/android/media/session/MediaSessionLegacyHelper.java b/media/java/android/media/session/MediaSessionLegacyHelper.java
index 249b9c4..bdf3628 100644
--- a/media/java/android/media/session/MediaSessionLegacyHelper.java
+++ b/media/java/android/media/session/MediaSessionLegacyHelper.java
@@ -76,7 +76,7 @@ public class MediaSessionLegacyHelper {
}
}
- public void addRccListener(PendingIntent pi, TransportPerformer.Listener listener) {
+ public void addRccListener(PendingIntent pi, TransportPerformer.Callback listener) {
if (pi == null) {
Log.w(TAG, "Pending intent was null, can't add rcc listener.");
return;
@@ -92,9 +92,9 @@ public class MediaSessionLegacyHelper {
return;
}
// Otherwise it changed so we need to switch to the new one
- performer.removeListener(holder.mRccListener);
+ performer.removeCallback(holder.mRccListener);
}
- performer.addListener(listener, mHandler);
+ performer.addCallback(listener, mHandler);
holder.mRccListener = listener;
holder.mFlags |= MediaSession.FLAG_HANDLES_TRANSPORT_CONTROLS;
holder.mSession.setFlags(holder.mFlags);
@@ -110,7 +110,7 @@ public class MediaSessionLegacyHelper {
}
SessionHolder holder = getHolder(pi, false);
if (holder != null && holder.mRccListener != null) {
- holder.mSession.getTransportPerformer().removeListener(holder.mRccListener);
+ holder.mSession.getTransportPerformer().removeCallback(holder.mRccListener);
holder.mRccListener = null;
holder.mFlags &= ~MediaSession.FLAG_HANDLES_TRANSPORT_CONTROLS;
holder.mSession.setFlags(holder.mFlags);
@@ -141,7 +141,7 @@ public class MediaSessionLegacyHelper {
// set this flag
holder.mFlags |= MediaSession.FLAG_HANDLES_MEDIA_BUTTONS;
holder.mSession.setFlags(holder.mFlags);
- holder.mSession.getTransportPerformer().addListener(holder.mMediaButtonListener, mHandler);
+ holder.mSession.getTransportPerformer().addCallback(holder.mMediaButtonListener, mHandler);
holder.mMediaButtonReceiver = new MediaButtonReceiver(pi, context);
holder.mSession.addCallback(holder.mMediaButtonReceiver, mHandler);
@@ -156,7 +156,7 @@ public class MediaSessionLegacyHelper {
}
SessionHolder holder = getHolder(pi, false);
if (holder != null && holder.mMediaButtonListener != null) {
- holder.mSession.getTransportPerformer().removeListener(holder.mMediaButtonListener);
+ holder.mSession.getTransportPerformer().removeCallback(holder.mMediaButtonListener);
holder.mFlags &= ~MediaSession.FLAG_HANDLES_MEDIA_BUTTONS;
holder.mSession.setFlags(holder.mFlags);
holder.mMediaButtonListener = null;
@@ -201,12 +201,12 @@ public class MediaSessionLegacyHelper {
}
@Override
- public void onMediaButton(Intent mediaButtonIntent) {
+ public void onMediaButtonEvent(Intent mediaButtonIntent) {
MediaSessionLegacyHelper.sendKeyEvent(mPendingIntent, mContext, mediaButtonIntent);
}
}
- private static final class MediaButtonListener extends TransportPerformer.Listener {
+ private static final class MediaButtonListener extends TransportPerformer.Callback {
private final PendingIntent mPendingIntent;
private final Context mContext;
@@ -226,12 +226,12 @@ public class MediaSessionLegacyHelper {
}
@Override
- public void onNext() {
+ public void onSkipToNext() {
sendKeyEvent(KeyEvent.KEYCODE_MEDIA_NEXT);
}
@Override
- public void onPrevious() {
+ public void onSkipToPrevious() {
sendKeyEvent(KeyEvent.KEYCODE_MEDIA_PREVIOUS);
}
@@ -272,7 +272,7 @@ public class MediaSessionLegacyHelper {
public final PendingIntent mPi;
public MediaButtonListener mMediaButtonListener;
public MediaButtonReceiver mMediaButtonReceiver;
- public TransportPerformer.Listener mRccListener;
+ public TransportPerformer.Callback mRccListener;
public int mFlags;
public SessionHolder(MediaSession session, PendingIntent pi) {
diff --git a/media/java/android/media/session/MediaSessionManager.java b/media/java/android/media/session/MediaSessionManager.java
index 0589a7d..8d5e338 100644
--- a/media/java/android/media/session/MediaSessionManager.java
+++ b/media/java/android/media/session/MediaSessionManager.java
@@ -106,6 +106,7 @@ public final class MediaSessionManager {
* @param notificationListener The enabled notification listener component.
* May be null.
* @return A list of controllers for ongoing sessions
+ * @hide
*/
public List<MediaController> getActiveSessions(ComponentName notificationListener) {
return getActiveSessionsForUser(notificationListener, UserHandle.myUserId());
diff --git a/media/java/android/media/session/MediaSessionToken.java b/media/java/android/media/session/MediaSessionToken.java
index f5569a4..86f5662 100644
--- a/media/java/android/media/session/MediaSessionToken.java
+++ b/media/java/android/media/session/MediaSessionToken.java
@@ -20,7 +20,12 @@ import android.media.session.ISessionController;
import android.os.Parcel;
import android.os.Parcelable;
-public class MediaSessionToken implements Parcelable {
+/**
+ * Represents an ongoing session. This may be passed to apps by the session
+ * owner to allow them to create a {@link MediaController} to communicate with
+ * the session.
+ */
+public final class MediaSessionToken implements Parcelable {
private ISessionController mBinder;
/**
diff --git a/media/java/android/media/session/PlaybackState.java b/media/java/android/media/session/PlaybackState.java
index 7ef38eaa..e09ac3f 100644
--- a/media/java/android/media/session/PlaybackState.java
+++ b/media/java/android/media/session/PlaybackState.java
@@ -22,7 +22,7 @@ import android.os.SystemClock;
/**
* Playback state for a {@link MediaSession}. This includes a state like
- * {@link PlaybackState#PLAYSTATE_PLAYING}, the current playback position,
+ * {@link PlaybackState#STATE_PLAYING}, the current playback position,
* and the current control capabilities.
*/
public final class PlaybackState implements Parcelable {
@@ -59,28 +59,28 @@ public final class PlaybackState implements Parcelable {
*
* @see #setActions
*/
- public static final long ACTION_PREVIOUS_ITEM = 1 << 4;
+ public static final long ACTION_SKIP_TO_PREVIOUS = 1 << 4;
/**
* Indicates this performer supports the next command.
*
* @see #setActions
*/
- public static final long ACTION_NEXT_ITEM = 1 << 5;
+ public static final long ACTION_SKIP_TO_NEXT = 1 << 5;
/**
* Indicates this performer supports the fast forward command.
*
* @see #setActions
*/
- public static final long ACTION_FASTFORWARD = 1 << 6;
+ public static final long ACTION_FAST_FORWARD = 1 << 6;
/**
* Indicates this performer supports the set rating command.
*
* @see #setActions
*/
- public static final long ACTION_RATING = 1 << 7;
+ public static final long ACTION_SET_RATING = 1 << 7;
/**
* Indicates this performer supports the seek to command.
@@ -102,42 +102,42 @@ public final class PlaybackState implements Parcelable {
*
* @see #setState
*/
- public final static int PLAYSTATE_NONE = 0;
+ public final static int STATE_NONE = 0;
/**
* State indicating this item is currently stopped.
*
* @see #setState
*/
- public final static int PLAYSTATE_STOPPED = 1;
+ public final static int STATE_STOPPED = 1;
/**
* State indicating this item is currently paused.
*
* @see #setState
*/
- public final static int PLAYSTATE_PAUSED = 2;
+ public final static int STATE_PAUSED = 2;
/**
* State indicating this item is currently playing.
*
* @see #setState
*/
- public final static int PLAYSTATE_PLAYING = 3;
+ public final static int STATE_PLAYING = 3;
/**
* State indicating this item is currently fast forwarding.
*
* @see #setState
*/
- public final static int PLAYSTATE_FAST_FORWARDING = 4;
+ public final static int STATE_FAST_FORWARDING = 4;
/**
* State indicating this item is currently rewinding.
*
* @see #setState
*/
- public final static int PLAYSTATE_REWINDING = 5;
+ public final static int STATE_REWINDING = 5;
/**
* State indicating this item is currently buffering and will begin playing
@@ -145,7 +145,7 @@ public final class PlaybackState implements Parcelable {
*
* @see #setState
*/
- public final static int PLAYSTATE_BUFFERING = 6;
+ public final static int STATE_BUFFERING = 6;
/**
* State indicating this item is currently in an error state. The error
@@ -153,30 +153,30 @@ public final class PlaybackState implements Parcelable {
*
* @see #setState
*/
- public final static int PLAYSTATE_ERROR = 7;
+ public final static int STATE_ERROR = 7;
/**
* State indicating the class doing playback is currently connecting to a
* route. Depending on the implementation you may return to the previous
- * state when the connection finishes or enter {@link #PLAYSTATE_NONE}. If
- * the connection failed {@link #PLAYSTATE_ERROR} should be used.
+ * state when the connection finishes or enter {@link #STATE_NONE}. If
+ * the connection failed {@link #STATE_ERROR} should be used.
* @hide
*/
- public final static int PLAYSTATE_CONNECTING = 8;
+ public final static int STATE_CONNECTING = 8;
/**
* State indicating the player is currently skipping to the previous item.
*
* @see #setState
*/
- public final static int PLAYSTATE_SKIPPING_BACKWARDS = 9;
+ public final static int STATE_SKIPPING_TO_PREVIOUS = 9;
/**
* State indicating the player is currently skipping to the next item.
*
* @see #setState
*/
- public final static int PLAYSTATE_SKIPPING_FORWARDS = 10;
+ public final static int STATE_SKIPPING_TO_NEXT = 10;
/**
* Use this value for the position to indicate the position is not known.
@@ -188,7 +188,7 @@ public final class PlaybackState implements Parcelable {
private long mBufferPosition;
private float mRate;
private long mActions;
- private String mErrorMessage;
+ private CharSequence mErrorMessage;
private long mUpdateTime;
/**
@@ -221,7 +221,7 @@ public final class PlaybackState implements Parcelable {
mUpdateTime = in.readLong();
mBufferPosition = in.readLong();
mActions = in.readLong();
- mErrorMessage = in.readString();
+ mErrorMessage = in.readCharSequence();
}
@@ -252,20 +252,20 @@ public final class PlaybackState implements Parcelable {
dest.writeLong(mUpdateTime);
dest.writeLong(mBufferPosition);
dest.writeLong(mActions);
- dest.writeString(mErrorMessage);
+ dest.writeCharSequence(mErrorMessage);
}
/**
* Get the current state of playback. One of the following:
* <ul>
- * <li> {@link PlaybackState#PLAYSTATE_NONE}</li>
- * <li> {@link PlaybackState#PLAYSTATE_STOPPED}</li>
- * <li> {@link PlaybackState#PLAYSTATE_PLAYING}</li>
- * <li> {@link PlaybackState#PLAYSTATE_PAUSED}</li>
- * <li> {@link PlaybackState#PLAYSTATE_FAST_FORWARDING}</li>
- * <li> {@link PlaybackState#PLAYSTATE_REWINDING}</li>
- * <li> {@link PlaybackState#PLAYSTATE_BUFFERING}</li>
- * <li> {@link PlaybackState#PLAYSTATE_ERROR}</li>
+ * <li> {@link PlaybackState#STATE_NONE}</li>
+ * <li> {@link PlaybackState#STATE_STOPPED}</li>
+ * <li> {@link PlaybackState#STATE_PLAYING}</li>
+ * <li> {@link PlaybackState#STATE_PAUSED}</li>
+ * <li> {@link PlaybackState#STATE_FAST_FORWARDING}</li>
+ * <li> {@link PlaybackState#STATE_REWINDING}</li>
+ * <li> {@link PlaybackState#STATE_BUFFERING}</li>
+ * <li> {@link PlaybackState#STATE_ERROR}</li>
*/
public int getState() {
return mState;
@@ -283,25 +283,25 @@ public final class PlaybackState implements Parcelable {
* <p>
* The state must be one of the following:
* <ul>
- * <li> {@link PlaybackState#PLAYSTATE_NONE}</li>
- * <li> {@link PlaybackState#PLAYSTATE_STOPPED}</li>
- * <li> {@link PlaybackState#PLAYSTATE_PLAYING}</li>
- * <li> {@link PlaybackState#PLAYSTATE_PAUSED}</li>
- * <li> {@link PlaybackState#PLAYSTATE_FAST_FORWARDING}</li>
- * <li> {@link PlaybackState#PLAYSTATE_REWINDING}</li>
- * <li> {@link PlaybackState#PLAYSTATE_BUFFERING}</li>
- * <li> {@link PlaybackState#PLAYSTATE_ERROR}</li>
+ * <li> {@link PlaybackState#STATE_NONE}</li>
+ * <li> {@link PlaybackState#STATE_STOPPED}</li>
+ * <li> {@link PlaybackState#STATE_PLAYING}</li>
+ * <li> {@link PlaybackState#STATE_PAUSED}</li>
+ * <li> {@link PlaybackState#STATE_FAST_FORWARDING}</li>
+ * <li> {@link PlaybackState#STATE_REWINDING}</li>
+ * <li> {@link PlaybackState#STATE_BUFFERING}</li>
+ * <li> {@link PlaybackState#STATE_ERROR}</li>
* </ul>
*
* @param state The current state of playback.
* @param position The position in the current track in ms.
- * @param rate The current rate of playback as a multiple of normal
+ * @param playbackRate The current rate of playback as a multiple of normal
* playback.
*/
- public void setState(int state, long position, float rate) {
+ public void setState(int state, long position, float playbackRate) {
this.mState = state;
this.mPosition = position;
- this.mRate = rate;
+ this.mRate = playbackRate;
mUpdateTime = SystemClock.elapsedRealtime();
}
@@ -337,7 +337,7 @@ public final class PlaybackState implements Parcelable {
*
* @return The current rate of playback.
*/
- public float getRate() {
+ public float getPlaybackRate() {
return mRate;
}
@@ -345,15 +345,15 @@ public final class PlaybackState implements Parcelable {
* Get the current actions available on this session. This should use a
* bitmask of the available actions.
* <ul>
- * <li> {@link PlaybackState#ACTION_PREVIOUS_ITEM}</li>
+ * <li> {@link PlaybackState#ACTION_SKIP_TO_PREVIOUS}</li>
* <li> {@link PlaybackState#ACTION_REWIND}</li>
* <li> {@link PlaybackState#ACTION_PLAY}</li>
* <li> {@link PlaybackState#ACTION_PAUSE}</li>
* <li> {@link PlaybackState#ACTION_STOP}</li>
- * <li> {@link PlaybackState#ACTION_FASTFORWARD}</li>
- * <li> {@link PlaybackState#ACTION_NEXT_ITEM}</li>
+ * <li> {@link PlaybackState#ACTION_FAST_FORWARD}</li>
+ * <li> {@link PlaybackState#ACTION_SKIP_TO_NEXT}</li>
* <li> {@link PlaybackState#ACTION_SEEK_TO}</li>
- * <li> {@link PlaybackState#ACTION_RATING}</li>
+ * <li> {@link PlaybackState#ACTION_SET_RATING}</li>
* </ul>
*/
public long getActions() {
@@ -364,15 +364,15 @@ public final class PlaybackState implements Parcelable {
* Set the current capabilities available on this session. This should use a
* bitmask of the available capabilities.
* <ul>
- * <li> {@link PlaybackState#ACTION_PREVIOUS_ITEM}</li>
+ * <li> {@link PlaybackState#ACTION_SKIP_TO_PREVIOUS}</li>
* <li> {@link PlaybackState#ACTION_REWIND}</li>
* <li> {@link PlaybackState#ACTION_PLAY}</li>
* <li> {@link PlaybackState#ACTION_PAUSE}</li>
* <li> {@link PlaybackState#ACTION_STOP}</li>
- * <li> {@link PlaybackState#ACTION_FASTFORWARD}</li>
- * <li> {@link PlaybackState#ACTION_NEXT_ITEM}</li>
+ * <li> {@link PlaybackState#ACTION_FAST_FORWARD}</li>
+ * <li> {@link PlaybackState#ACTION_SKIP_TO_NEXT}</li>
* <li> {@link PlaybackState#ACTION_SEEK_TO}</li>
- * <li> {@link PlaybackState#ACTION_RATING}</li>
+ * <li> {@link PlaybackState#ACTION_SET_RATING}</li>
* </ul>
*/
public void setActions(long capabilities) {
@@ -381,9 +381,9 @@ public final class PlaybackState implements Parcelable {
/**
* Get a user readable error message. This should be set when the state is
- * {@link PlaybackState#PLAYSTATE_ERROR}.
+ * {@link PlaybackState#STATE_ERROR}.
*/
- public String getErrorMessage() {
+ public CharSequence getErrorMessage() {
return mErrorMessage;
}
@@ -400,9 +400,9 @@ public final class PlaybackState implements Parcelable {
/**
* Set a user readable error message. This should be set when the state is
- * {@link PlaybackState#PLAYSTATE_ERROR}.
+ * {@link PlaybackState#STATE_ERROR}.
*/
- public void setErrorMessage(String errorMessage) {
+ public void setErrorMessage(CharSequence errorMessage) {
mErrorMessage = errorMessage;
}
@@ -417,23 +417,23 @@ public final class PlaybackState implements Parcelable {
public static int getStateFromRccState(int rccState) {
switch (rccState) {
case RemoteControlClient.PLAYSTATE_BUFFERING:
- return PLAYSTATE_BUFFERING;
+ return STATE_BUFFERING;
case RemoteControlClient.PLAYSTATE_ERROR:
- return PLAYSTATE_ERROR;
+ return STATE_ERROR;
case RemoteControlClient.PLAYSTATE_FAST_FORWARDING:
- return PLAYSTATE_FAST_FORWARDING;
+ return STATE_FAST_FORWARDING;
case RemoteControlClient.PLAYSTATE_NONE:
- return PLAYSTATE_NONE;
+ return STATE_NONE;
case RemoteControlClient.PLAYSTATE_PAUSED:
- return PLAYSTATE_PAUSED;
+ return STATE_PAUSED;
case RemoteControlClient.PLAYSTATE_PLAYING:
- return PLAYSTATE_PLAYING;
+ return STATE_PLAYING;
case RemoteControlClient.PLAYSTATE_REWINDING:
- return PLAYSTATE_REWINDING;
+ return STATE_REWINDING;
case RemoteControlClient.PLAYSTATE_SKIPPING_BACKWARDS:
- return PLAYSTATE_SKIPPING_BACKWARDS;
+ return STATE_SKIPPING_TO_PREVIOUS;
case RemoteControlClient.PLAYSTATE_STOPPED:
- return PLAYSTATE_STOPPED;
+ return STATE_STOPPED;
default:
return -1;
}
@@ -457,7 +457,7 @@ public final class PlaybackState implements Parcelable {
private static long getActionForRccFlag(int flag) {
switch (flag) {
case RemoteControlClient.FLAG_KEY_MEDIA_PREVIOUS:
- return ACTION_PREVIOUS_ITEM;
+ return ACTION_SKIP_TO_PREVIOUS;
case RemoteControlClient.FLAG_KEY_MEDIA_REWIND:
return ACTION_REWIND;
case RemoteControlClient.FLAG_KEY_MEDIA_PLAY:
@@ -469,13 +469,13 @@ public final class PlaybackState implements Parcelable {
case RemoteControlClient.FLAG_KEY_MEDIA_STOP:
return ACTION_STOP;
case RemoteControlClient.FLAG_KEY_MEDIA_FAST_FORWARD:
- return ACTION_FASTFORWARD;
+ return ACTION_FAST_FORWARD;
case RemoteControlClient.FLAG_KEY_MEDIA_NEXT:
- return ACTION_NEXT_ITEM;
+ return ACTION_SKIP_TO_NEXT;
case RemoteControlClient.FLAG_KEY_MEDIA_POSITION_UPDATE:
return ACTION_SEEK_TO;
case RemoteControlClient.FLAG_KEY_MEDIA_RATING:
- return ACTION_RATING;
+ return ACTION_SET_RATING;
}
return 0;
}
diff --git a/media/java/android/media/session/RemoteVolumeProvider.java b/media/java/android/media/session/RemoteVolumeProvider.java
index 9526cc8..2dcf649 100644
--- a/media/java/android/media/session/RemoteVolumeProvider.java
+++ b/media/java/android/media/session/RemoteVolumeProvider.java
@@ -4,32 +4,43 @@ package android.media.session;
* Handles requests to adjust or set the volume on a session. This is also used
* to push volume updates back to the session after a request has been handled.
* You can set a volume provider on a session by calling
- * {@link MediaSession#useRemotePlayback}.
+ * {@link MediaSession#setPlaybackToRemote}.
*/
public abstract class RemoteVolumeProvider {
/**
- * Handles relative volume changes via {@link #onAdjustVolume(int)}.
+ * The volume is fixed and can not be modified. Requests to change volume
+ * should be ignored.
*/
- public static final int FLAG_VOLUME_RELATIVE = 1 << 0;
+ public static final int VOLUME_CONTROL_FIXED = 1 << 0;
/**
- * Handles setting the volume via {@link #onSetVolume(int)}.
+ * The volume control uses relative adjustment via
+ * {@link #onAdjustVolumeBy(int)}. Attempts to set the volume to a specific
+ * value should be ignored.
*/
- public static final int FLAG_VOLUME_ABSOLUTE = 1 << 1;
+ public static final int VOLUME_CONTROL_RELATIVE = 1 << 1;
+
+ /**
+ * The volume control uses an absolute value. It may be adjusted using
+ * {@link #onAdjustVolumeBy(int)} or set directly using
+ * {@link #onSetVolumeTo(int)}.
+ */
+ public static final int VOLUME_CONTROL_ABSOLUTE = 1 << 2;
private final int mFlags;
private final int mMaxVolume;
/**
* Create a new volume provider for handling volume events. You must specify
- * the type of events and the maximum volume that can be used.
+ * the type of volume control and the maximum volume that can be used.
*
- * @param flags The flags to use with this provider.
+ * @param volumeControl The method for controlling volume that is used by
+ * this provider.
* @param maxVolume The maximum allowed volume.
*/
- public RemoteVolumeProvider(int flags, int maxVolume) {
- mFlags = flags;
+ public RemoteVolumeProvider(int volumeControl, int maxVolume) {
+ mFlags = volumeControl;
mMaxVolume = maxVolume;
}
@@ -38,7 +49,7 @@ public abstract class RemoteVolumeProvider {
*
* @return The current volume.
*/
- public abstract int getCurrentVolume();
+ public abstract int onGetCurrentVolume();
/**
* Get the flags that were set for this volume provider.
@@ -59,7 +70,7 @@ public abstract class RemoteVolumeProvider {
}
/**
- * Notify the system that the remove playback's volume has been changed.
+ * Notify the system that the remote playback's volume has been changed.
*/
public final void notifyVolumeChanged() {
// TODO
@@ -70,7 +81,7 @@ public abstract class RemoteVolumeProvider {
*
* @param volume The volume to set the output to.
*/
- public void onSetVolume(int volume) {
+ public void onSetVolumeTo(int volume) {
}
/**
@@ -79,6 +90,6 @@ public abstract class RemoteVolumeProvider {
*
* @param delta The amount to change the volume
*/
- public void onAdjustVolume(int delta) {
+ public void onAdjustVolumeBy(int delta) {
}
} \ No newline at end of file
diff --git a/media/java/android/media/session/TransportController.java b/media/java/android/media/session/TransportController.java
index 090489b..4bd39ff 100644
--- a/media/java/android/media/session/TransportController.java
+++ b/media/java/android/media/session/TransportController.java
@@ -144,7 +144,7 @@ public final class TransportController {
/**
* Skip to the next item.
*/
- public void next() {
+ public void skipToNext() {
try {
mBinder.next();
} catch (RemoteException e) {
@@ -167,7 +167,7 @@ public final class TransportController {
/**
* Skip to the previous item.
*/
- public void previous() {
+ public void skipToPrevious() {
try {
mBinder.previous();
} catch (RemoteException e) {
@@ -182,7 +182,7 @@ public final class TransportController {
*
* @param rating The rating to set for the current content
*/
- public void rate(Rating rating) {
+ public void setRating(Rating rating) {
try {
mBinder.rate(rating);
} catch (RemoteException e) {
diff --git a/media/java/android/media/session/TransportPerformer.java b/media/java/android/media/session/TransportPerformer.java
index 1588d8f..9c4c686 100644
--- a/media/java/android/media/session/TransportPerformer.java
+++ b/media/java/android/media/session/TransportPerformer.java
@@ -33,7 +33,7 @@ import java.util.ArrayList;
public final class TransportPerformer {
private static final String TAG = "TransportPerformer";
private final Object mLock = new Object();
- private final ArrayList<MessageHandler> mListeners = new ArrayList<MessageHandler>();
+ private final ArrayList<MessageHandler> mCallbacks = new ArrayList<MessageHandler>();
private ISession mBinder;
@@ -45,35 +45,35 @@ public final class TransportPerformer {
}
/**
- * Add a listener to receive updates on.
+ * Add a callback to receive updates on.
*
- * @param listener The callback object
+ * @param callback The callback object
*/
- public void addListener(Listener listener) {
- addListener(listener, null);
+ public void addCallback(Callback callback) {
+ addCallback(callback, null);
}
/**
- * Add a listener to receive updates on. The updates will be posted to the
+ * Add a callback to receive updates on. The updates will be posted to the
* specified handler. If no handler is provided they will be posted to the
* caller's thread.
*
- * @param listener The listener to receive updates on
+ * @param callback The callback to receive updates on
* @param handler The handler to post the updates on
*/
- public void addListener(Listener listener, Handler handler) {
- if (listener == null) {
- throw new IllegalArgumentException("Listener cannot be null");
+ public void addCallback(Callback callback, Handler handler) {
+ if (callback == null) {
+ throw new IllegalArgumentException("Callback cannot be null");
}
synchronized (mLock) {
- if (getHandlerForListenerLocked(listener) != null) {
- Log.w(TAG, "Listener is already added, ignoring");
+ if (getHandlerForCallbackLocked(callback) != null) {
+ Log.w(TAG, "Callback is already added, ignoring");
}
if (handler == null) {
handler = new Handler();
}
- MessageHandler msgHandler = new MessageHandler(handler.getLooper(), listener);
- mListeners.add(msgHandler);
+ MessageHandler msgHandler = new MessageHandler(handler.getLooper(), callback);
+ mCallbacks.add(msgHandler);
}
}
@@ -81,14 +81,14 @@ public final class TransportPerformer {
* Stop receiving updates on the specified handler. If an update has already
* been posted you may still receive it after this call returns.
*
- * @param listener The listener to stop receiving updates on
+ * @param callback The callback to stop receiving updates on
*/
- public void removeListener(Listener listener) {
- if (listener == null) {
- throw new IllegalArgumentException("Listener cannot be null");
+ public void removeCallback(Callback callback) {
+ if (callback == null) {
+ throw new IllegalArgumentException("Callback cannot be null");
}
synchronized (mLock) {
- removeListenerLocked(listener);
+ removeCallbackLocked(callback);
}
}
@@ -97,7 +97,7 @@ public final class TransportPerformer {
*
* @param state The current state of playback
*/
- public final void setPlaybackState(PlaybackState state) {
+ public void setPlaybackState(PlaybackState state) {
try {
mBinder.setPlaybackState(state);
} catch (RemoteException e) {
@@ -111,7 +111,7 @@ public final class TransportPerformer {
*
* @param metadata The new metadata
*/
- public final void setMetadata(MediaMetadata metadata) {
+ public void setMetadata(MediaMetadata metadata) {
try {
mBinder.setMetadata(metadata);
} catch (RemoteException e) {
@@ -122,80 +122,80 @@ public final class TransportPerformer {
/**
* @hide
*/
- public final void onPlay() {
+ public void dispatchPlay() {
post(MessageHandler.MESSAGE_PLAY);
}
/**
* @hide
*/
- public final void onPause() {
+ public void dispatchPause() {
post(MessageHandler.MESSAGE_PAUSE);
}
/**
* @hide
*/
- public final void onStop() {
+ public void dispatchStop() {
post(MessageHandler.MESSAGE_STOP);
}
/**
* @hide
*/
- public final void onNext() {
+ public void dispatchNext() {
post(MessageHandler.MESSAGE_NEXT);
}
/**
* @hide
*/
- public final void onPrevious() {
+ public void dispatchPrevious() {
post(MessageHandler.MESSAGE_PREVIOUS);
}
/**
* @hide
*/
- public final void onFastForward() {
+ public void dispatchFastForward() {
post(MessageHandler.MESSAGE_FAST_FORWARD);
}
/**
* @hide
*/
- public final void onRewind() {
+ public void dispatchRewind() {
post(MessageHandler.MESSAGE_REWIND);
}
/**
* @hide
*/
- public final void onSeekTo(long pos) {
+ public void dispatchSeekTo(long pos) {
post(MessageHandler.MESSAGE_SEEK_TO, pos);
}
/**
* @hide
*/
- public final void onRate(Rating rating) {
+ public void dispatchRate(Rating rating) {
post(MessageHandler.MESSAGE_RATE, rating);
}
- private MessageHandler getHandlerForListenerLocked(Listener listener) {
- for (int i = mListeners.size() - 1; i >= 0; i--) {
- MessageHandler handler = mListeners.get(i);
- if (listener == handler.mListener) {
+ private MessageHandler getHandlerForCallbackLocked(Callback callback) {
+ for (int i = mCallbacks.size() - 1; i >= 0; i--) {
+ MessageHandler handler = mCallbacks.get(i);
+ if (callback == handler.mCallback) {
return handler;
}
}
return null;
}
- private boolean removeListenerLocked(Listener listener) {
- for (int i = mListeners.size() - 1; i >= 0; i--) {
- if (listener == mListeners.get(i).mListener) {
- mListeners.remove(i);
+ private boolean removeCallbackLocked(Callback callback) {
+ for (int i = mCallbacks.size() - 1; i >= 0; i--) {
+ if (callback == mCallbacks.get(i).mCallback) {
+ mCallbacks.remove(i);
return true;
}
}
@@ -204,8 +204,8 @@ public final class TransportPerformer {
private void post(int what, Object obj) {
synchronized (mLock) {
- for (int i = mListeners.size() - 1; i >= 0; i--) {
- mListeners.get(i).post(what, obj);
+ for (int i = mCallbacks.size() - 1; i >= 0; i--) {
+ mCallbacks.get(i).post(what, obj);
}
}
}
@@ -215,10 +215,10 @@ public final class TransportPerformer {
}
/**
- * Extend Listener to handle transport controls. Listeners can be registered
- * using {@link #addListener}.
+ * Extend to handle transport controls. Callbacks can be registered using
+ * {@link #addCallback}.
*/
- public static abstract class Listener {
+ public static abstract class Callback {
/**
* Override to handle requests to begin playback.
@@ -235,13 +235,13 @@ public final class TransportPerformer {
/**
* Override to handle requests to skip to the next media item.
*/
- public void onNext() {
+ public void onSkipToNext() {
}
/**
* Override to handle requests to skip to the previous media item.
*/
- public void onPrevious() {
+ public void onSkipToPrevious() {
}
/**
@@ -275,7 +275,7 @@ public final class TransportPerformer {
*
* @param rating
*/
- public void onRate(Rating rating) {
+ public void onSetRating(Rating rating) {
}
/**
@@ -284,6 +284,7 @@ public final class TransportPerformer {
* {@link #setPlaybackState}.
*
* @param focusChange The type of focus change, TBD.
+ * @hide
*/
public void onRouteFocusChange(int focusChange) {
}
@@ -300,11 +301,11 @@ public final class TransportPerformer {
private static final int MESSAGE_SEEK_TO = 8;
private static final int MESSAGE_RATE = 9;
- private Listener mListener;
+ private TransportPerformer.Callback mCallback;
- public MessageHandler(Looper looper, Listener cb) {
+ public MessageHandler(Looper looper, TransportPerformer.Callback cb) {
super(looper);
- mListener = cb;
+ mCallback = cb;
}
public void post(int what, Object obj) {
@@ -319,31 +320,31 @@ public final class TransportPerformer {
public void handleMessage(Message msg) {
switch (msg.what) {
case MESSAGE_PLAY:
- mListener.onPlay();
+ mCallback.onPlay();
break;
case MESSAGE_PAUSE:
- mListener.onPause();
+ mCallback.onPause();
break;
case MESSAGE_STOP:
- mListener.onStop();
+ mCallback.onStop();
break;
case MESSAGE_NEXT:
- mListener.onNext();
+ mCallback.onSkipToNext();
break;
case MESSAGE_PREVIOUS:
- mListener.onPrevious();
+ mCallback.onSkipToPrevious();
break;
case MESSAGE_FAST_FORWARD:
- mListener.onFastForward();
+ mCallback.onFastForward();
break;
case MESSAGE_REWIND:
- mListener.onRewind();
+ mCallback.onRewind();
break;
case MESSAGE_SEEK_TO:
- mListener.onSeekTo((Long) msg.obj);
+ mCallback.onSeekTo((Long) msg.obj);
break;
case MESSAGE_RATE:
- mListener.onRate((Rating) msg.obj);
+ mCallback.onSetRating((Rating) msg.obj);
break;
}
}
diff --git a/services/core/java/com/android/server/media/MediaSessionRecord.java b/services/core/java/com/android/server/media/MediaSessionRecord.java
index 030e3ed..c909a54 100644
--- a/services/core/java/com/android/server/media/MediaSessionRecord.java
+++ b/services/core/java/com/android/server/media/MediaSessionRecord.java
@@ -66,13 +66,13 @@ public class MediaSessionRecord implements IBinder.DeathRecipient {
* These are the playback states that count as currently active.
*/
private static final int[] ACTIVE_STATES = {
- PlaybackState.PLAYSTATE_FAST_FORWARDING,
- PlaybackState.PLAYSTATE_REWINDING,
- PlaybackState.PLAYSTATE_SKIPPING_BACKWARDS,
- PlaybackState.PLAYSTATE_SKIPPING_FORWARDS,
- PlaybackState.PLAYSTATE_BUFFERING,
- PlaybackState.PLAYSTATE_CONNECTING,
- PlaybackState.PLAYSTATE_PLAYING };
+ PlaybackState.STATE_FAST_FORWARDING,
+ PlaybackState.STATE_REWINDING,
+ PlaybackState.STATE_SKIPPING_TO_PREVIOUS,
+ PlaybackState.STATE_SKIPPING_TO_NEXT,
+ PlaybackState.STATE_BUFFERING,
+ PlaybackState.STATE_CONNECTING,
+ PlaybackState.STATE_PLAYING };
/**
* The length of time a session will still be considered active after
@@ -301,7 +301,7 @@ public class MediaSessionRecord implements IBinder.DeathRecipient {
if (isActiveState(state)) {
return true;
}
- if (state == mPlaybackState.PLAYSTATE_PAUSED) {
+ if (state == mPlaybackState.STATE_PAUSED) {
long inactiveTime = SystemClock.uptimeMillis() - mLastActiveTime;
if (inactiveTime < ACTIVE_BUFFER) {
return true;
@@ -509,12 +509,12 @@ public class MediaSessionRecord implements IBinder.DeathRecipient {
}
PlaybackState result = null;
if (state != null) {
- if (state.getState() == PlaybackState.PLAYSTATE_PLAYING
- || state.getState() == PlaybackState.PLAYSTATE_FAST_FORWARDING
- || state.getState() == PlaybackState.PLAYSTATE_REWINDING) {
+ if (state.getState() == PlaybackState.STATE_PLAYING
+ || state.getState() == PlaybackState.STATE_FAST_FORWARDING
+ || state.getState() == PlaybackState.STATE_REWINDING) {
long updateTime = state.getLastPositionUpdateTime();
if (updateTime > 0) {
- long position = (long) (state.getRate()
+ long position = (long) (state.getPlaybackRate()
* (SystemClock.elapsedRealtime() - updateTime)) + state.getPosition();
if (duration >= 0 && position > duration) {
position = duration;
@@ -522,7 +522,7 @@ public class MediaSessionRecord implements IBinder.DeathRecipient {
position = 0;
}
result = new PlaybackState(state);
- result.setState(state.getState(), position, state.getRate());
+ result.setState(state.getState(), position, state.getPlaybackRate());
}
}
}
@@ -588,7 +588,7 @@ public class MediaSessionRecord implements IBinder.DeathRecipient {
public void setPlaybackState(PlaybackState state) {
int oldState = mPlaybackState == null ? 0 : mPlaybackState.getState();
int newState = state == null ? 0 : state.getState();
- if (isActiveState(oldState) && newState == PlaybackState.PLAYSTATE_PAUSED) {
+ if (isActiveState(oldState) && newState == PlaybackState.STATE_PAUSED) {
mLastActiveTime = SystemClock.elapsedRealtime();
}
mPlaybackState = state;
@@ -649,14 +649,16 @@ public class MediaSessionRecord implements IBinder.DeathRecipient {
mCb = cb;
}
- public void sendMediaButton(KeyEvent keyEvent, int sequenceId, ResultReceiver cb) {
+ public boolean sendMediaButton(KeyEvent keyEvent, int sequenceId, ResultReceiver cb) {
Intent mediaButtonIntent = new Intent(Intent.ACTION_MEDIA_BUTTON);
mediaButtonIntent.putExtra(Intent.EXTRA_KEY_EVENT, keyEvent);
try {
mCb.onMediaButton(mediaButtonIntent, sequenceId, cb);
+ return true;
} catch (RemoteException e) {
Slog.e(TAG, "Remote failure in sendMediaRequest.", e);
}
+ return false;
}
public void sendCommand(String command, Bundle extras, ResultReceiver cb) {
@@ -788,8 +790,8 @@ public class MediaSessionRecord implements IBinder.DeathRecipient {
}
@Override
- public void sendMediaButton(KeyEvent mediaButtonIntent) {
- mSessionCb.sendMediaButton(mediaButtonIntent, 0, null);
+ public boolean sendMediaButton(KeyEvent mediaButtonIntent) {
+ return mSessionCb.sendMediaButton(mediaButtonIntent, 0, null);
}
@Override
diff --git a/services/core/java/com/android/server/media/MediaSessionStack.java b/services/core/java/com/android/server/media/MediaSessionStack.java
index 7ba9212..56236f8 100644
--- a/services/core/java/com/android/server/media/MediaSessionStack.java
+++ b/services/core/java/com/android/server/media/MediaSessionStack.java
@@ -33,18 +33,18 @@ public class MediaSessionStack {
* bump priority regardless of the old state.
*/
private static final int[] ALWAYS_PRIORITY_STATES = {
- PlaybackState.PLAYSTATE_FAST_FORWARDING,
- PlaybackState.PLAYSTATE_REWINDING,
- PlaybackState.PLAYSTATE_SKIPPING_BACKWARDS,
- PlaybackState.PLAYSTATE_SKIPPING_FORWARDS };
+ PlaybackState.STATE_FAST_FORWARDING,
+ PlaybackState.STATE_REWINDING,
+ PlaybackState.STATE_SKIPPING_TO_PREVIOUS,
+ PlaybackState.STATE_SKIPPING_TO_NEXT };
/**
* These are states that usually indicate the user took an action if they
* were entered from a non-priority state.
*/
private static final int[] TRANSITION_PRIORITY_STATES = {
- PlaybackState.PLAYSTATE_BUFFERING,
- PlaybackState.PLAYSTATE_CONNECTING,
- PlaybackState.PLAYSTATE_PLAYING };
+ PlaybackState.STATE_BUFFERING,
+ PlaybackState.STATE_CONNECTING,
+ PlaybackState.STATE_PLAYING };
private final ArrayList<MediaSessionRecord> mSessions = new ArrayList<MediaSessionRecord>();
diff --git a/tests/OneMedia/src/com/android/onemedia/OnePlayerActivity.java b/tests/OneMedia/src/com/android/onemedia/OnePlayerActivity.java
index 158f5e4..ee407ad 100644
--- a/tests/OneMedia/src/com/android/onemedia/OnePlayerActivity.java
+++ b/tests/OneMedia/src/com/android/onemedia/OnePlayerActivity.java
@@ -99,10 +99,10 @@ public class OnePlayerActivity extends Activity {
switch (v.getId()) {
case R.id.play_button:
Log.d(TAG, "Play button pressed, in state " + mPlaybackState);
- if (mPlaybackState == PlaybackState.PLAYSTATE_PAUSED
- || mPlaybackState == PlaybackState.PLAYSTATE_STOPPED) {
+ if (mPlaybackState == PlaybackState.STATE_PAUSED
+ || mPlaybackState == PlaybackState.STATE_STOPPED) {
mPlayer.play();
- } else if (mPlaybackState == PlaybackState.PLAYSTATE_PLAYING) {
+ } else if (mPlaybackState == PlaybackState.STATE_PLAYING) {
mPlayer.pause();
}
break;
@@ -126,31 +126,31 @@ public class OnePlayerActivity extends Activity {
boolean enableControls = true;
StringBuilder statusBuilder = new StringBuilder();
switch (mPlaybackState) {
- case PlaybackState.PLAYSTATE_PLAYING:
+ case PlaybackState.STATE_PLAYING:
statusBuilder.append("playing");
mPlayButton.setText("Pause");
enablePlay = true;
break;
- case PlaybackState.PLAYSTATE_PAUSED:
+ case PlaybackState.STATE_PAUSED:
statusBuilder.append("paused");
mPlayButton.setText("Play");
enablePlay = true;
break;
- case PlaybackState.PLAYSTATE_STOPPED:
+ case PlaybackState.STATE_STOPPED:
statusBuilder.append("ended");
mPlayButton.setText("Play");
enablePlay = true;
break;
- case PlaybackState.PLAYSTATE_ERROR:
+ case PlaybackState.STATE_ERROR:
statusBuilder.append("error: ").append(state.getErrorMessage());
break;
- case PlaybackState.PLAYSTATE_BUFFERING:
+ case PlaybackState.STATE_BUFFERING:
statusBuilder.append("buffering");
break;
- case PlaybackState.PLAYSTATE_NONE:
+ case PlaybackState.STATE_NONE:
statusBuilder.append("none");
break;
- case PlaybackState.PLAYSTATE_CONNECTING:
+ case PlaybackState.STATE_CONNECTING:
statusBuilder.append("connecting");
enableControls = false;
break;
diff --git a/tests/OneMedia/src/com/android/onemedia/PlayerService.java b/tests/OneMedia/src/com/android/onemedia/PlayerService.java
index 0ad6dd1..934f4ef 100644
--- a/tests/OneMedia/src/com/android/onemedia/PlayerService.java
+++ b/tests/OneMedia/src/com/android/onemedia/PlayerService.java
@@ -103,11 +103,11 @@ public class PlayerService extends Service {
@Override
public void onPlayStateChanged(PlaybackState state) {
switch (state.getState()) {
- case PlaybackState.PLAYSTATE_PLAYING:
+ case PlaybackState.STATE_PLAYING:
onPlaybackStarted();
break;
- case PlaybackState.PLAYSTATE_STOPPED:
- case PlaybackState.PLAYSTATE_ERROR:
+ case PlaybackState.STATE_STOPPED:
+ case PlaybackState.STATE_ERROR:
onPlaybackEnded();
break;
}
diff --git a/tests/OneMedia/src/com/android/onemedia/PlayerSession.java b/tests/OneMedia/src/com/android/onemedia/PlayerSession.java
index 94d0851..97a0a08 100644
--- a/tests/OneMedia/src/com/android/onemedia/PlayerSession.java
+++ b/tests/OneMedia/src/com/android/onemedia/PlayerSession.java
@@ -85,7 +85,7 @@ public class PlayerSession {
mSession = man.createSession("OneMedia");
mSession.addCallback(mCallback);
mPerformer = mSession.getTransportPerformer();
- mPerformer.addListener(new TransportListener());
+ mPerformer.addCallback(new TransportListener());
mPerformer.setPlaybackState(mPlaybackState);
mSession.setFlags(MediaSession.FLAG_HANDLES_TRANSPORT_CONTROLS);
mSession.setRouteOptions(mRouteOptions);
@@ -120,7 +120,7 @@ public class PlayerSession {
}
private void updateState(int newState) {
- float rate = newState == PlaybackState.PLAYSTATE_PLAYING ? 1 : 0;
+ float rate = newState == PlaybackState.STATE_PLAYING ? 1 : 0;
long position = mRenderer == null ? -1 : mRenderer.getSeekPosition();
mPlaybackState.setState(newState, position, rate);
mPerformer.setPlaybackState(mPlaybackState);
@@ -135,7 +135,7 @@ public class PlayerSession {
@Override
public void onError(int type, int extra, Bundle extras, Throwable error) {
Log.d(TAG, "Sending onError with type " + type + " and extra " + extra);
- mPlaybackState.setState(PlaybackState.PLAYSTATE_ERROR, -1, 0);
+ mPlaybackState.setState(PlaybackState.STATE_ERROR, -1, 0);
if (error != null) {
mPlaybackState.setErrorMessage(error.getLocalizedMessage());
}
@@ -157,23 +157,23 @@ public class PlayerSession {
switch (newState) {
case Renderer.STATE_ENDED:
case Renderer.STATE_STOPPED:
- mPlaybackState.setState(PlaybackState.PLAYSTATE_STOPPED, position, 0);
+ mPlaybackState.setState(PlaybackState.STATE_STOPPED, position, 0);
break;
case Renderer.STATE_INIT:
case Renderer.STATE_PREPARING:
- mPlaybackState.setState(PlaybackState.PLAYSTATE_BUFFERING, position, 0);
+ mPlaybackState.setState(PlaybackState.STATE_BUFFERING, position, 0);
break;
case Renderer.STATE_ERROR:
- mPlaybackState.setState(PlaybackState.PLAYSTATE_ERROR, position, 0);
+ mPlaybackState.setState(PlaybackState.STATE_ERROR, position, 0);
break;
case Renderer.STATE_PAUSED:
- mPlaybackState.setState(PlaybackState.PLAYSTATE_PAUSED, position, 0);
+ mPlaybackState.setState(PlaybackState.STATE_PAUSED, position, 0);
break;
case Renderer.STATE_PLAYING:
- mPlaybackState.setState(PlaybackState.PLAYSTATE_PLAYING, position, 1);
+ mPlaybackState.setState(PlaybackState.STATE_PLAYING, position, 1);
break;
default:
- mPlaybackState.setState(PlaybackState.PLAYSTATE_ERROR, position, 0);
+ mPlaybackState.setState(PlaybackState.STATE_ERROR, position, 0);
mPlaybackState.setErrorMessage("unkown state");
break;
}
@@ -191,7 +191,7 @@ public class PlayerSession {
public void onFocusLost() {
Log.d(TAG, "Focus lost, changing state to " + Renderer.STATE_PAUSED);
long position = mRenderer == null ? -1 : mRenderer.getSeekPosition();
- mPlaybackState.setState(PlaybackState.PLAYSTATE_PAUSED, position, 0);
+ mPlaybackState.setState(PlaybackState.STATE_PAUSED, position, 0);
mPerformer.setPlaybackState(mPlaybackState);
if (mListener != null) {
mListener.onPlayStateChanged(mPlaybackState);
@@ -206,7 +206,7 @@ public class PlayerSession {
private class SessionCb extends MediaSession.Callback {
@Override
- public void onMediaButton(Intent mediaRequestIntent) {
+ public void onMediaButtonEvent(Intent mediaRequestIntent) {
if (Intent.ACTION_MEDIA_BUTTON.equals(mediaRequestIntent.getAction())) {
KeyEvent event = (KeyEvent) mediaRequestIntent
.getParcelableExtra(Intent.EXTRA_KEY_EVENT);
@@ -233,12 +233,12 @@ public class PlayerSession {
mRoute = null;
mRenderer = new LocalRenderer(mContext, null);
mRenderer.registerListener(mRenderListener);
- updateState(PlaybackState.PLAYSTATE_NONE);
+ updateState(PlaybackState.STATE_NONE);
} else {
// Use remote route
mSession.connect(route, mRouteOptions.get(0));
mRenderer = null;
- updateState(PlaybackState.PLAYSTATE_CONNECTING);
+ updateState(PlaybackState.STATE_CONNECTING);
}
}
@@ -249,7 +249,7 @@ public class PlayerSession {
mRouteControls.addListener(mRouteListener);
Log.d(TAG, "Connected to route, registering listener");
mRenderer = new OneMRPRenderer(mRouteControls);
- updateState(PlaybackState.PLAYSTATE_NONE);
+ updateState(PlaybackState.STATE_NONE);
}
@Override
@@ -258,7 +258,7 @@ public class PlayerSession {
}
}
- private class TransportListener extends TransportPerformer.Listener {
+ private class TransportListener extends TransportPerformer.Callback {
@Override
public void onPlay() {
mRenderer.onPlay();
diff --git a/tests/OneMedia/src/com/android/onemedia/provider/OneMediaRouteProvider.java b/tests/OneMedia/src/com/android/onemedia/provider/OneMediaRouteProvider.java
index 6537d49..f2d691c 100644
--- a/tests/OneMedia/src/com/android/onemedia/provider/OneMediaRouteProvider.java
+++ b/tests/OneMedia/src/com/android/onemedia/provider/OneMediaRouteProvider.java
@@ -149,7 +149,7 @@ public class OneMediaRouteProvider extends RouteProviderService {
public void onError(int type, int extra, Bundle extras, Throwable error) {
Log.d(TAG, "Sending onError with type " + type + " and extra " + extra);
if (mControls != null) {
- mControls.sendPlaybackChangeEvent(PlaybackState.PLAYSTATE_ERROR);
+ mControls.sendPlaybackChangeEvent(PlaybackState.STATE_ERROR);
}
}
@@ -165,23 +165,23 @@ public class OneMediaRouteProvider extends RouteProviderService {
switch (newState) {
case Renderer.STATE_ENDED:
case Renderer.STATE_STOPPED:
- mPlaybackState.setState(PlaybackState.PLAYSTATE_STOPPED, position, 0);
+ mPlaybackState.setState(PlaybackState.STATE_STOPPED, position, 0);
break;
case Renderer.STATE_INIT:
case Renderer.STATE_PREPARING:
- mPlaybackState.setState(PlaybackState.PLAYSTATE_BUFFERING, position, 0);
+ mPlaybackState.setState(PlaybackState.STATE_BUFFERING, position, 0);
break;
case Renderer.STATE_ERROR:
- mPlaybackState.setState(PlaybackState.PLAYSTATE_ERROR, position, 0);
+ mPlaybackState.setState(PlaybackState.STATE_ERROR, position, 0);
break;
case Renderer.STATE_PAUSED:
- mPlaybackState.setState(PlaybackState.PLAYSTATE_PAUSED, position, 0);
+ mPlaybackState.setState(PlaybackState.STATE_PAUSED, position, 0);
break;
case Renderer.STATE_PLAYING:
- mPlaybackState.setState(PlaybackState.PLAYSTATE_PLAYING, position, 1);
+ mPlaybackState.setState(PlaybackState.STATE_PLAYING, position, 1);
break;
default:
- mPlaybackState.setState(PlaybackState.PLAYSTATE_ERROR, position, 0);
+ mPlaybackState.setState(PlaybackState.STATE_ERROR, position, 0);
mPlaybackState.setErrorMessage("unkown state");
break;
}
@@ -196,7 +196,7 @@ public class OneMediaRouteProvider extends RouteProviderService {
@Override
public void onFocusLost() {
Log.d(TAG, "Focus lost, changing state to " + Renderer.STATE_PAUSED);
- mPlaybackState.setState(PlaybackState.PLAYSTATE_PAUSED, mRenderer.getSeekPosition(), 0);
+ mPlaybackState.setState(PlaybackState.STATE_PAUSED, mRenderer.getSeekPosition(), 0);
mRenderer.onPause();
}