mirror of
https://github.com/samsonjs/media.git
synced 2026-04-18 13:25:47 +00:00
Check whether a session is still managed before removing
When the controller of the `MediaNotificationManager` is disconnected,
the session is removed from the service without checking whether the
session hasn't already been removed. This caused flakiness in `MediaSessionServiceTest.addSession()`.
Because there is a public API `MediaSessionService.removeSession()`,
the controller can't make an assumption whether the session is still
contained in the service when being disconnected.
#minor-release
PiperOrigin-RevId: 572568350
(cherry picked from commit 7fdc5b22ba)
This commit is contained in:
parent
ec21b9e634
commit
0255f3be16
1 changed files with 3 additions and 1 deletions
|
|
@ -392,7 +392,9 @@ import java.util.concurrent.TimeoutException;
|
|||
|
||||
@Override
|
||||
public void onDisconnected(MediaController controller) {
|
||||
mediaSessionService.removeSession(session);
|
||||
if (mediaSessionService.isSessionAdded(session)) {
|
||||
mediaSessionService.removeSession(session);
|
||||
}
|
||||
// We may need to hide the notification.
|
||||
mediaSessionService.onUpdateNotificationInternal(
|
||||
session, /* startInForegroundWhenPaused= */ false);
|
||||
|
|
|
|||
Loading…
Reference in a new issue