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

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

Merge "Ensure incompatible tasks to be fullscreen" into main

parents a307e5be be661e07
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -2090,7 +2090,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() {