Loading api/current.txt +1 −1 Original line number Diff line number Diff line Loading @@ -15519,7 +15519,7 @@ package android.media.session { public final class SessionManager { method public android.media.session.Session createSession(java.lang.String); method public java.util.List<android.media.session.SessionController> getActiveSessions(); method public java.util.List<android.media.session.SessionController> getActiveSessions(android.content.ComponentName); } public class SessionToken implements android.os.Parcelable { media/java/android/media/session/ISession.aidl +1 −0 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ interface ISession { void sendEvent(String event, in Bundle data); ISessionController getController(); void setTransportPerformerEnabled(); void setFlags(long flags); void publish(); void destroy(); Loading media/java/android/media/session/ISessionManager.aidl +2 −0 Original line number Diff line number Diff line Loading @@ -15,6 +15,7 @@ package android.media.session; import android.content.ComponentName; import android.media.session.ISession; import android.media.session.ISessionCallback; import android.os.Bundle; Loading @@ -25,4 +26,5 @@ import android.os.Bundle; */ interface ISessionManager { ISession createSession(String packageName, in ISessionCallback cb, String tag); List<IBinder> getSessions(in ComponentName compName); } No newline at end of file media/java/android/media/session/MediaSessionLegacyHelper.java +2 −1 Original line number Diff line number Diff line Loading @@ -43,7 +43,8 @@ public class MediaSessionLegacyHelper { private Handler mHandler = new Handler(Looper.getMainLooper()); // The legacy APIs use PendingIntents to register/unregister media button // receivers and these are associated with RCC. private ArrayMap<PendingIntent, SessionHolder> mSessions = new ArrayMap<PendingIntent, SessionHolder>(); private ArrayMap<PendingIntent, SessionHolder> mSessions = new ArrayMap<PendingIntent, SessionHolder>(); private MediaSessionLegacyHelper(Context context) { mSessionManager = (SessionManager) context Loading media/java/android/media/session/Session.java +34 −6 Original line number Diff line number Diff line Loading @@ -45,12 +45,13 @@ import java.util.List; * media to multiple routes or 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()}. The owner of * the session may also use {@link #getSessionToken()} to allow apps without * this permission to create a {@link SessionController} to interact with this * session. * {@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 * with this session. * <p> * To receive commands, media keys, and other events a Callback must be set with * {@link #addCallback(Callback)}. Loading @@ -63,6 +64,15 @@ import java.util.List; public final class Session { private static final String TAG = "Session"; /** * System only flag for a session that needs to have priority over all other * sessions. This flag ensures this session will receive media button events * regardless of the current ordering in the system. * * @hide */ public static final long FLAG_EXCLUSIVE_GLOBAL_PRIORITY = 1 << 32; private static final int MSG_MEDIA_BUTTON = 1; private static final int MSG_COMMAND = 2; private static final int MSG_ROUTE_CHANGE = 3; Loading Loading @@ -183,6 +193,24 @@ public final class Session { return mPerformer; } /** * Set any flags for the session. This cannot be called after calling * {@link #publish()}. * * @param flags The flags to set for this session. * @hide remove hide once we have non-system flags */ public void setFlags(long flags) { if (mPublished) { throw new IllegalStateException("setFlags may not be called after publish"); } try { mBinder.setFlags(flags); } catch (RemoteException e) { Log.wtf(TAG, "Failure in setFlags.", e); } } /** * Call after you have finished setting up the session. This will make it * available to listeners and begin pushing updates to MediaControllers. Loading Loading
api/current.txt +1 −1 Original line number Diff line number Diff line Loading @@ -15519,7 +15519,7 @@ package android.media.session { public final class SessionManager { method public android.media.session.Session createSession(java.lang.String); method public java.util.List<android.media.session.SessionController> getActiveSessions(); method public java.util.List<android.media.session.SessionController> getActiveSessions(android.content.ComponentName); } public class SessionToken implements android.os.Parcelable {
media/java/android/media/session/ISession.aidl +1 −0 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ interface ISession { void sendEvent(String event, in Bundle data); ISessionController getController(); void setTransportPerformerEnabled(); void setFlags(long flags); void publish(); void destroy(); Loading
media/java/android/media/session/ISessionManager.aidl +2 −0 Original line number Diff line number Diff line Loading @@ -15,6 +15,7 @@ package android.media.session; import android.content.ComponentName; import android.media.session.ISession; import android.media.session.ISessionCallback; import android.os.Bundle; Loading @@ -25,4 +26,5 @@ import android.os.Bundle; */ interface ISessionManager { ISession createSession(String packageName, in ISessionCallback cb, String tag); List<IBinder> getSessions(in ComponentName compName); } No newline at end of file
media/java/android/media/session/MediaSessionLegacyHelper.java +2 −1 Original line number Diff line number Diff line Loading @@ -43,7 +43,8 @@ public class MediaSessionLegacyHelper { private Handler mHandler = new Handler(Looper.getMainLooper()); // The legacy APIs use PendingIntents to register/unregister media button // receivers and these are associated with RCC. private ArrayMap<PendingIntent, SessionHolder> mSessions = new ArrayMap<PendingIntent, SessionHolder>(); private ArrayMap<PendingIntent, SessionHolder> mSessions = new ArrayMap<PendingIntent, SessionHolder>(); private MediaSessionLegacyHelper(Context context) { mSessionManager = (SessionManager) context Loading
media/java/android/media/session/Session.java +34 −6 Original line number Diff line number Diff line Loading @@ -45,12 +45,13 @@ import java.util.List; * media to multiple routes or 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()}. The owner of * the session may also use {@link #getSessionToken()} to allow apps without * this permission to create a {@link SessionController} to interact with this * session. * {@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 * with this session. * <p> * To receive commands, media keys, and other events a Callback must be set with * {@link #addCallback(Callback)}. Loading @@ -63,6 +64,15 @@ import java.util.List; public final class Session { private static final String TAG = "Session"; /** * System only flag for a session that needs to have priority over all other * sessions. This flag ensures this session will receive media button events * regardless of the current ordering in the system. * * @hide */ public static final long FLAG_EXCLUSIVE_GLOBAL_PRIORITY = 1 << 32; private static final int MSG_MEDIA_BUTTON = 1; private static final int MSG_COMMAND = 2; private static final int MSG_ROUTE_CHANGE = 3; Loading Loading @@ -183,6 +193,24 @@ public final class Session { return mPerformer; } /** * Set any flags for the session. This cannot be called after calling * {@link #publish()}. * * @param flags The flags to set for this session. * @hide remove hide once we have non-system flags */ public void setFlags(long flags) { if (mPublished) { throw new IllegalStateException("setFlags may not be called after publish"); } try { mBinder.setFlags(flags); } catch (RemoteException e) { Log.wtf(TAG, "Failure in setFlags.", e); } } /** * Call after you have finished setting up the session. This will make it * available to listeners and begin pushing updates to MediaControllers. Loading