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

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

Merge "Only show Desktop Wallpaper for the default display." into main

parents fd15e141 029af8ee
Loading
Loading
Loading
Loading
+9 −6
Original line number Diff line number Diff line
@@ -764,6 +764,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)
@@ -771,6 +773,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() {