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

Commit 029af8ee authored by Pierre Barbier de Reuille's avatar Pierre Barbier de Reuille
Browse files

Only show Desktop Wallpaper for the default display.

We should show the Desktop Wallpaper only if there is a freeform window
on the default display, as this is where the wallpaper will be shown
currently.

Bug: 352316177
Flag: EXEMPT bug fix
Test: atest DesktopTasksControllerTest
Change-Id: I04d5be168fef3bdf6e35fdf13af0499f9277af04
parent 9f24ca4e
Loading
Loading
Loading
Loading
+9 −6
Original line number Diff line number Diff line
@@ -776,6 +776,8 @@ class DesktopTasksController(
            newTaskIdInFront ?: "null"
        )

        // Currently, we only handle the desktop on the default display really.
        if (displayId == DEFAULT_DISPLAY) {
            if (Flags.enableDesktopWindowingWallpaperActivity()) {
                // Add translucent wallpaper activity to show the wallpaper underneath
                addWallpaperActivity(wct)
@@ -783,6 +785,7 @@ class DesktopTasksController(
                // Move home to front
                moveHomeTask(wct, toTop = true)
            }
        }

        val nonMinimizedTasksOrderedFrontToBack =
            desktopModeTaskRepository.getActiveNonMinimizedTasksOrderedFrontToBack(displayId)
+33 −0
Original line number Diff line number Diff line
@@ -310,6 +310,23 @@ class DesktopTasksControllerTest : ShellTestCase() {
    wct.assertReorderAt(index = 2, task2)
  }

  @Test
  @EnableFlags(Flags.FLAG_ENABLE_DESKTOP_WINDOWING_WALLPAPER_ACTIVITY)
  fun showDesktopApps_onSecondaryDisplay_desktopWallpaperEnabled_shouldNotShowWallpaper() {
    val task1 = setUpFreeformTask(SECOND_DISPLAY)
    val task2 = setUpFreeformTask(SECOND_DISPLAY)
    markTaskHidden(task1)
    markTaskHidden(task2)

    controller.showDesktopApps(SECOND_DISPLAY, RemoteTransition(TestRemoteTransition()))

    val wct = getLatestWct(type = TRANSIT_TO_FRONT, handlerClass = OneShotRemoteHandler::class.java)
    assertThat(wct.hierarchyOps).hasSize(2)
    // Expect order to be from bottom: task1, task2 (no wallpaper intent)
    wct.assertReorderAt(index = 0, task1)
    wct.assertReorderAt(index = 1, task2)
  }

  @Test
  @DisableFlags(Flags.FLAG_ENABLE_DESKTOP_WINDOWING_WALLPAPER_ACTIVITY)
  fun showDesktopApps_appsAlreadyVisible_bringsToFront_desktopWallpaperDisabled() {
@@ -329,6 +346,22 @@ class DesktopTasksControllerTest : ShellTestCase() {
    wct.assertReorderAt(index = 2, task2)
  }

  @Test
  @DisableFlags(Flags.FLAG_ENABLE_DESKTOP_WINDOWING_WALLPAPER_ACTIVITY)
  fun showDesktopApps_onSecondaryDisplay_desktopWallpaperDisabled_shouldNotMoveLauncher() {
    val task1 = setUpFreeformTask(SECOND_DISPLAY)
    val task2 = setUpFreeformTask(SECOND_DISPLAY)
    markTaskHidden(task1)
    markTaskHidden(task2)

    controller.showDesktopApps(SECOND_DISPLAY, RemoteTransition(TestRemoteTransition()))

    val wct = getLatestWct(type = TRANSIT_TO_FRONT, handlerClass = OneShotRemoteHandler::class.java)
    assertThat(wct.hierarchyOps).hasSize(2)
    wct.assertReorderAt(index = 0, task1)
    wct.assertReorderAt(index = 1, task2)
  }

  @Test
  @EnableFlags(Flags.FLAG_ENABLE_DESKTOP_WINDOWING_WALLPAPER_ACTIVITY)
  fun showDesktopApps_appsAlreadyVisible_bringsToFront_desktopWallpaperEnabled() {