diff options
| author | 2025-02-10 18:02:34 -0800 | |
|---|---|---|
| committer | 2025-02-10 21:04:51 -0800 | |
| commit | 0c304bd6910af695882b6bac0712596b2731c897 (patch) | |
| tree | 2c06df28be84484f9a3954f3b6f0523807952026 | |
| parent | c3f7457302f5a38463647245ab271e58f21e60af (diff) | |
Set mCurrentActivePosition in one place.
mCurrentActivePosition meant to prevent rerendering the whole device
list when only one route has changed. Unfortunately, it doesn't work
properly when there are more than one active devices e.g. group
playback.
Flag: EXEMPT refactor
Bug: 387570618
Test: atest SystemUiRoboTests:MediaOutputAdapterTest
Change-Id: Ia4a0eeb47aa04e0ec1667c060849282da91214d0
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputAdapter.java | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputAdapter.java b/packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputAdapter.java index 272d258456f9..7eee985be18e 100644 --- a/packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputAdapter.java +++ b/packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputAdapter.java @@ -209,7 +209,6 @@ public class MediaOutputAdapter extends MediaOutputBaseAdapter { && !mController.isCurrentConnectedDeviceRemote()) { connectionState = ConnectionState.CONNECTED; restrictVolumeAdjustment = true; - mCurrentActivePosition = position; clickListener = v -> onItemClick(v, device); } else if (currentlyConnected && isMutingExpectedDeviceExist && !mController.isCurrentConnectedDeviceRemote()) { @@ -231,13 +230,11 @@ public class MediaOutputAdapter extends MediaOutputBaseAdapter { boolean isActiveWithOngoingSession = device.hasOngoingSession() && (currentlyConnected || isSelected); if (isActiveWithOngoingSession) { - mCurrentActivePosition = position; ongoingSessionStatus = new OngoingSessionStatus( device.isHostForOngoingSession()); connectionState = ConnectionState.CONNECTED; } else { if (currentlyConnected) { - mCurrentActivePosition = position; connectionState = ConnectionState.CONNECTED; } clickListener = getClickListenerBasedOnSelectionBehavior(device); @@ -258,7 +255,6 @@ public class MediaOutputAdapter extends MediaOutputBaseAdapter { connectionState = ConnectionState.CONNECTED; // single selected device if (device.hasOngoingSession()) { - mCurrentActivePosition = position; ongoingSessionStatus = new OngoingSessionStatus( device.isHostForOngoingSession()); } else if (mController.isCurrentConnectedDeviceRemote() @@ -268,8 +264,6 @@ public class MediaOutputAdapter extends MediaOutputBaseAdapter { groupStatus = new GroupStatus( true /* selected */, isDeselectable /* isDeselectable */); - } else { - mCurrentActivePosition = position; } } else if (isSelectable) { //groupable device @@ -287,6 +281,10 @@ public class MediaOutputAdapter extends MediaOutputBaseAdapter { } } + if (connectionState == ConnectionState.CONNECTED || isDeviceGroup) { + mCurrentActivePosition = position; + } + if (isDeviceGroup) { String sessionName = mController.getSessionName() == null ? "" : mController.getSessionName().toString(); |