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

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

Activate DesktopWallpaper when fullscreen task is forced to be freeform

This CL lets the controller launch the desktop wallpaper when an opening
fullscreen task is forced to be freeform.
Otherwise, we can unexpectedly see the Launcher activity even after the
desktop task is opened.

Bug: 375370653
Bug: 375375114
Flag: EXEMPT bug fix
Test: DesktopTasksControllerTest
Change-Id: I3df6ef1d0ca8d7e1c796adfac52d8e4bab938bec
parent 1bcb8d4c
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -1598,8 +1598,11 @@ class DesktopTasksController(
            return WindowContainerTransaction().also { wct ->
                addMoveToDesktopChanges(wct, task)
                // In some launches home task is moved behind new task being launched. Make sure
                // that's not the case for launches in desktop.
                if (task.baseIntent.flags.and(Intent.FLAG_ACTIVITY_TASK_ON_HOME) != 0) {
                // that's not the case for launches in desktop. Also, if this launch is the first
                // one to trigger the desktop mode (e.g., when [forceEnterDesktop()]), activate the
                // desktop mode here.
                if (task.baseIntent.flags.and(Intent.FLAG_ACTIVITY_TASK_ON_HOME) != 0
                    || !isDesktopModeShowing(task.displayId)) {
                    bringDesktopAppsToFrontBeforeShowingNewTask(task.displayId, wct, task.taskId)
                    wct.reorder(task.token, true)
                }
+8 −2
Original line number Diff line number Diff line
@@ -1951,6 +1951,7 @@ class DesktopTasksControllerTest : ShellTestCase() {
  }

  @Test
  @EnableFlags(Flags.FLAG_ENABLE_DESKTOP_WINDOWING_WALLPAPER_ACTIVITY)
  fun handleRequest_fullscreenTask_noTasks_enforceDesktop_freeformDisplay_returnFreeformWCT() {
    whenever(DesktopModeStatus.enterDesktopByDefaultOnFreeformDisplay(context)).thenReturn(true)
    val tda = rootTaskDisplayAreaOrganizer.getDisplayAreaInfo(DEFAULT_DISPLAY)!!
@@ -1962,8 +1963,13 @@ class DesktopTasksControllerTest : ShellTestCase() {
    assertNotNull(wct, "should handle request")
    assertThat(wct.changes[fullscreenTask.token.asBinder()]?.windowingMode)
        .isEqualTo(WINDOWING_MODE_UNDEFINED)
    assertThat(wct.hierarchyOps).hasSize(1)
    wct.assertReorderAt(0, fullscreenTask, toTop = true)
    assertThat(wct.hierarchyOps).hasSize(3)
    // There are 3 hops that are happening in this case:
    // 1. Moving the fullscreen task to top as we add moveToDesktop() changes
    // 2. Pending intent for the wallpaper
    // 3. Bringing the fullscreen task back at the top
    wct.assertPendingIntentAt(1, desktopWallpaperIntent)
    wct.assertReorderAt(2, fullscreenTask, toTop = true)
  }

  @Test