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
This commit is contained in:
parent
4ce60968b2
commit
f3dd361076
@ -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.
|
* @param player A player that handles actual media playback in your app.
|
||||||
* @throws IllegalArgumentException if the new player's application looper differs from the
|
* @throws IllegalArgumentException if the new player's application looper differs from the
|
||||||
@ -532,7 +532,16 @@ public class MediaSession {
|
|||||||
impl.setPlayer(player);
|
impl.setPlayer(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Releases the session. */
|
/**
|
||||||
|
* Releases the session and disconnects all connected controllers.
|
||||||
|
*
|
||||||
|
* <p>The session must not be used after calling this method.
|
||||||
|
*
|
||||||
|
* <p>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() {
|
public void release() {
|
||||||
try {
|
try {
|
||||||
synchronized (STATIC_LOCK) {
|
synchronized (STATIC_LOCK) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user