From f3dd36107670785814198f74e040f50e5320cbfc Mon Sep 17 00:00:00 2001 From: bachinger Date: Fri, 13 May 2022 11:28:32 +0100 Subject: [PATCH] Improve JavaDoc of MediaSession.release Specifically mention that releasing the session does not release the player and the app needs to take care to release the player. Issue: androidx/media#73 PiperOrigin-RevId: 448454338 --- .../java/androidx/media3/session/MediaSession.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/libraries/session/src/main/java/androidx/media3/session/MediaSession.java b/libraries/session/src/main/java/androidx/media3/session/MediaSession.java index 9dac8c175e..a01abb9770 100644 --- a/libraries/session/src/main/java/androidx/media3/session/MediaSession.java +++ b/libraries/session/src/main/java/androidx/media3/session/MediaSession.java @@ -516,7 +516,7 @@ public class MediaSession { } /** - * Sets the underlying {@link Player} for this session to dispatch incoming event to. + * Sets the underlying {@link Player} for this session to dispatch incoming events to. * * @param player A player that handles actual media playback in your app. * @throws IllegalArgumentException if the new player's application looper differs from the @@ -532,7 +532,16 @@ public class MediaSession { impl.setPlayer(player); } - /** Releases the session. */ + /** + * Releases the session and disconnects all connected controllers. + * + *

The session must not be used after calling this method. + * + *

Releasing the session removes the session's listeners from the player but does not + * {@linkplain Player#stop() stop} or {@linkplain Player#release() release} the player. An app can + * further use the player after the session is released and needs to make sure to eventually + * release the player. + */ public void release() { try { synchronized (STATIC_LOCK) {