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

Commit 350abb50 authored by Ajinkya Chalke's avatar Ajinkya Chalke
Browse files

Reorder fullscreen task to top in moveToFullscreen

- Even in desktop first environments we want to reorder the top task
  we're moving to in fullscreen to top. Otherwise we cannot switch to
  existing fullscreen tasks that are not at the top while currently in
  desktop session.

Flag: com.android.launcher3.enable_alt_tab_kqs_flatenning
Bug: 382769617
Test: manually run CUJ
Change-Id: If85d955159f346c9210f457f7efe90435f3652de
parent d6941c1e
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -3037,6 +3037,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
@@ -2373,6 +2373,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() {