Commit accb31e4 by olly Committed by Oliver Woodman

Reset MediaSession shuffle/repeat modes if player is null

- This is for consistency with PlayerControlView.

- Also update PlayerNotificationManager notification if shuffle
  mode changes. This is for consistency with what happens when
  the repeat mode changes. By default the notification will be
  unchanged, but custom implementations can extend and then
  override createNotification, and given these modes change
  infrequently it feels like we can just do this. The alternative
  for achieving consistency would be to remove handling of repeat
  mode changes.

Issue: #6582
PiperOrigin-RevId: 277925094
parent cc94ae7b
...@@ -700,6 +700,9 @@ public final class MediaSessionConnector { ...@@ -700,6 +700,9 @@ public final class MediaSessionConnector {
/* position= */ 0, /* position= */ 0,
/* playbackSpeed= */ 0, /* playbackSpeed= */ 0,
/* updateTime= */ SystemClock.elapsedRealtime()); /* updateTime= */ SystemClock.elapsedRealtime());
mediaSession.setRepeatMode(PlaybackStateCompat.REPEAT_MODE_NONE);
mediaSession.setShuffleMode(PlaybackStateCompat.SHUFFLE_MODE_NONE);
mediaSession.setPlaybackState(builder.build()); mediaSession.setPlaybackState(builder.build());
return; return;
} }
......
...@@ -1348,7 +1348,12 @@ public class PlayerNotificationManager { ...@@ -1348,7 +1348,12 @@ public class PlayerNotificationManager {
} }
@Override @Override
public void onRepeatModeChanged(int repeatMode) { public void onRepeatModeChanged(@Player.RepeatMode int repeatMode) {
startOrUpdateNotification();
}
@Override
public void onShuffleModeEnabledChanged(boolean shuffleModeEnabled) {
startOrUpdateNotification(); startOrUpdateNotification();
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment