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

Commit 6089f5f4 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Reorder fullscreen task to top in moveToFullscreen" into main

parents a1c8a80a 350abb50
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -3085,6 +3085,10 @@ class DesktopTasksController(
        }
        if (DesktopExperienceFlags.ENABLE_MULTIPLE_DESKTOPS_BACKEND.isTrue) {
            wct.reparent(taskInfo.token, tdaInfo.token, /* onTop= */ true)
        } else if (com.android.launcher3.Flags.enableAltTabKqsFlatenning()) {
            // Until multiple desktops is enabled, we still want to reorder the task to top so that
            // if the task is not on top we can still switch to it using Alt+Tab.
            wct.reorder(taskInfo.token, /* onTop= */ true)
        }

        val deskId =
+31 −0
Original line number Diff line number Diff line
@@ -2510,6 +2510,37 @@ class DesktopTasksControllerTest(flags: FlagsParameterization) : ShellTestCase()
            )
    }

    @Test
    @EnableFlags(com.android.launcher3.Flags.FLAG_ENABLE_ALT_TAB_KQS_FLATENNING)
    @DisableFlags(Flags.FLAG_ENABLE_MULTIPLE_DESKTOPS_BACKEND)
    fun moveToFullscreen_enforceDesktopWithMultipleDesktopDisabled_taskReorderToTop() {
        desktopState.enterDesktopByDefaultOnFreeformDisplay = true
        val transitionHandlerArgCaptor = argumentCaptor<TransitionHandler>()
        whenever(transitions.startTransition(anyInt(), any(), transitionHandlerArgCaptor.capture()))
            .thenReturn(Binder())

        val task = setUpFullscreenTask()
        assertNotNull(rootTaskDisplayAreaOrganizer.getDisplayAreaInfo(DEFAULT_DISPLAY))
            .configuration
            .windowConfiguration
            .windowingMode = WINDOWING_MODE_FREEFORM

        controller.moveToFullscreen(
            task.taskId,
            transitionSource = UNKNOWN,
            remoteTransition = RemoteTransition(spy(TestRemoteTransition())),
        )

        val wct =
            getLatestWct(type = TRANSIT_TO_FRONT, handlerClass = OneShotRemoteHandler::class.java)
        assertThat(wct.changes[task.token.asBinder()]?.windowingMode)
            .isEqualTo(WINDOWING_MODE_FULLSCREEN)
        wct.assertReorderAt(index = 0, task)
        verify(desktopModeEnterExitTransitionListener, never())
            .onEnterDesktopModeTransitionStarted(anyInt())
        assertIs<OneShotRemoteHandler>(transitionHandlerArgCaptor.firstValue)
    }

    @Test
    @EnableFlags(com.android.launcher3.Flags.FLAG_ENABLE_ALT_TAB_KQS_FLATENNING)
    fun moveToFullscreen_fullscreenTaskWithRemoteTransition_transitToFrontUsesRemoteTransition() {