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

Commit ec099097 authored by Orhan Uysal's avatar Orhan Uysal
Browse files

Fix some tests that are failing with wallpaper

...activtiy on system user.

Bug: 385294350
Test: atest DesktopTasksControllerTest
Flag: com.android.window.flags.enable_desktop_wallpaper_activity_for_system_user
Change-Id: I1d94a3be01cb603500d3dad5c1e0baae534c2e4c
parent b6a6e286
Loading
Loading
Loading
Loading
+28 −1
Original line number Diff line number Diff line
@@ -1799,9 +1799,36 @@ class DesktopTasksControllerTest : ShellTestCase() {
        assertThat(taskChange.toTop).isTrue()
    }

    @Test
    @EnableFlags(
        FLAG_ENABLE_PER_DISPLAY_DESKTOP_WALLPAPER_ACTIVITY,
        Flags.FLAG_ENABLE_DESKTOP_WALLPAPER_ACTIVITY_FOR_SYSTEM_USER,
    )
    fun moveToNextDisplay_wallpaperOnSystemUser_reorderWallpaperToBack() {
        // Set up two display ids
        whenever(rootTaskDisplayAreaOrganizer.displayIds)
            .thenReturn(intArrayOf(DEFAULT_DISPLAY, SECOND_DISPLAY))
        // Create a mock for the target display area: second display
        val secondDisplayArea = DisplayAreaInfo(MockToken().token(), SECOND_DISPLAY, 0)
        whenever(rootTaskDisplayAreaOrganizer.getDisplayAreaInfo(SECOND_DISPLAY))
            .thenReturn(secondDisplayArea)
        // Add a task and a wallpaper
        val task = setUpFreeformTask(displayId = DEFAULT_DISPLAY)

        controller.moveToNextDisplay(task.taskId)

        with(getLatestWct(type = TRANSIT_CHANGE)) {
            val wallpaperChange =
                hierarchyOps.find { op -> op.container == wallpaperToken.asBinder() }
            assertNotNull(wallpaperChange)
            assertThat(wallpaperChange.type).isEqualTo(HIERARCHY_OP_TYPE_REORDER)
        }
    }

    @Test
    @EnableFlags(FLAG_ENABLE_PER_DISPLAY_DESKTOP_WALLPAPER_ACTIVITY)
    fun moveToNextDisplay_removeWallpaper() {
    @DisableFlags(Flags.FLAG_ENABLE_DESKTOP_WALLPAPER_ACTIVITY_FOR_SYSTEM_USER)
    fun moveToNextDisplay_wallpaperNotOnSystemUser_removeWallpaper() {
        // Set up two display ids
        whenever(rootTaskDisplayAreaOrganizer.displayIds)
            .thenReturn(intArrayOf(DEFAULT_DISPLAY, SECOND_DISPLAY))