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

Commit b9bf2111 authored by Toshiki Kikuchi's avatar Toshiki Kikuchi
Browse files

Update display windowing mode when default display is added

This CL ensures that the display windowing mode of the default display
is updated when it’s added (i.e., right after SysUI’s initialization).
Otherwise, it’s never updated if any external display or input device is
connected to the device. Note that this is usually fine because the
display windowing mode remains the same throughout the user journey
without external displays or input devices, but in some edge cases
(e.g., SysUI crash followed by display disconnection, or
FORCE_DESKTOP_FIRST_ON_DEFAULT_DISPLAY debug flag) it can be an issue.

Flag: com.android.window.flags.enable_display_windowing_mode_switching
Fix: 431975631
Fix: 432592973
Fix: 438605732
Test: DesktopDisplayEventHandlerTest
Change-Id: Ie99e2d3594e5028cb12470071d0d4da006e78f9f
parent f4412566
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -114,10 +114,11 @@ class DesktopDisplayEventHandler(
            }
            if (displayId != DEFAULT_DISPLAY) {
                desktopDisplayModeController.updateExternalDisplayWindowingMode(displayId)
            }
            // The default display's windowing mode depends on the availability of the external
                // display. So updating the default display's windowing mode here.
            // display. So updating the default display's windowing mode regardless of the type of
            // `displayId`.
            desktopDisplayModeController.updateDefaultDisplayWindowingMode()
            }
            if (DesktopExperienceFlags.ENABLE_DISPLAY_RECONNECT_INTERACTION.isTrue) {
                // TODO - b/365873835: Restore a display if a uniqueId match is found in
                //  the desktop repository.
+7 −0
Original line number Diff line number Diff line
@@ -412,6 +412,13 @@ class DesktopDisplayEventHandlerTest : ShellTestCase() {
                )
        }

    @Test
    fun testConnectDefaultDisplay() {
        onDisplaysChangedListenerCaptor.lastValue.onDisplayAdded(DEFAULT_DISPLAY)
        verify(mockDesktopDisplayModeController, never()).updateExternalDisplayWindowingMode(any())
        verify(mockDesktopDisplayModeController).updateDefaultDisplayWindowingMode()
    }

    @Test
    fun testConnectExternalDisplay() {
        onDisplaysChangedListenerCaptor.lastValue.onDisplayAdded(externalDisplayId)