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

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

Ensure incompatible tasks to be fullscreen

This CL ensures that a desktop-incompatible task is launched in
fullscreen when the display windowing mode is freeform.

Bug: 383769681
Flag: EXEMPT bug fix
Test: DesktopTasksControllerTest
Change-Id: I3b167d6bad21959c75141196dd773ba3d6f56449
parent 4d0fb74a
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -2093,7 +2093,7 @@ class DesktopTasksController(
     */
    private fun handleIncompatibleTaskLaunch(task: RunningTaskInfo): WindowContainerTransaction? {
        logV("handleIncompatibleTaskLaunch")
        if (!isDesktopModeShowing(task.displayId)) return null
        if (!isDesktopModeShowing(task.displayId) && !forceEnterDesktop(task.displayId)) return null
        // Only update task repository for transparent task.
        if (
            DesktopModeFlags.INCLUDE_TOP_TRANSPARENT_FULLSCREEN_TASK_IN_DESKTOP_HEURISTIC
+21 −0
Original line number Diff line number Diff line
@@ -3018,6 +3018,27 @@ class DesktopTasksControllerTest(flags: FlagsParameterization) : ShellTestCase()
            .isEqualTo(WINDOWING_MODE_FREEFORM)
    }

    @Test
    fun handleRequest_systemUIActivityWithDisplay_returnSwitchToFullscreenWCT_enforcedDesktop() {
        whenever(DesktopModeStatus.enterDesktopByDefaultOnFreeformDisplay(context)).thenReturn(true)
        val tda = rootTaskDisplayAreaOrganizer.getDisplayAreaInfo(DEFAULT_DISPLAY)!!
        tda.configuration.windowConfiguration.windowingMode = WINDOWING_MODE_FREEFORM
        // Set task as systemUI package
        val systemUIPackageName =
            context.resources.getString(com.android.internal.R.string.config_systemUi)
        val baseComponent = ComponentName(systemUIPackageName, /* cls= */ "")
        val task =
            createFreeformTask().apply {
                baseActivity = baseComponent
                isTopActivityNoDisplay = false
            }

        assertThat(controller.isDesktopModeShowing(DEFAULT_DISPLAY)).isFalse()
        val result = controller.handleRequest(Binder(), createTransition(task))
        assertThat(result?.changes?.get(task.token.asBinder())?.windowingMode)
            .isEqualTo(WINDOWING_MODE_FULLSCREEN)
    }

    @Test
    @DisableFlags(Flags.FLAG_ENABLE_DESKTOP_WINDOWING_WALLPAPER_ACTIVITY)
    fun handleRequest_backTransition_singleTaskNoToken_noWallpaper_doesNotHandle() {