Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 73e783d4 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Improve MediaSession isActive documentation" into main

parents 0f5e5439 6e2e7801
Loading
Loading
Loading
Loading
+11 −5
Original line number Diff line number Diff line
@@ -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()}
@@ -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.
     */
@@ -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() {
+3 −3
Original line number Diff line number Diff line
@@ -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>
@@ -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) {
@@ -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)
+2 −2
Original line number Diff line number Diff line
@@ -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);
        }