Loading media/java/android/media/session/MediaSession.java +11 −5 Original line number Diff line number Diff line Loading @@ -73,7 +73,8 @@ import java.util.Objects; * create a {@link MediaController} to interact with the session. * <p> * To receive commands, media keys, and other events a {@link Callback} must be * set with {@link #setCallback(Callback)} and {@link #setActive(boolean) * set with {@link #setCallback(Callback)}. To make the session discoverable by * other apps, including system apps, {@link #setActive(boolean) * setActive(true)} must be called. * <p> * When an app is finished performing playback it must call {@link #release()} Loading Loading @@ -399,10 +400,11 @@ public final class MediaSession { } /** * Set if this session is currently active and ready to receive commands. If * set to false your session's controller may not be discoverable. You must * set the session to active before it can start receiving media button * events or transport commands. * Set if this session is currently active. * * <p>If set to false then your session's controller will not be * discoverable via {@link MediaSessionManager#getActiveSessions(int)} by * other apps, including system apps. * * @param active Whether this session is active or not. */ Loading @@ -421,6 +423,10 @@ public final class MediaSession { /** * Get the current active state of this session. * * <p>If false then your session's controller will not be discoverable via * {@link MediaSessionManager#getActiveSessions(int)} by other apps, * including system apps. * * @return True if the session is active, false otherwise. */ public boolean isActive() { Loading media/java/android/media/session/MediaSessionManager.java +3 −3 Original line number Diff line number Diff line Loading @@ -170,7 +170,7 @@ public final class MediaSessionManager { } /** * Get a list of controllers for all ongoing sessions. The controllers will * Get a list of controllers for all active sessions. The controllers will * be provided in priority order with the most important controller at index * 0. * <p> Loading @@ -182,7 +182,7 @@ public final class MediaSessionManager { * * @param notificationListener The enabled notification listener component. * May be null. * @return A list of controllers for ongoing sessions. * @return A list of controllers for active sessions. */ public @NonNull List<MediaController> getActiveSessions( @Nullable ComponentName notificationListener) { Loading Loading @@ -249,7 +249,7 @@ public final class MediaSessionManager { * * @param notificationListener The enabled notification listener component. May be null. * @param userHandle The user handle to fetch sessions for. * @return A list of controllers for ongoing sessions. * @return A list of controllers for active sessions. * @hide */ @SystemApi(client = SystemApi.Client.MODULE_LIBRARIES) Loading services/core/java/com/android/server/media/MediaSessionService.java +2 −2 Original line number Diff line number Diff line Loading @@ -372,8 +372,8 @@ public class MediaSessionService extends SystemService implements Monitor { "onSessionActiveStateChanged:" + " record=" + record + " playbackState=" + playbackState); + " active=" + record.isActive()); reportMediaInteractionEvent(record, isUserEngaged); mHandler.postSessionsChanged(record); } Loading Loading
media/java/android/media/session/MediaSession.java +11 −5 Original line number Diff line number Diff line Loading @@ -73,7 +73,8 @@ import java.util.Objects; * create a {@link MediaController} to interact with the session. * <p> * To receive commands, media keys, and other events a {@link Callback} must be * set with {@link #setCallback(Callback)} and {@link #setActive(boolean) * set with {@link #setCallback(Callback)}. To make the session discoverable by * other apps, including system apps, {@link #setActive(boolean) * setActive(true)} must be called. * <p> * When an app is finished performing playback it must call {@link #release()} Loading Loading @@ -399,10 +400,11 @@ public final class MediaSession { } /** * Set if this session is currently active and ready to receive commands. If * set to false your session's controller may not be discoverable. You must * set the session to active before it can start receiving media button * events or transport commands. * Set if this session is currently active. * * <p>If set to false then your session's controller will not be * discoverable via {@link MediaSessionManager#getActiveSessions(int)} by * other apps, including system apps. * * @param active Whether this session is active or not. */ Loading @@ -421,6 +423,10 @@ public final class MediaSession { /** * Get the current active state of this session. * * <p>If false then your session's controller will not be discoverable via * {@link MediaSessionManager#getActiveSessions(int)} by other apps, * including system apps. * * @return True if the session is active, false otherwise. */ public boolean isActive() { Loading
media/java/android/media/session/MediaSessionManager.java +3 −3 Original line number Diff line number Diff line Loading @@ -170,7 +170,7 @@ public final class MediaSessionManager { } /** * Get a list of controllers for all ongoing sessions. The controllers will * Get a list of controllers for all active sessions. The controllers will * be provided in priority order with the most important controller at index * 0. * <p> Loading @@ -182,7 +182,7 @@ public final class MediaSessionManager { * * @param notificationListener The enabled notification listener component. * May be null. * @return A list of controllers for ongoing sessions. * @return A list of controllers for active sessions. */ public @NonNull List<MediaController> getActiveSessions( @Nullable ComponentName notificationListener) { Loading Loading @@ -249,7 +249,7 @@ public final class MediaSessionManager { * * @param notificationListener The enabled notification listener component. May be null. * @param userHandle The user handle to fetch sessions for. * @return A list of controllers for ongoing sessions. * @return A list of controllers for active sessions. * @hide */ @SystemApi(client = SystemApi.Client.MODULE_LIBRARIES) Loading
services/core/java/com/android/server/media/MediaSessionService.java +2 −2 Original line number Diff line number Diff line Loading @@ -372,8 +372,8 @@ public class MediaSessionService extends SystemService implements Monitor { "onSessionActiveStateChanged:" + " record=" + record + " playbackState=" + playbackState); + " active=" + record.isActive()); reportMediaInteractionEvent(record, isUserEngaged); mHandler.postSessionsChanged(record); } Loading