diff options
author | RoboErik <epastern@google.com> | 2014-05-19 19:29:05 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-05-19 19:29:06 +0000 |
commit | b19c19265448a6252b1c14f3da85d52e50be34c3 (patch) | |
tree | c23aa43611ce8fa0c77570f26ed6d4bcf421fabd /media | |
parent | b4f4f69e4c56ad1217be9a3c792d4723f6db2256 (diff) | |
parent | 42ea7eecd149161ed192d3029f0d77d1d08a4aa5 (diff) | |
download | frameworks_base-b19c19265448a6252b1c14f3da85d52e50be34c3.zip frameworks_base-b19c19265448a6252b1c14f3da85d52e50be34c3.tar.gz frameworks_base-b19c19265448a6252b1c14f3da85d52e50be34c3.tar.bz2 |
Merge "Rename session classes to have media prefix, hide routes"
Diffstat (limited to 'media')
27 files changed, 155 insertions, 130 deletions
diff --git a/media/java/android/media/session/SessionToken.aidl b/media/java/android/media/MediaMetadata.aidl index db35f85..66ee483 100644 --- a/media/java/android/media/session/SessionToken.aidl +++ b/media/java/android/media/MediaMetadata.aidl @@ -13,6 +13,6 @@ ** limitations under the License. */ -package android.media.session; +package android.media; -parcelable SessionToken; +parcelable MediaMetadata; diff --git a/media/java/android/media/session/MediaMetadata.java b/media/java/android/media/MediaMetadata.java index 8a8af45..ff73a10 100644 --- a/media/java/android/media/session/MediaMetadata.java +++ b/media/java/android/media/MediaMetadata.java @@ -13,12 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package android.media.session; +package android.media; import android.graphics.Bitmap; -import android.media.MediaMetadataEditor; -import android.media.MediaMetadataRetriever; -import android.media.Rating; import android.os.Bundle; import android.os.Parcel; import android.os.Parcelable; diff --git a/media/java/android/media/MediaMetadataEditor.java b/media/java/android/media/MediaMetadataEditor.java index 1a4e8da..ca44e9d 100644 --- a/media/java/android/media/MediaMetadataEditor.java +++ b/media/java/android/media/MediaMetadataEditor.java @@ -17,7 +17,6 @@ package android.media; import android.graphics.Bitmap; -import android.media.session.MediaMetadata; import android.os.Bundle; import android.os.Parcelable; import android.util.Log; diff --git a/media/java/android/media/RemoteControlClient.java b/media/java/android/media/RemoteControlClient.java index 8368df9..37f45c2 100644 --- a/media/java/android/media/RemoteControlClient.java +++ b/media/java/android/media/RemoteControlClient.java @@ -24,10 +24,9 @@ import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.Paint; import android.graphics.RectF; -import android.media.session.MediaMetadata; import android.media.session.MediaSessionLegacyHelper; import android.media.session.PlaybackState; -import android.media.session.Session; +import android.media.session.MediaSession; import android.media.session.TransportPerformer; import android.os.Bundle; import android.os.Handler; @@ -341,7 +340,7 @@ public class RemoteControlClient */ public final static int FLAG_INFORMATION_REQUEST_ALBUM_ART = 1 << 3; - private Session mSession; + private MediaSession mSession; /** * Class constructor. diff --git a/media/java/android/media/routeprovider/RouteConnection.java b/media/java/android/media/routeprovider/RouteConnection.java index 9214ff8..43692c1 100644 --- a/media/java/android/media/routeprovider/RouteConnection.java +++ b/media/java/android/media/routeprovider/RouteConnection.java @@ -40,6 +40,7 @@ import java.util.List; * interfaces. Use {@link #addRouteInterface(String)} to add an interface and * {@link #getRouteInterface(String)} to retrieve the interface's handle anytime * after it has been added. + * @hide */ public final class RouteConnection { private static final String TAG = "RouteConnection"; diff --git a/media/java/android/media/routeprovider/RouteInterfaceHandler.java b/media/java/android/media/routeprovider/RouteInterfaceHandler.java index 9693dc6..e7f8bbf 100644 --- a/media/java/android/media/routeprovider/RouteInterfaceHandler.java +++ b/media/java/android/media/routeprovider/RouteInterfaceHandler.java @@ -16,7 +16,7 @@ package android.media.routeprovider; import android.media.session.Route; -import android.media.session.Session; +import android.media.session.MediaSession; import android.media.session.RouteInterface; import android.os.Bundle; import android.os.Handler; @@ -33,7 +33,7 @@ import java.util.ArrayList; * connected media route. * <p> * A {@link RouteProviderService} may expose multiple interfaces on a - * {@link RouteConnection} for a {@link Session} to interact with. A + * {@link RouteConnection} for a {@link MediaSession} to interact with. A * provider creates an interface with * {@link RouteConnection#addRouteInterface(String)} to allow messages to be * routed appropriately. Events are then sent through a specific interface and @@ -47,6 +47,7 @@ import java.util.ArrayList; * It is recommended you wrap this interface with a standard implementation to * avoid errors, but for simple interfaces this class may be used directly. TODO * add link to sample code. + * @hide */ public final class RouteInterfaceHandler { private static final String TAG = "RouteInterfaceHandler"; @@ -184,7 +185,7 @@ public final class RouteInterfaceHandler { public abstract static class CommandListener { /** * This is called when a command is received that matches this - * interface. Commands are sent by a {@link Session} that is + * interface. Commands are sent by a {@link MediaSession} that is * connected to the route this interface is registered with. * * @param iface The interface the command was received on. @@ -197,7 +198,7 @@ public final class RouteInterfaceHandler { * true may be returned if the command will be handled * asynchronously. * @see Route - * @see Session + * @see MediaSession */ public abstract boolean onCommand(RouteInterfaceHandler iface, String command, Bundle args, ResultReceiver cb); diff --git a/media/java/android/media/routeprovider/RoutePlaybackControlsHandler.java b/media/java/android/media/routeprovider/RoutePlaybackControlsHandler.java index dcef79a..f2c40d2 100644 --- a/media/java/android/media/routeprovider/RoutePlaybackControlsHandler.java +++ b/media/java/android/media/routeprovider/RoutePlaybackControlsHandler.java @@ -28,6 +28,7 @@ import android.util.Log; * Standard wrapper for using playback controls over a {@link RouteInterfaceHandler}. * This is the provider half of the interface. Sessions should use * {@link RoutePlaybackControls} to interact with this interface. + * @hide */ public final class RoutePlaybackControlsHandler { private static final String TAG = "RoutePlaybackControls"; diff --git a/media/java/android/media/routeprovider/RouteProviderService.java b/media/java/android/media/routeprovider/RouteProviderService.java index 6ebfb5b..a6ef0bb 100644 --- a/media/java/android/media/routeprovider/RouteProviderService.java +++ b/media/java/android/media/routeprovider/RouteProviderService.java @@ -64,6 +64,7 @@ import java.util.List; * </intent-filter> * </service> * </pre> + * @hide */ public abstract class RouteProviderService extends Service { private static final String TAG = "RouteProvider"; diff --git a/media/java/android/media/routeprovider/RouteRequest.java b/media/java/android/media/routeprovider/RouteRequest.java index 68475c0..2ba75de 100644 --- a/media/java/android/media/routeprovider/RouteRequest.java +++ b/media/java/android/media/routeprovider/RouteRequest.java @@ -16,7 +16,7 @@ package android.media.routeprovider; import android.media.session.RouteOptions; -import android.media.session.SessionInfo; +import android.media.session.MediaSessionInfo; import android.os.Parcel; import android.os.Parcelable; @@ -30,16 +30,17 @@ import java.io.PrintWriter; * provides the full set of connection parameters they would like to use for a * connection. An app that can connect in multiple ways will be represented by * multiple requests. + * @hide */ public final class RouteRequest implements Parcelable { - private final SessionInfo mSessionInfo; + private final MediaSessionInfo mSessionInfo; private final RouteOptions mOptions; private final boolean mActive; /** * @hide */ - public RouteRequest(SessionInfo info, RouteOptions connRequest, + public RouteRequest(MediaSessionInfo info, RouteOptions connRequest, boolean active) { mSessionInfo = info; mOptions = connRequest; @@ -47,7 +48,7 @@ public final class RouteRequest implements Parcelable { } private RouteRequest(Parcel in) { - mSessionInfo = SessionInfo.CREATOR.createFromParcel(in); + mSessionInfo = MediaSessionInfo.CREATOR.createFromParcel(in); mOptions = RouteOptions.CREATOR.createFromParcel(in); mActive = in.readInt() != 0; } @@ -57,7 +58,7 @@ public final class RouteRequest implements Parcelable { * * @return Info on the session making the request */ - public SessionInfo getSessionInfo() { + public MediaSessionInfo getSessionInfo() { return mSessionInfo; } diff --git a/media/java/android/media/session/ISession.aidl b/media/java/android/media/session/ISession.aidl index 096550f..c4233c3 100644 --- a/media/java/android/media/session/ISession.aidl +++ b/media/java/android/media/session/ISession.aidl @@ -15,8 +15,8 @@ package android.media.session; +import android.media.MediaMetadata; import android.media.session.ISessionController; -import android.media.session.MediaMetadata; import android.media.session.RouteOptions; import android.media.session.RouteCommand; import android.media.session.RouteInfo; diff --git a/media/java/android/media/session/ISessionController.aidl b/media/java/android/media/session/ISessionController.aidl index e2e046f..5ddb6db 100644 --- a/media/java/android/media/session/ISessionController.aidl +++ b/media/java/android/media/session/ISessionController.aidl @@ -16,9 +16,9 @@ package android.media.session; import android.content.Intent; +import android.media.MediaMetadata; import android.media.Rating; import android.media.session.ISessionControllerCallback; -import android.media.session.MediaMetadata; import android.media.session.PlaybackState; import android.os.Bundle; import android.os.ResultReceiver; diff --git a/media/java/android/media/session/ISessionControllerCallback.aidl b/media/java/android/media/session/ISessionControllerCallback.aidl index bc1ae05..e823153 100644 --- a/media/java/android/media/session/ISessionControllerCallback.aidl +++ b/media/java/android/media/session/ISessionControllerCallback.aidl @@ -15,7 +15,7 @@ package android.media.session; -import android.media.session.MediaMetadata; +import android.media.MediaMetadata; import android.media.session.RouteInfo; import android.media.session.PlaybackState; import android.os.Bundle; diff --git a/media/java/android/media/session/SessionController.java b/media/java/android/media/session/MediaController.java index dc4f7d9..642ac2f 100644 --- a/media/java/android/media/session/SessionController.java +++ b/media/java/android/media/session/MediaController.java @@ -16,6 +16,7 @@ package android.media.session; +import android.media.MediaMetadata; import android.os.Bundle; import android.os.Handler; import android.os.Looper; @@ -34,13 +35,13 @@ import java.util.ArrayList; * other commands can be sent to the session. A callback may be registered to * receive updates from the session, such as metadata and play state changes. * <p> - * A MediaController can be created through {@link SessionManager} if you + * A MediaController can be created through {@link MediaSessionManager} if you * hold the "android.permission.MEDIA_CONTENT_CONTROL" permission or directly if - * you have a {@link SessionToken} from the session owner. + * you have a {@link MediaSessionToken} from the session owner. * <p> * MediaController objects are thread-safe. */ -public final class SessionController { +public final class MediaController { private static final String TAG = "SessionController"; private static final int MSG_EVENT = 1; @@ -58,15 +59,15 @@ public final class SessionController { private TransportController mTransportController; - private SessionController(ISessionController sessionBinder) { + private MediaController(ISessionController sessionBinder) { mSessionBinder = sessionBinder; } /** * @hide */ - public static SessionController fromBinder(ISessionController sessionBinder) { - SessionController controller = new SessionController(sessionBinder); + public static MediaController fromBinder(ISessionController sessionBinder) { + MediaController controller = new MediaController(sessionBinder); try { controller.mSessionBinder.registerCallbackListener(controller.mCbStub); if (controller.mSessionBinder.isTransportControlEnabled()) { @@ -87,7 +88,7 @@ public final class SessionController { * @param token The session token to use * @return A controller for the session or null */ - public static SessionController fromToken(SessionToken token) { + public static MediaController fromToken(MediaSessionToken token) { return fromBinder(token.getBinder()); } @@ -184,6 +185,8 @@ public final class SessionController { /** * Request that the route picker be shown for this session. This should * generally be called in response to a user action. + * + * @hide */ public void showRoutePicker() { try { @@ -285,22 +288,23 @@ public final class SessionController { /** * Override to handle route changes for this session. * - * @param route + * @param route The new route + * @hide */ public void onRouteChanged(RouteInfo route) { } } private final static class CallbackStub extends ISessionControllerCallback.Stub { - private final WeakReference<SessionController> mController; + private final WeakReference<MediaController> mController; - public CallbackStub(SessionController controller) { - mController = new WeakReference<SessionController>(controller); + public CallbackStub(MediaController controller) { + mController = new WeakReference<MediaController>(controller); } @Override public void onEvent(String event, Bundle extras) { - SessionController controller = mController.get(); + MediaController controller = mController.get(); if (controller != null) { controller.postEvent(event, extras); } @@ -308,7 +312,7 @@ public final class SessionController { @Override public void onRouteChanged(RouteInfo route) { - SessionController controller = mController.get(); + MediaController controller = mController.get(); if (controller != null) { controller.postRouteChanged(route); } @@ -316,7 +320,7 @@ public final class SessionController { @Override public void onPlaybackStateChanged(PlaybackState state) { - SessionController controller = mController.get(); + MediaController controller = mController.get(); if (controller != null) { TransportController tc = controller.getTransportController(); if (tc != null) { @@ -327,7 +331,7 @@ public final class SessionController { @Override public void onMetadataChanged(MediaMetadata metadata) { - SessionController controller = mController.get(); + MediaController controller = mController.get(); if (controller != null) { TransportController tc = controller.getTransportController(); if (tc != null) { @@ -339,9 +343,9 @@ public final class SessionController { } private final static class MessageHandler extends Handler { - private final SessionController.Callback mCallback; + private final MediaController.Callback mCallback; - public MessageHandler(Looper looper, SessionController.Callback cb) { + public MessageHandler(Looper looper, MediaController.Callback cb) { super(looper, null, true); mCallback = cb; } diff --git a/media/java/android/media/session/Session.java b/media/java/android/media/session/MediaSession.java index e439772..5b9adaa 100644 --- a/media/java/android/media/session/Session.java +++ b/media/java/android/media/session/MediaSession.java @@ -36,21 +36,21 @@ import java.util.ArrayList; import java.util.List; /** - * Allows interaction with media controllers, media routes, volume keys, media - * buttons, and transport controls. + * Allows interaction with media controllers, volume keys, media buttons, and + * transport controls. * <p> * A MediaSession should be created when an app wants to publish media playback - * information or negotiate with a media route. In general an app only needs one - * session for all playback, though multiple sessions can be created for sending - * media to multiple routes or to provide finer grain controls of media. + * information or handle media keys. In general an app only needs one session + * for all playback, though multiple sessions can be created to provide finer + * grain controls of media. * <p> * A MediaSession is created by calling - * {@link SessionManager#createSession(String)}. Once a session is created apps - * that have the MEDIA_CONTENT_CONTROL permission can interact with the session - * through - * {@link SessionManager#getActiveSessions(android.content.ComponentName)}. The - * owner of the session may also use {@link #getSessionToken()} to allow apps - * without this permission to create a {@link SessionController} to interact + * {@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. * <p> * To receive commands, media keys, and other events a Callback must be set with @@ -61,7 +61,7 @@ import java.util.List; * <p> * MediaSession objects are thread safe */ -public final class Session { +public final class MediaSession { private static final String TAG = "Session"; /** @@ -89,28 +89,33 @@ public final class Session { /** * Indicates the session was disconnected because the user that the session * belonged to is stopping. + * @hide */ public static final int DISCONNECT_REASON_USER_STOPPING = 1; /** * Indicates the session was disconnected because the provider disconnected * the route. + * @hide */ public static final int DISCONNECT_REASON_PROVIDER_DISCONNECTED = 2; /** * Indicates the session was disconnected because the route has changed. + * @hide */ public static final int DISCONNECT_REASON_ROUTE_CHANGED = 3; /** * Indicates the session was disconnected because the session owner * requested it disconnect. + * @hide */ public static final int DISCONNECT_REASON_SESSION_DISCONNECTED = 4; /** * Indicates the session was disconnected because it was destroyed. + * @hide */ public static final int DISCONNECT_REASON_SESSION_DESTROYED = 5; @@ -133,7 +138,7 @@ public final class Session { private final Object mLock = new Object(); - private final SessionToken mSessionToken; + private final MediaSessionToken mSessionToken; private final ISession mBinder; private final CallbackStub mCbStub; @@ -150,7 +155,7 @@ public final class Session { /** * @hide */ - public Session(ISession binder, CallbackStub cbStub) { + public MediaSession(ISession binder, CallbackStub cbStub) { mBinder = binder; mCbStub = cbStub; ISessionController controllerBinder = null; @@ -159,7 +164,7 @@ public final class Session { } catch (RemoteException e) { throw new RuntimeException("Dead object in MediaSessionController constructor: ", e); } - mSessionToken = new SessionToken(controllerBinder); + mSessionToken = new MediaSessionToken(controllerBinder); mPerformer = new TransportPerformer(mBinder); } @@ -174,7 +179,7 @@ public final class Session { /** * Add a callback to receive updates for the MediaSession. This includes - * events like route updates, media buttons, and focus changes. + * media button and volume events. * * @param callback The callback to receive updates on. * @param handler The handler that events should be posted on. @@ -295,13 +300,13 @@ public final class Session { /** * Retrieve a token object that can be used by apps to create a - * {@link SessionController} for interacting with this session. The owner of + * {@link MediaController} for interacting with this session. The owner of * the session is responsible for deciding how to distribute these tokens. * * @return A token that can be used to create a MediaController for this * session */ - public SessionToken getSessionToken() { + public MediaSessionToken getSessionToken() { return mSessionToken; } @@ -311,8 +316,8 @@ public final class Session { * Connection updates will be sent to the callback's * {@link Callback#onRouteConnected(Route)} and * {@link Callback#onRouteDisconnected(Route, int)} methods. If the - * connection fails {@link Callback#onRouteDisconnected(Route, int)} - * will be called. + * connection fails {@link Callback#onRouteDisconnected(Route, int)} will be + * called. * <p> * If you already have a connection to this route it will be disconnected * before the new connection is established. TODO add an easy way to compare @@ -320,6 +325,7 @@ public final class Session { * * @param route The route the app is trying to connect to. * @param request The connection request to use. + * @hide */ public void connect(RouteInfo route, RouteOptions request) { if (route == null) { @@ -338,6 +344,8 @@ public final class Session { /** * Disconnect from the current route. After calling you will be switched * back to the default route. + * + * @hide */ public void disconnect() { if (mRoute != null) { @@ -354,6 +362,7 @@ public final class Session { * will be used for picking valid routes. * * @param options The set of route options your app may use to connect. + * @hide */ public void setRouteOptions(List<RouteOptions> options) { try { @@ -498,6 +507,7 @@ public final class Session { * ongoing playback if necessary. * * @param route + * @hide */ public void onRequestRouteChange(RouteInfo route) { } @@ -507,6 +517,7 @@ public final class Session { * are now valid. * * @param route The route that was connected + * @hide */ public void onRouteConnected(Route route) { } @@ -526,6 +537,7 @@ public final class Session { * * @param route The route that disconnected * @param reason The reason for the disconnect + * @hide */ public void onRouteDisconnected(Route route, int reason) { } @@ -535,16 +547,16 @@ public final class Session { * @hide */ public static class CallbackStub extends ISessionCallback.Stub { - private WeakReference<Session> mMediaSession; + private WeakReference<MediaSession> mMediaSession; - public void setMediaSession(Session session) { - mMediaSession = new WeakReference<Session>(session); + public void setMediaSession(MediaSession session) { + mMediaSession = new WeakReference<MediaSession>(session); } @Override public void onCommand(String command, Bundle extras, ResultReceiver cb) throws RemoteException { - Session session = mMediaSession.get(); + MediaSession session = mMediaSession.get(); if (session != null) { session.postCommand(command, extras, cb); } @@ -553,7 +565,7 @@ public final class Session { @Override public void onMediaButton(Intent mediaButtonIntent, ResultReceiver cb) throws RemoteException { - Session session = mMediaSession.get(); + MediaSession session = mMediaSession.get(); if (session != null) { session.postMediaButton(mediaButtonIntent); } @@ -564,7 +576,7 @@ public final class Session { @Override public void onRequestRouteChange(RouteInfo route) throws RemoteException { - Session session = mMediaSession.get(); + MediaSession session = mMediaSession.get(); if (session != null) { session.postRequestRouteChange(route); } @@ -572,7 +584,7 @@ public final class Session { @Override public void onRouteConnected(RouteInfo route, RouteOptions options) { - Session session = mMediaSession.get(); + MediaSession session = mMediaSession.get(); if (session != null) { session.postRouteConnected(route, options); } @@ -580,7 +592,7 @@ public final class Session { @Override public void onRouteDisconnected(RouteInfo route, int reason) { - Session session = mMediaSession.get(); + MediaSession session = mMediaSession.get(); if (session != null) { session.postRouteDisconnected(route, reason); } @@ -588,7 +600,7 @@ public final class Session { @Override public void onPlay() throws RemoteException { - Session session = mMediaSession.get(); + MediaSession session = mMediaSession.get(); if (session != null) { TransportPerformer tp = session.getTransportPerformer(); if (tp != null) { @@ -599,7 +611,7 @@ public final class Session { @Override public void onPause() throws RemoteException { - Session session = mMediaSession.get(); + MediaSession session = mMediaSession.get(); if (session != null) { TransportPerformer tp = session.getTransportPerformer(); if (tp != null) { @@ -610,7 +622,7 @@ public final class Session { @Override public void onStop() throws RemoteException { - Session session = mMediaSession.get(); + MediaSession session = mMediaSession.get(); if (session != null) { TransportPerformer tp = session.getTransportPerformer(); if (tp != null) { @@ -621,7 +633,7 @@ public final class Session { @Override public void onNext() throws RemoteException { - Session session = mMediaSession.get(); + MediaSession session = mMediaSession.get(); if (session != null) { TransportPerformer tp = session.getTransportPerformer(); if (tp != null) { @@ -632,7 +644,7 @@ public final class Session { @Override public void onPrevious() throws RemoteException { - Session session = mMediaSession.get(); + MediaSession session = mMediaSession.get(); if (session != null) { TransportPerformer tp = session.getTransportPerformer(); if (tp != null) { @@ -643,7 +655,7 @@ public final class Session { @Override public void onFastForward() throws RemoteException { - Session session = mMediaSession.get(); + MediaSession session = mMediaSession.get(); if (session != null) { TransportPerformer tp = session.getTransportPerformer(); if (tp != null) { @@ -654,7 +666,7 @@ public final class Session { @Override public void onRewind() throws RemoteException { - Session session = mMediaSession.get(); + MediaSession session = mMediaSession.get(); if (session != null) { TransportPerformer tp = session.getTransportPerformer(); if (tp != null) { @@ -665,7 +677,7 @@ public final class Session { @Override public void onSeekTo(long pos) throws RemoteException { - Session session = mMediaSession.get(); + MediaSession session = mMediaSession.get(); if (session != null) { TransportPerformer tp = session.getTransportPerformer(); if (tp != null) { @@ -676,7 +688,7 @@ public final class Session { @Override public void onRate(Rating rating) throws RemoteException { - Session session = mMediaSession.get(); + MediaSession session = mMediaSession.get(); if (session != null) { TransportPerformer tp = session.getTransportPerformer(); if (tp != null) { @@ -687,7 +699,7 @@ public final class Session { @Override public void onRouteEvent(RouteEvent event) throws RemoteException { - Session session = mMediaSession.get(); + MediaSession session = mMediaSession.get(); if (session != null) { RouteInterface.EventListener iface = session.mInterfaceListeners.get(event.getIface()); @@ -708,9 +720,9 @@ public final class Session { } private class MessageHandler extends Handler { - private Session.Callback mCallback; + private MediaSession.Callback mCallback; - public MessageHandler(Looper looper, Session.Callback callback) { + public MessageHandler(Looper looper, MediaSession.Callback callback) { super(looper, null, true); mCallback = callback; } diff --git a/media/java/android/media/session/SessionInfo.java b/media/java/android/media/session/MediaSessionInfo.java index 2b65528..3d8d33f 100644 --- a/media/java/android/media/session/SessionInfo.java +++ b/media/java/android/media/session/MediaSessionInfo.java @@ -21,19 +21,19 @@ import android.os.Parcelable; /** * Information about a media session, including the owner's package name. */ -public final class SessionInfo implements Parcelable { +public final class MediaSessionInfo implements Parcelable { private final String mId; private final String mPackageName; /** * @hide */ - public SessionInfo(String id, String packageName) { + public MediaSessionInfo(String id, String packageName) { mId = id; mPackageName = packageName; } - private SessionInfo(Parcel in) { + private MediaSessionInfo(Parcel in) { mId = in.readString(); mPackageName = in.readString(); } @@ -72,16 +72,16 @@ public final class SessionInfo implements Parcelable { dest.writeString(mPackageName); } - public static final Parcelable.Creator<SessionInfo> CREATOR - = new Parcelable.Creator<SessionInfo>() { + public static final Parcelable.Creator<MediaSessionInfo> CREATOR + = new Parcelable.Creator<MediaSessionInfo>() { @Override - public SessionInfo createFromParcel(Parcel in) { - return new SessionInfo(in); + public MediaSessionInfo createFromParcel(Parcel in) { + return new MediaSessionInfo(in); } @Override - public SessionInfo[] newArray(int size) { - return new SessionInfo[size]; + public MediaSessionInfo[] newArray(int size) { + return new MediaSessionInfo[size]; } }; } diff --git a/media/java/android/media/session/MediaSessionLegacyHelper.java b/media/java/android/media/session/MediaSessionLegacyHelper.java index e1eae09..2e02a66 100644 --- a/media/java/android/media/session/MediaSessionLegacyHelper.java +++ b/media/java/android/media/session/MediaSessionLegacyHelper.java @@ -40,7 +40,7 @@ public class MediaSessionLegacyHelper { private static final Object sLock = new Object(); private static MediaSessionLegacyHelper sInstance; - private SessionManager mSessionManager; + private MediaSessionManager mSessionManager; private Handler mHandler = new Handler(Looper.getMainLooper()); // The legacy APIs use PendingIntents to register/unregister media button // receivers and these are associated with RCC. @@ -48,7 +48,7 @@ public class MediaSessionLegacyHelper { = new ArrayMap<PendingIntent, SessionHolder>(); private MediaSessionLegacyHelper(Context context) { - mSessionManager = (SessionManager) context + mSessionManager = (MediaSessionManager) context .getSystemService(Context.MEDIA_SESSION_SERVICE); } @@ -64,7 +64,7 @@ public class MediaSessionLegacyHelper { return sInstance; } - public Session getSession(PendingIntent pi) { + public MediaSession getSession(PendingIntent pi) { SessionHolder holder = mSessions.get(pi); return holder == null ? null : holder.mSession; } @@ -96,7 +96,7 @@ public class MediaSessionLegacyHelper { } performer.addListener(listener, mHandler); holder.mRccListener = listener; - holder.mFlags |= Session.FLAG_HANDLES_TRANSPORT_CONTROLS; + holder.mFlags |= MediaSession.FLAG_HANDLES_TRANSPORT_CONTROLS; holder.mSession.setFlags(holder.mFlags); holder.update(); if (DEBUG) { @@ -112,7 +112,7 @@ public class MediaSessionLegacyHelper { if (holder != null && holder.mRccListener != null) { holder.mSession.getTransportPerformer().removeListener(holder.mRccListener); holder.mRccListener = null; - holder.mFlags &= ~Session.FLAG_HANDLES_TRANSPORT_CONTROLS; + holder.mFlags &= ~MediaSession.FLAG_HANDLES_TRANSPORT_CONTROLS; holder.mSession.setFlags(holder.mFlags); holder.update(); if (DEBUG) { @@ -137,7 +137,7 @@ public class MediaSessionLegacyHelper { return; } holder.mMediaButtonListener = new MediaButtonListener(pi, context); - holder.mFlags |= Session.FLAG_HANDLES_MEDIA_BUTTONS; + holder.mFlags |= MediaSession.FLAG_HANDLES_MEDIA_BUTTONS; holder.mSession.setFlags(holder.mFlags); holder.mSession.getTransportPerformer().addListener(holder.mMediaButtonListener, mHandler); @@ -155,7 +155,7 @@ public class MediaSessionLegacyHelper { SessionHolder holder = getHolder(pi, false); if (holder != null && holder.mMediaButtonListener != null) { holder.mSession.getTransportPerformer().removeListener(holder.mMediaButtonListener); - holder.mFlags &= ~Session.FLAG_HANDLES_MEDIA_BUTTONS; + holder.mFlags &= ~MediaSession.FLAG_HANDLES_MEDIA_BUTTONS; holder.mSession.setFlags(holder.mFlags); holder.mMediaButtonListener = null; @@ -171,7 +171,7 @@ public class MediaSessionLegacyHelper { private SessionHolder getHolder(PendingIntent pi, boolean createIfMissing) { SessionHolder holder = mSessions.get(pi); if (holder == null && createIfMissing) { - Session session = mSessionManager.createSession(TAG); + MediaSession session = mSessionManager.createSession(TAG); session.setActive(true); holder = new SessionHolder(session, pi); mSessions.put(pi, holder); @@ -189,7 +189,7 @@ public class MediaSessionLegacyHelper { } } - private static final class MediaButtonReceiver extends Session.Callback { + private static final class MediaButtonReceiver extends MediaSession.Callback { private final PendingIntent mPendingIntent; private final Context mContext; @@ -266,14 +266,14 @@ public class MediaSessionLegacyHelper { } private class SessionHolder { - public final Session mSession; + public final MediaSession mSession; public final PendingIntent mPi; public MediaButtonListener mMediaButtonListener; public MediaButtonReceiver mMediaButtonReceiver; public TransportPerformer.Listener mRccListener; public int mFlags; - public SessionHolder(Session session, PendingIntent pi) { + public SessionHolder(MediaSession session, PendingIntent pi) { mSession = session; mPi = pi; } diff --git a/media/java/android/media/session/SessionManager.java b/media/java/android/media/session/MediaSessionManager.java index 1838132..0589a7d 100644 --- a/media/java/android/media/session/SessionManager.java +++ b/media/java/android/media/session/MediaSessionManager.java @@ -39,10 +39,10 @@ import java.util.List; * get an instance of this class. * <p> * - * @see Session - * @see SessionController + * @see MediaSession + * @see MediaController */ -public final class SessionManager { +public final class MediaSessionManager { private static final String TAG = "SessionManager"; private final ISessionManager mService; @@ -52,7 +52,7 @@ public final class SessionManager { /** * @hide */ - public SessionManager(Context context) { + public MediaSessionManager(Context context) { // Consider rewriting like DisplayManagerGlobal // Decide if we need context mContext = context; @@ -64,9 +64,9 @@ public final class SessionManager { * Creates a new session. * * @param tag A short name for debugging purposes - * @return a {@link Session} for the new session + * @return a {@link MediaSession} for the new session */ - public Session createSession(String tag) { + public MediaSession createSession(String tag) { return createSessionAsUser(tag, UserHandle.myUserId()); } @@ -78,13 +78,13 @@ public final class SessionManager { * * @param tag A short name for debugging purposes * @param userId The user id to create the session as. - * @return a {@link Session} for the new session + * @return a {@link MediaSession} for the new session * @hide */ - public Session createSessionAsUser(String tag, int userId) { + public MediaSession createSessionAsUser(String tag, int userId) { try { - Session.CallbackStub cbStub = new Session.CallbackStub(); - Session session = new Session(mService + MediaSession.CallbackStub cbStub = new MediaSession.CallbackStub(); + MediaSession session = new MediaSession(mService .createSession(mContext.getPackageName(), cbStub, tag, userId), cbStub); cbStub.setMediaSession(session); @@ -107,7 +107,7 @@ public final class SessionManager { * May be null. * @return A list of controllers for ongoing sessions */ - public List<SessionController> getActiveSessions(ComponentName notificationListener) { + public List<MediaController> getActiveSessions(ComponentName notificationListener) { return getActiveSessionsForUser(notificationListener, UserHandle.myUserId()); } @@ -124,13 +124,13 @@ public final class SessionManager { * @return A list of controllers for ongoing sessions. * @hide */ - public List<SessionController> getActiveSessionsForUser(ComponentName notificationListener, + public List<MediaController> getActiveSessionsForUser(ComponentName notificationListener, int userId) { - ArrayList<SessionController> controllers = new ArrayList<SessionController>(); + ArrayList<MediaController> controllers = new ArrayList<MediaController>(); try { List<IBinder> binders = mService.getSessions(notificationListener, userId); for (int i = binders.size() - 1; i >= 0; i--) { - SessionController controller = SessionController.fromBinder(ISessionController.Stub + MediaController controller = MediaController.fromBinder(ISessionController.Stub .asInterface(binders.get(i))); controllers.add(controller); } diff --git a/media/java/android/media/session/MediaMetadata.aidl b/media/java/android/media/session/MediaSessionToken.aidl index 4431d9d..5812682 100644 --- a/media/java/android/media/session/MediaMetadata.aidl +++ b/media/java/android/media/session/MediaSessionToken.aidl @@ -15,4 +15,4 @@ package android.media.session; -parcelable MediaMetadata; +parcelable MediaSessionToken; diff --git a/media/java/android/media/session/SessionToken.java b/media/java/android/media/session/MediaSessionToken.java index 59486f6..f5569a4 100644 --- a/media/java/android/media/session/SessionToken.java +++ b/media/java/android/media/session/MediaSessionToken.java @@ -20,17 +20,17 @@ import android.media.session.ISessionController; import android.os.Parcel; import android.os.Parcelable; -public class SessionToken implements Parcelable { +public class MediaSessionToken implements Parcelable { private ISessionController mBinder; /** * @hide */ - SessionToken(ISessionController binder) { + MediaSessionToken(ISessionController binder) { mBinder = binder; } - private SessionToken(Parcel in) { + private MediaSessionToken(Parcel in) { mBinder = ISessionController.Stub.asInterface(in.readStrongBinder()); } @@ -51,16 +51,16 @@ public class SessionToken implements Parcelable { dest.writeStrongBinder(mBinder.asBinder()); } - public static final Parcelable.Creator<SessionToken> CREATOR - = new Parcelable.Creator<SessionToken>() { + public static final Parcelable.Creator<MediaSessionToken> CREATOR + = new Parcelable.Creator<MediaSessionToken>() { @Override - public SessionToken createFromParcel(Parcel in) { - return new SessionToken(in); + public MediaSessionToken createFromParcel(Parcel in) { + return new MediaSessionToken(in); } @Override - public SessionToken[] newArray(int size) { - return new SessionToken[size]; + public MediaSessionToken[] newArray(int size) { + return new MediaSessionToken[size]; } }; } diff --git a/media/java/android/media/session/PlaybackState.java b/media/java/android/media/session/PlaybackState.java index 3254e5d..7ef38eaa 100644 --- a/media/java/android/media/session/PlaybackState.java +++ b/media/java/android/media/session/PlaybackState.java @@ -21,7 +21,7 @@ import android.os.Parcelable; import android.os.SystemClock; /** - * Playback state for a {@link Session}. This includes a state like + * Playback state for a {@link MediaSession}. This includes a state like * {@link PlaybackState#PLAYSTATE_PLAYING}, the current playback position, * and the current control capabilities. */ @@ -160,6 +160,7 @@ public final class PlaybackState implements Parcelable { * 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. + * @hide */ public final static int PLAYSTATE_CONNECTING = 8; diff --git a/media/java/android/media/session/Route.java b/media/java/android/media/session/Route.java index c9530a6..935eb5b 100644 --- a/media/java/android/media/session/Route.java +++ b/media/java/android/media/session/Route.java @@ -28,17 +28,18 @@ import java.util.List; * to. The MediaRoute must be used to get {@link RouteInterface} * instances which can be used to communicate over a specific interface on the * route. + * @hide */ public final class Route { private static final String TAG = "Route"; private final RouteInfo mInfo; - private final Session mSession; + private final MediaSession mSession; private final RouteOptions mOptions; /** * @hide */ - public Route(RouteInfo info, RouteOptions options, Session session) { + public Route(RouteInfo info, RouteOptions options, MediaSession session) { if (info == null || options == null) { throw new IllegalStateException("Route info was not valid!"); } @@ -93,7 +94,7 @@ public final class Route { /** * @hide */ - Session getSession() { + MediaSession getSession() { return mSession; } } diff --git a/media/java/android/media/session/RouteInfo.java b/media/java/android/media/session/RouteInfo.java index 17df969..02f78f9 100644 --- a/media/java/android/media/session/RouteInfo.java +++ b/media/java/android/media/session/RouteInfo.java @@ -25,6 +25,7 @@ import java.util.List; /** * Information about a route, including its display name, a way to identify it, * and the ways it can be connected to. + * @hide */ public final class RouteInfo implements Parcelable { private final String mName; diff --git a/media/java/android/media/session/RouteInterface.java b/media/java/android/media/session/RouteInterface.java index e9c9fd3..8de4d89 100644 --- a/media/java/android/media/session/RouteInterface.java +++ b/media/java/android/media/session/RouteInterface.java @@ -25,7 +25,7 @@ import android.util.Log; import java.util.ArrayList; /** - * A route can support multiple interfaces for a {@link Session} to + * A route can support multiple interfaces for a {@link MediaSession} to * interact with. To use a specific interface with a route a * MediaSessionRouteInterface needs to be retrieved from the route. An * implementation of the specific interface, like @@ -33,6 +33,7 @@ import java.util.ArrayList; * and reduce errors on that interface. * * @see RoutePlaybackControls for an example + * @hide */ public final class RouteInterface { private static final String TAG = "RouteInterface"; @@ -67,7 +68,7 @@ public final class RouteInterface { private final Route mRoute; private final String mIface; - private final Session mSession; + private final MediaSession mSession; private final Object mLock = new Object(); private final ArrayList<EventHandler> mListeners = new ArrayList<EventHandler>(); @@ -75,7 +76,7 @@ public final class RouteInterface { /** * @hide */ - RouteInterface(Route route, String iface, Session session) { + RouteInterface(Route route, String iface, MediaSession session) { mRoute = route; mIface = iface; mSession = session; diff --git a/media/java/android/media/session/RouteOptions.java b/media/java/android/media/session/RouteOptions.java index 5105867..b4fb341 100644 --- a/media/java/android/media/session/RouteOptions.java +++ b/media/java/android/media/session/RouteOptions.java @@ -34,6 +34,7 @@ import java.util.List; * appropriate route options when it is ready to connect to the route. Each * route options instance must specify a complete set of capabilities to request * when the connection is established. + * @hide */ public final class RouteOptions implements Parcelable { private static final String TAG = "RouteOptions"; diff --git a/media/java/android/media/session/RoutePlaybackControls.java b/media/java/android/media/session/RoutePlaybackControls.java index a3ffb58..8211983 100644 --- a/media/java/android/media/session/RoutePlaybackControls.java +++ b/media/java/android/media/session/RoutePlaybackControls.java @@ -15,6 +15,7 @@ */ package android.media.session; +import android.media.MediaMetadata; import android.os.Bundle; import android.os.Handler; import android.os.ResultReceiver; @@ -23,6 +24,7 @@ import android.os.ResultReceiver; * A standard media control interface for Routes that support queueing and * transport controls. Routes may support multiple interfaces for MediaSessions * to interact with. + * @hide */ public final class RoutePlaybackControls { private static final String TAG = "RoutePlaybackControls"; diff --git a/media/java/android/media/session/TransportController.java b/media/java/android/media/session/TransportController.java index 9574df6..090489b 100644 --- a/media/java/android/media/session/TransportController.java +++ b/media/java/android/media/session/TransportController.java @@ -15,6 +15,7 @@ */ package android.media.session; +import android.media.MediaMetadata; import android.media.Rating; import android.os.Handler; import android.os.Looper; diff --git a/media/java/android/media/session/TransportPerformer.java b/media/java/android/media/session/TransportPerformer.java index 187f48d..1588d8f 100644 --- a/media/java/android/media/session/TransportPerformer.java +++ b/media/java/android/media/session/TransportPerformer.java @@ -16,6 +16,7 @@ package android.media.session; import android.media.AudioManager; +import android.media.MediaMetadata; import android.media.Rating; import android.os.Handler; import android.os.Looper; |