Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6ae1c784 authored by Alex Shabalin's avatar Alex Shabalin
Browse files

Remove the special logic for the `device.hasSubtext()` condition.

- `device.hasSubtext()`` should affect only the subtitle rendering,
nothing more.
- Fixes "Expandable and with subtext (subtext breaks stream expansion)"
scenario from b/355062931.

Flag: EXEMPT bugfix
Bug: 355062931
Fix: 355062931
Test: atest SystemUiRoboTests:MediaOutputAdapterTest
    atest SystemUIGoogleRoboRNGTests:MediaOutputAdapterScreenshotTest
Change-Id: I7f074194fa5a09817322ced5a1b2c0ea28e05e29
parent a162ceb4
Loading
Loading
Loading
Loading
+33 −44
Original line number Diff line number Diff line
@@ -224,24 +224,12 @@ public class MediaOutputAdapter extends MediaOutputBaseAdapter {
                    } else {
                        isDeviceGroup = true;
                    }
                } else if (device.hasSubtext()) {
                    subtitle = device.getSubtextString();
                    boolean isActiveWithOngoingSession =
                            device.hasOngoingSession() && (currentlyConnected || isSelected);
                    if (isActiveWithOngoingSession) {
                        ongoingSessionStatus = new OngoingSessionStatus(
                                device.isHostForOngoingSession());
                        connectionState = ConnectionState.CONNECTED;
                } else {
                        if (currentlyConnected) {
                            connectionState = ConnectionState.CONNECTED;
                        }
                        clickListener = getClickListenerBasedOnSelectionBehavior(device);
                        deviceDisabled = clickListener == null;
                        deviceStatusIcon = getDeviceStatusIcon(device, device.hasOngoingSession());
                    }
                } else if (device.getState() == MediaDeviceState.STATE_CONNECTING_FAILED) {
                    deviceStatusIcon = mContext.getDrawable(R.drawable.media_output_status_failed);
                    subtitle = device.hasSubtext() ? device.getSubtextString() : null;

                    if (device.getState() == MediaDeviceState.STATE_CONNECTING_FAILED) {
                        deviceStatusIcon = mContext.getDrawable(
                                R.drawable.media_output_status_failed);
                        subtitle = mContext.getString(R.string.media_output_dialog_connect_failed);
                        clickListener = v -> onItemClick(v, device);
                    } else if (currentlyConnected || isSelected) {
@@ -254,8 +242,7 @@ public class MediaOutputAdapter extends MediaOutputBaseAdapter {
                        if (hasMultipleSelectedDevices() || hasSelectableDevices()) {
                            //If device is connected and there's other selectable devices, layout as
                            // one of selected devices.
                        groupStatus = new GroupStatus(
                                true /* selected */,
                            groupStatus = new GroupStatus(true /* selected */,
                                    isDeselectable /* isDeselectable */);
                        }
                    } else { // disconnected
@@ -268,12 +255,14 @@ public class MediaOutputAdapter extends MediaOutputBaseAdapter {
                                clickListener = v -> onItemClick(v, device);
                            }
                        } else {
                        deviceStatusIcon = getDeviceStatusIcon(device, device.hasOngoingSession());
                            deviceStatusIcon = getDeviceStatusIcon(device,
                                    device.hasOngoingSession());
                            clickListener = getClickListenerBasedOnSelectionBehavior(device);
                        }
                        deviceDisabled = clickListener == null;
                    }
                }
            }

            if (connectionState == ConnectionState.CONNECTED || isDeviceGroup) {
                mCurrentActivePosition = position;