Skip to content

Commit 5293d6a

Browse files
committed
Make miscellaneous style changes in preparation for internal review
1 parent 4d5a6fe commit 5293d6a

File tree

2 files changed

+12
-15
lines changed

2 files changed

+12
-15
lines changed

RELEASENOTES.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,8 +229,7 @@ This release includes the following changes since [1.6.1](#161-2025-04-14):
229229
([#2357](https://github.com/androidx/media/issues/2357)).
230230
* Cast extension:
231231
* Add support for `getDeviceVolume()`, `setDeviceVolume()`,
232-
`increaseDeviceVolume()`, `decreaseDeviceVolume()`,
233-
`isDeviceMuted()`, and `setDeviceMuted()`
232+
`getDeviceMuted()`, and `setDeviceMuted()`
234233
([#2089](https://github.com/androidx/media/issues/2089)).
235234
* Test Utilities:
236235
* Removed `transformer.TestUtil.addAudioDecoders(String...)`,

libraries/cast/src/main/java/androidx/media3/cast/CastPlayer.java

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -990,7 +990,7 @@ private void updateInternalStateAndNotifyIfChanged() {
990990
? getCurrentTimeline().getPeriod(oldWindowIndex, period, /* setIds= */ true).uid
991991
: null;
992992
updatePlayerStateAndNotifyIfChanged(/* resultCallback= */ null);
993-
updateVolumeAndNotifyIfChanged();
993+
updateDeviceVolumeAndNotifyIfChanged();
994994
updateRepeatModeAndNotifyIfChanged(/* resultCallback= */ null);
995995
updateVolumeAndNotifyIfChanged(/* resultCallback= */ null);
996996
updatePlaybackRateAndNotifyIfChanged(/* resultCallback= */ null);
@@ -1101,21 +1101,13 @@ private void updatePlaybackRateAndNotifyIfChanged(@Nullable ResultCallback<?> re
11011101
}
11021102

11031103
@RequiresNonNull("castSession")
1104-
private void updateVolumeAndNotifyIfChanged() {
1104+
private void updateDeviceVolumeAndNotifyIfChanged() {
11051105
if (castSession != null) {
11061106
int deviceVolume = VOLUME_RANGE.clamp((int) Math.round(castSession.getVolume() * MAX_VOLUME));
11071107
setDeviceVolumeAndNotifyIfChanged(deviceVolume, castSession.isMute());
11081108
}
11091109
}
11101110

1111-
@RequiresNonNull("remoteMediaClient")
1112-
private void updateRepeatModeAndNotifyIfChanged(@Nullable ResultCallback<?> resultCallback) {
1113-
if (repeatMode.acceptsUpdate(resultCallback)) {
1114-
setRepeatModeAndNotifyIfChanged(fetchRepeatMode(remoteMediaClient));
1115-
repeatMode.clearPendingResultCallback();
1116-
}
1117-
}
1118-
11191111
@RequiresNonNull("remoteMediaClient")
11201112
private void updateVolumeAndNotifyIfChanged(@Nullable ResultCallback<?> resultCallback) {
11211113
if (volume.acceptsUpdate(resultCallback)) {
@@ -1124,6 +1116,14 @@ private void updateVolumeAndNotifyIfChanged(@Nullable ResultCallback<?> resultCa
11241116
}
11251117
}
11261118

1119+
@RequiresNonNull("remoteMediaClient")
1120+
private void updateRepeatModeAndNotifyIfChanged(@Nullable ResultCallback<?> resultCallback) {
1121+
if (repeatMode.acceptsUpdate(resultCallback)) {
1122+
setRepeatModeAndNotifyIfChanged(fetchRepeatMode(remoteMediaClient));
1123+
repeatMode.clearPendingResultCallback();
1124+
}
1125+
}
1126+
11271127
/**
11281128
* Updates the timeline and notifies {@link Player.Listener event listeners} if required.
11291129
*
@@ -1527,7 +1527,6 @@ private static int fetchPlaybackState(RemoteMediaClient remoteMediaClient) {
15271527
private static float fetchVolume(RemoteMediaClient remoteMediaClient) {
15281528
MediaStatus mediaStatus = remoteMediaClient.getMediaStatus();
15291529
if (mediaStatus == null) {
1530-
// No media session active, yet.
15311530
return 1f;
15321531
}
15331532
return (float) mediaStatus.getStreamVolume();
@@ -1797,7 +1796,6 @@ public DeviceInfo fetchDeviceInfo() {
17971796
// There's only one remote routing controller. It's safe to assume it's the Cast routing
17981797
// controller.
17991798
RoutingController remoteController = controllers.get(1);
1800-
// TODO b/364580007 - Populate min volume information.
18011799
return new DeviceInfo.Builder(DeviceInfo.PLAYBACK_TYPE_REMOTE)
18021800
.setMaxVolume(MAX_VOLUME)
18031801
.setRoutingControllerId(remoteController.getId())
@@ -1836,7 +1834,7 @@ private final class CastListener extends Cast.Listener {
18361834

18371835
@Override
18381836
public void onVolumeChanged() {
1839-
updateVolumeAndNotifyIfChanged();
1837+
updateDeviceVolumeAndNotifyIfChanged();
18401838
listeners.flushEvents();
18411839
}
18421840
}

0 commit comments

Comments
 (0)