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

Commit 3e1fc162 authored by Orhan Uysal's avatar Orhan Uysal Committed by Android (Google) Code Review
Browse files

Merge "Fix relaunch of freeform tasks outside desktop" into main

parents 8e35292b 35c6d81f
Loading
Loading
Loading
Loading
+10 −4
Original line number Diff line number Diff line
@@ -983,6 +983,7 @@ class DesktopTasksController(
            ProtoLog.v(WM_SHELL_DESKTOP_MODE, "DesktopTasksController: skip keyguard is locked")
            return null
        }
        val wct = WindowContainerTransaction()
        if (!isDesktopModeShowing(task.displayId)) {
            ProtoLog.d(
                WM_SHELL_DESKTOP_MODE,
@@ -990,12 +991,17 @@ class DesktopTasksController(
                    " taskId=%d",
                task.taskId
            )
            return WindowContainerTransaction().also { wct ->
            // We are outside of desktop mode and already existing desktop task is being launched.
            // We should make this task go to fullscreen instead of freeform. Note that this means
            // any re-launch of a freeform window outside of desktop will be in fullscreen.
            if (desktopModeTaskRepository.isActiveTask(task.taskId)) {
                addMoveToFullscreenChanges(wct, task)
                return wct
            }
            bringDesktopAppsToFrontBeforeShowingNewTask(task.displayId, wct, task.taskId)
            wct.reorder(task.token, true)
            return wct
        }
        }
        val wct = WindowContainerTransaction()
        if (useDesktopOverrideDensity()) {
            wct.setDensityDpi(task.token, DESKTOP_DENSITY_OVERRIDE)
        }
+16 −0
Original line number Diff line number Diff line
@@ -1325,6 +1325,22 @@ class DesktopTasksControllerTest : ShellTestCase() {
    wct!!.assertReorderAt(0, freeformTasks[0], toTop = false) // Reorder to the bottom
  }

  @Test
  fun handleRequest_freeformTask_relaunchActiveTask_taskBecomesUndefined() {
    assumeTrue(ENABLE_SHELL_TRANSITIONS)

    val freeformTask = setUpFreeformTask()
    markTaskHidden(freeformTask)

    val wct =
      controller.handleRequest(Binder(), createTransition(freeformTask))

    // Should become undefined as the TDA is set to fullscreen. It will inherit from the TDA.
    assertNotNull(wct, "should handle request")
    assertThat(wct.changes[freeformTask.token.asBinder()]?.windowingMode)
      .isEqualTo(WINDOWING_MODE_UNDEFINED)
  }

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