summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libs/WindowManager/Shell/AndroidManifest.xml1
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopMixedTransitionHandler.kt2
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopTasksController.kt71
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopTasksTransitionObserver.kt20
-rw-r--r--libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/desktopmode/DesktopTasksControllerTest.kt83
-rw-r--r--libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/desktopmode/DesktopTasksTransitionObserverTest.kt16
6 files changed, 139 insertions, 54 deletions
diff --git a/libs/WindowManager/Shell/AndroidManifest.xml b/libs/WindowManager/Shell/AndroidManifest.xml
index 636e3cfd571d..b2ac640a468d 100644
--- a/libs/WindowManager/Shell/AndroidManifest.xml
+++ b/libs/WindowManager/Shell/AndroidManifest.xml
@@ -32,6 +32,7 @@
android:name=".desktopmode.DesktopWallpaperActivity"
android:excludeFromRecents="true"
android:launchMode="singleInstance"
+ android:showForAllUsers="true"
android:theme="@style/DesktopWallpaperTheme" />
<activity
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopMixedTransitionHandler.kt b/libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopMixedTransitionHandler.kt
index d404634b0db0..996d71c043c2 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopMixedTransitionHandler.kt
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopMixedTransitionHandler.kt
@@ -426,7 +426,7 @@ class DesktopMixedTransitionHandler(
private fun isWallpaperActivityClosing(info: TransitionInfo) =
info.changes.any { change ->
- change.mode == TRANSIT_CLOSE &&
+ TransitionUtil.isClosingMode(change.mode) &&
change.taskInfo != null &&
DesktopWallpaperActivity.isWallpaperTask(change.taskInfo!!)
}
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopTasksController.kt b/libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopTasksController.kt
index 42adbd6158d3..9f660d2fcbc4 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopTasksController.kt
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopTasksController.kt
@@ -1336,35 +1336,60 @@ class DesktopTasksController(
private fun addWallpaperActivity(displayId: Int, wct: WindowContainerTransaction) {
logV("addWallpaperActivity")
- val userHandle = UserHandle.of(userId)
- val userContext = context.createContextAsUser(userHandle, /* flags= */ 0)
- val intent = Intent(userContext, DesktopWallpaperActivity::class.java)
- intent.putExtra(Intent.EXTRA_USER_HANDLE, userId)
- val options =
- ActivityOptions.makeBasic().apply {
- launchWindowingMode = WINDOWING_MODE_FULLSCREEN
- pendingIntentBackgroundActivityStartMode =
- ActivityOptions.MODE_BACKGROUND_ACTIVITY_START_ALLOW_ALWAYS
- if (Flags.enableBugFixesForSecondaryDisplay()) {
- launchDisplayId = displayId
+ if (Flags.enableDesktopWallpaperActivityOnSystemUser()) {
+ val intent = Intent(context, DesktopWallpaperActivity::class.java)
+ val options =
+ ActivityOptions.makeBasic().apply {
+ launchWindowingMode = WINDOWING_MODE_FULLSCREEN
+ pendingIntentBackgroundActivityStartMode =
+ ActivityOptions.MODE_BACKGROUND_ACTIVITY_START_ALLOW_ALWAYS
+ if (Flags.enableBugFixesForSecondaryDisplay()) {
+ launchDisplayId = displayId
+ }
}
- }
- val pendingIntent =
- PendingIntent.getActivityAsUser(
- userContext,
- /* requestCode= */ 0,
- intent,
- PendingIntent.FLAG_IMMUTABLE,
- /* options= */ null,
- userHandle,
- )
- wct.sendPendingIntent(pendingIntent, intent, options.toBundle())
+ val pendingIntent =
+ PendingIntent.getActivity(
+ context,
+ /* requestCode = */ 0,
+ intent,
+ PendingIntent.FLAG_IMMUTABLE,
+ )
+ wct.sendPendingIntent(pendingIntent, intent, options.toBundle())
+ } else {
+ val userHandle = UserHandle.of(userId)
+ val userContext = context.createContextAsUser(userHandle, /* flags= */ 0)
+ val intent = Intent(userContext, DesktopWallpaperActivity::class.java)
+ intent.putExtra(Intent.EXTRA_USER_HANDLE, userId)
+ val options =
+ ActivityOptions.makeBasic().apply {
+ launchWindowingMode = WINDOWING_MODE_FULLSCREEN
+ pendingIntentBackgroundActivityStartMode =
+ ActivityOptions.MODE_BACKGROUND_ACTIVITY_START_ALLOW_ALWAYS
+ if (Flags.enableBugFixesForSecondaryDisplay()) {
+ launchDisplayId = displayId
+ }
+ }
+ val pendingIntent =
+ PendingIntent.getActivityAsUser(
+ userContext,
+ /* requestCode= */ 0,
+ intent,
+ PendingIntent.FLAG_IMMUTABLE,
+ /* options= */ null,
+ userHandle,
+ )
+ wct.sendPendingIntent(pendingIntent, intent, options.toBundle())
+ }
}
private fun removeWallpaperActivity(wct: WindowContainerTransaction) {
desktopWallpaperActivityTokenProvider.getToken()?.let { token ->
logV("removeWallpaperActivity")
- wct.removeTask(token)
+ if (Flags.enableDesktopWallpaperActivityOnSystemUser()) {
+ wct.reorder(token, /* onTop= */ false)
+ } else {
+ wct.removeTask(token)
+ }
}
}
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopTasksTransitionObserver.kt b/libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopTasksTransitionObserver.kt
index 2bb299cc1fb9..e7a00776360e 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopTasksTransitionObserver.kt
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopTasksTransitionObserver.kt
@@ -29,6 +29,7 @@ import android.window.DesktopModeFlags.ENABLE_DESKTOP_WINDOWING_WALLPAPER_ACTIVI
import android.window.TransitionInfo
import android.window.WindowContainerTransaction
import com.android.internal.protolog.ProtoLog
+import com.android.window.flags.Flags
import com.android.wm.shell.ShellTaskOrganizer
import com.android.wm.shell.back.BackAnimationController
import com.android.wm.shell.desktopmode.DesktopModeTransitionTypes.isExitDesktopModeTransition
@@ -235,11 +236,20 @@ class DesktopTasksTransitionObserver(
if (transitionToCloseWallpaper == transition) {
// TODO: b/362469671 - Handle merging the animation when desktop is also closing.
desktopWallpaperActivityTokenProvider.getToken()?.let { wallpaperActivityToken ->
- transitions.startTransition(
- TRANSIT_CLOSE,
- WindowContainerTransaction().removeTask(wallpaperActivityToken),
- null,
- )
+ if (Flags.enableDesktopWallpaperActivityOnSystemUser()) {
+ transitions.startTransition(
+ TRANSIT_TO_BACK,
+ WindowContainerTransaction()
+ .reorder(wallpaperActivityToken, /* onTop= */ false),
+ null,
+ )
+ } else {
+ transitions.startTransition(
+ TRANSIT_CLOSE,
+ WindowContainerTransaction().removeTask(wallpaperActivityToken),
+ null,
+ )
+ }
}
transitionToCloseWallpaper = null
}
diff --git a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/desktopmode/DesktopTasksControllerTest.kt b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/desktopmode/DesktopTasksControllerTest.kt
index 73da8513d361..7436a1ece5b0 100644
--- a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/desktopmode/DesktopTasksControllerTest.kt
+++ b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/desktopmode/DesktopTasksControllerTest.kt
@@ -1493,6 +1493,7 @@ class DesktopTasksControllerTest : ShellTestCase() {
}
@Test
+ @EnableFlags(Flags.FLAG_ENABLE_DESKTOP_WALLPAPER_ACTIVITY_ON_SYSTEM_USER)
fun moveToFullscreen_tdaFullscreen_windowingModeUndefined_removesWallpaperActivity() {
val task = setUpFreeformTask()
assertNotNull(rootTaskDisplayAreaOrganizer.getDisplayAreaInfo(DEFAULT_DISPLAY))
@@ -1508,7 +1509,7 @@ class DesktopTasksControllerTest : ShellTestCase() {
.onExitDesktopModeTransitionStarted(FULLSCREEN_ANIMATION_DURATION)
assertThat(taskChange.windowingMode).isEqualTo(WINDOWING_MODE_UNDEFINED)
// Removes wallpaper activity when leaving desktop
- wct.assertRemoveAt(index = 0, wallpaperToken)
+ wct.assertReorderAt(index = 0, wallpaperToken, toTop = false)
}
@Test
@@ -1525,6 +1526,7 @@ class DesktopTasksControllerTest : ShellTestCase() {
}
@Test
+ @EnableFlags(Flags.FLAG_ENABLE_DESKTOP_WALLPAPER_ACTIVITY_ON_SYSTEM_USER)
fun moveToFullscreen_tdaFreeform_windowingModeFullscreen_removesWallpaperActivity() {
val task = setUpFreeformTask()
@@ -1541,7 +1543,7 @@ class DesktopTasksControllerTest : ShellTestCase() {
verify(desktopModeEnterExitTransitionListener)
.onExitDesktopModeTransitionStarted(FULLSCREEN_ANIMATION_DURATION)
// Removes wallpaper activity when leaving desktop
- wct.assertRemoveAt(index = 0, wallpaperToken)
+ wct.assertReorderAt(index = 0, wallpaperToken, toTop = false)
}
@Test
@@ -1940,13 +1942,14 @@ class DesktopTasksControllerTest : ShellTestCase() {
}
@Test
+ @EnableFlags(Flags.FLAG_ENABLE_DESKTOP_WALLPAPER_ACTIVITY_ON_SYSTEM_USER)
fun onDesktopWindowClose_singleActiveTask_hasWallpaperActivityToken() {
val task = setUpFreeformTask()
val wct = WindowContainerTransaction()
controller.onDesktopWindowClose(wct, displayId = DEFAULT_DISPLAY, task)
// Adds remove wallpaper operation
- wct.assertRemoveAt(index = 0, wallpaperToken)
+ wct.assertReorderAt(index = 0, wallpaperToken, toTop = false)
}
@Test
@@ -1985,6 +1988,7 @@ class DesktopTasksControllerTest : ShellTestCase() {
}
@Test
+ @EnableFlags(Flags.FLAG_ENABLE_DESKTOP_WALLPAPER_ACTIVITY_ON_SYSTEM_USER)
fun onDesktopWindowClose_multipleActiveTasks_isOnlyNonClosingTask() {
val task1 = setUpFreeformTask()
val task2 = setUpFreeformTask()
@@ -1994,10 +1998,11 @@ class DesktopTasksControllerTest : ShellTestCase() {
val wct = WindowContainerTransaction()
controller.onDesktopWindowClose(wct, displayId = DEFAULT_DISPLAY, task1)
// Adds remove wallpaper operation
- wct.assertRemoveAt(index = 0, wallpaperToken)
+ wct.assertReorderAt(index = 0, wallpaperToken, toTop = false)
}
@Test
+ @EnableFlags(Flags.FLAG_ENABLE_DESKTOP_WALLPAPER_ACTIVITY_ON_SYSTEM_USER)
fun onDesktopWindowClose_multipleActiveTasks_hasMinimized() {
val task1 = setUpFreeformTask()
val task2 = setUpFreeformTask()
@@ -2007,7 +2012,7 @@ class DesktopTasksControllerTest : ShellTestCase() {
val wct = WindowContainerTransaction()
controller.onDesktopWindowClose(wct, displayId = DEFAULT_DISPLAY, task1)
// Adds remove wallpaper operation
- wct.assertRemoveAt(index = 0, wallpaperToken)
+ wct.assertReorderAt(index = 0, wallpaperToken, toTop = false)
}
@Test
@@ -2067,6 +2072,7 @@ class DesktopTasksControllerTest : ShellTestCase() {
}
@Test
+ @EnableFlags(Flags.FLAG_ENABLE_DESKTOP_WALLPAPER_ACTIVITY_ON_SYSTEM_USER)
fun onTaskMinimize_singleActiveTask_hasWallpaperActivityToken_removesWallpaper() {
val task = setUpFreeformTask()
val transition = Binder()
@@ -2079,7 +2085,7 @@ class DesktopTasksControllerTest : ShellTestCase() {
val captor = ArgumentCaptor.forClass(WindowContainerTransaction::class.java)
verify(freeformTaskTransitionStarter).startMinimizedModeTransition(captor.capture())
// Adds remove wallpaper operation
- captor.value.assertRemoveAt(index = 0, wallpaperToken)
+ captor.value.assertReorderAt(index = 0, wallpaperToken, toTop = false)
}
@Test
@@ -2118,6 +2124,7 @@ class DesktopTasksControllerTest : ShellTestCase() {
}
@Test
+ @EnableFlags(Flags.FLAG_ENABLE_DESKTOP_WALLPAPER_ACTIVITY_ON_SYSTEM_USER)
fun onDesktopWindowMinimize_multipleActiveTasks_minimizesTheOnlyVisibleTask_removesWallpaper() {
val task1 = setUpFreeformTask(active = true)
val task2 = setUpFreeformTask(active = true)
@@ -2132,7 +2139,7 @@ class DesktopTasksControllerTest : ShellTestCase() {
val captor = ArgumentCaptor.forClass(WindowContainerTransaction::class.java)
verify(freeformTaskTransitionStarter).startMinimizedModeTransition(captor.capture())
// Adds remove wallpaper operation
- captor.value.assertRemoveAt(index = 0, wallpaperToken)
+ captor.value.assertReorderAt(index = 0, wallpaperToken, toTop = false)
}
@Test
@@ -2776,7 +2783,10 @@ class DesktopTasksControllerTest : ShellTestCase() {
}
@Test
- @EnableFlags(Flags.FLAG_ENABLE_DESKTOP_WINDOWING_WALLPAPER_ACTIVITY)
+ @EnableFlags(
+ Flags.FLAG_ENABLE_DESKTOP_WINDOWING_WALLPAPER_ACTIVITY,
+ Flags.FLAG_ENABLE_DESKTOP_WALLPAPER_ACTIVITY_ON_SYSTEM_USER,
+ )
fun handleRequest_backTransition_singleTaskWithToken_removesWallpaper() {
val task = setUpFreeformTask()
@@ -2784,7 +2794,8 @@ class DesktopTasksControllerTest : ShellTestCase() {
controller.handleRequest(Binder(), createTransition(task, type = TRANSIT_TO_BACK))
// Should create remove wallpaper transaction
- assertNotNull(result, "Should handle request").assertRemoveAt(index = 0, wallpaperToken)
+ assertNotNull(result, "Should handle request")
+ .assertReorderAt(index = 0, wallpaperToken, toTop = false)
}
@Test
@@ -2815,6 +2826,7 @@ class DesktopTasksControllerTest : ShellTestCase() {
@EnableFlags(
Flags.FLAG_ENABLE_DESKTOP_WINDOWING_WALLPAPER_ACTIVITY,
Flags.FLAG_ENABLE_DESKTOP_WINDOWING_BACK_NAVIGATION,
+ Flags.FLAG_ENABLE_DESKTOP_WALLPAPER_ACTIVITY_ON_SYSTEM_USER,
)
fun handleRequest_backTransition_multipleTasksSingleNonClosing_removesWallpaperAndTask() {
val task1 = setUpFreeformTask(displayId = DEFAULT_DISPLAY)
@@ -2825,11 +2837,15 @@ class DesktopTasksControllerTest : ShellTestCase() {
controller.handleRequest(Binder(), createTransition(task1, type = TRANSIT_TO_BACK))
// Should create remove wallpaper transaction
- assertNotNull(result, "Should handle request").assertRemoveAt(index = 0, wallpaperToken)
+ assertNotNull(result, "Should handle request")
+ .assertReorderAt(index = 0, wallpaperToken, toTop = false)
}
@Test
- @EnableFlags(Flags.FLAG_ENABLE_DESKTOP_WINDOWING_WALLPAPER_ACTIVITY)
+ @EnableFlags(
+ Flags.FLAG_ENABLE_DESKTOP_WINDOWING_WALLPAPER_ACTIVITY,
+ Flags.FLAG_ENABLE_DESKTOP_WALLPAPER_ACTIVITY_ON_SYSTEM_USER,
+ )
fun handleRequest_backTransition_multipleTasksSingleNonMinimized_removesWallpaperAndTask() {
val task1 = setUpFreeformTask(displayId = DEFAULT_DISPLAY)
val task2 = setUpFreeformTask(displayId = DEFAULT_DISPLAY)
@@ -2839,7 +2855,8 @@ class DesktopTasksControllerTest : ShellTestCase() {
controller.handleRequest(Binder(), createTransition(task1, type = TRANSIT_TO_BACK))
// Should create remove wallpaper transaction
- assertNotNull(result, "Should handle request").assertRemoveAt(index = 0, wallpaperToken)
+ assertNotNull(result, "Should handle request")
+ .assertReorderAt(index = 0, wallpaperToken, toTop = false)
}
@Test
@@ -2892,7 +2909,10 @@ class DesktopTasksControllerTest : ShellTestCase() {
}
@Test
- @EnableFlags(Flags.FLAG_ENABLE_DESKTOP_WINDOWING_WALLPAPER_ACTIVITY)
+ @EnableFlags(
+ Flags.FLAG_ENABLE_DESKTOP_WINDOWING_WALLPAPER_ACTIVITY,
+ Flags.FLAG_ENABLE_DESKTOP_WALLPAPER_ACTIVITY_ON_SYSTEM_USER,
+ )
fun handleRequest_closeTransition_singleTaskWithToken_withWallpaper_removesWallpaper() {
val task = setUpFreeformTask()
@@ -2900,7 +2920,8 @@ class DesktopTasksControllerTest : ShellTestCase() {
controller.handleRequest(Binder(), createTransition(task, type = TRANSIT_CLOSE))
// Should create remove wallpaper transaction
- assertNotNull(result, "Should handle request").assertRemoveAt(index = 0, wallpaperToken)
+ assertNotNull(result, "Should handle request")
+ .assertReorderAt(index = 0, wallpaperToken, toTop = false)
}
@Test
@@ -2928,7 +2949,10 @@ class DesktopTasksControllerTest : ShellTestCase() {
}
@Test
- @EnableFlags(Flags.FLAG_ENABLE_DESKTOP_WINDOWING_WALLPAPER_ACTIVITY)
+ @EnableFlags(
+ Flags.FLAG_ENABLE_DESKTOP_WINDOWING_WALLPAPER_ACTIVITY,
+ Flags.FLAG_ENABLE_DESKTOP_WALLPAPER_ACTIVITY_ON_SYSTEM_USER,
+ )
fun handleRequest_closeTransition_multipleTasksSingleNonClosing_removesWallpaper() {
val task1 = setUpFreeformTask(displayId = DEFAULT_DISPLAY)
val task2 = setUpFreeformTask(displayId = DEFAULT_DISPLAY)
@@ -2938,11 +2962,15 @@ class DesktopTasksControllerTest : ShellTestCase() {
controller.handleRequest(Binder(), createTransition(task1, type = TRANSIT_CLOSE))
// Should create remove wallpaper transaction
- assertNotNull(result, "Should handle request").assertRemoveAt(index = 0, wallpaperToken)
+ assertNotNull(result, "Should handle request")
+ .assertReorderAt(index = 0, wallpaperToken, toTop = false)
}
@Test
- @EnableFlags(Flags.FLAG_ENABLE_DESKTOP_WINDOWING_WALLPAPER_ACTIVITY)
+ @EnableFlags(
+ Flags.FLAG_ENABLE_DESKTOP_WINDOWING_WALLPAPER_ACTIVITY,
+ Flags.FLAG_ENABLE_DESKTOP_WALLPAPER_ACTIVITY_ON_SYSTEM_USER,
+ )
fun handleRequest_closeTransition_multipleTasksSingleNonMinimized_removesWallpaper() {
val task1 = setUpFreeformTask(displayId = DEFAULT_DISPLAY)
val task2 = setUpFreeformTask(displayId = DEFAULT_DISPLAY)
@@ -2952,7 +2980,8 @@ class DesktopTasksControllerTest : ShellTestCase() {
controller.handleRequest(Binder(), createTransition(task1, type = TRANSIT_CLOSE))
// Should create remove wallpaper transaction
- assertNotNull(result, "Should handle request").assertRemoveAt(index = 0, wallpaperToken)
+ assertNotNull(result, "Should handle request")
+ .assertReorderAt(index = 0, wallpaperToken, toTop = false)
}
@Test
@@ -3032,6 +3061,7 @@ class DesktopTasksControllerTest : ShellTestCase() {
}
@Test
+ @EnableFlags(Flags.FLAG_ENABLE_DESKTOP_WALLPAPER_ACTIVITY_ON_SYSTEM_USER)
fun moveFocusedTaskToFullscreen_onlyVisibleNonMinimizedTask_removesWallpaperActivity() {
val task1 = setUpFreeformTask()
val task2 = setUpFreeformTask()
@@ -3049,7 +3079,7 @@ class DesktopTasksControllerTest : ShellTestCase() {
val taskChange = assertNotNull(wct.changes[task2.token.asBinder()])
assertThat(taskChange.windowingMode)
.isEqualTo(WINDOWING_MODE_UNDEFINED) // inherited FULLSCREEN
- wct.assertRemoveAt(index = 0, wallpaperToken)
+ wct.assertReorderAt(index = 0, wallpaperToken, toTop = false)
}
@Test
@@ -3543,6 +3573,7 @@ class DesktopTasksControllerTest : ShellTestCase() {
}
@Test
+ @EnableFlags(Flags.FLAG_ENABLE_DESKTOP_WALLPAPER_ACTIVITY_ON_SYSTEM_USER)
fun enterSplit_onlyVisibleNonMinimizedTask_removesWallpaperActivity() {
val task1 = setUpFreeformTask()
val task2 = setUpFreeformTask()
@@ -3565,7 +3596,7 @@ class DesktopTasksControllerTest : ShellTestCase() {
eq(task2.configuration.windowConfiguration.bounds),
)
// Removes wallpaper activity when leaving desktop
- wctArgument.value.assertRemoveAt(index = 0, wallpaperToken)
+ wctArgument.value.assertReorderAt(index = 0, wallpaperToken, toTop = false)
}
@Test
@@ -5019,6 +5050,18 @@ private fun WindowContainerTransaction.assertReorderAt(
toTop?.let { assertThat(op.toTop).isEqualTo(it) }
}
+private fun WindowContainerTransaction.assertReorderAt(
+ index: Int,
+ token: WindowContainerToken,
+ toTop: Boolean? = null,
+) {
+ assertIndexInBounds(index)
+ val op = hierarchyOps[index]
+ assertThat(op.type).isEqualTo(HIERARCHY_OP_TYPE_REORDER)
+ assertThat(op.container).isEqualTo(token.asBinder())
+ toTop?.let { assertThat(op.toTop).isEqualTo(it) }
+}
+
private fun WindowContainerTransaction.assertReorderSequence(vararg tasks: RunningTaskInfo) {
for (i in tasks.indices) {
assertReorderAt(i, tasks[i])
diff --git a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/desktopmode/DesktopTasksTransitionObserverTest.kt b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/desktopmode/DesktopTasksTransitionObserverTest.kt
index 176102a4deff..d491d445458d 100644
--- a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/desktopmode/DesktopTasksTransitionObserverTest.kt
+++ b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/desktopmode/DesktopTasksTransitionObserverTest.kt
@@ -35,7 +35,7 @@ import android.window.TransitionInfo
import android.window.TransitionInfo.Change
import android.window.WindowContainerToken
import android.window.WindowContainerTransaction
-import android.window.WindowContainerTransaction.HierarchyOp.HIERARCHY_OP_TYPE_REMOVE_TASK
+import android.window.WindowContainerTransaction.HierarchyOp.HIERARCHY_OP_TYPE_REORDER
import com.android.modules.utils.testing.ExtendedMockitoRule
import com.android.window.flags.Flags
import com.android.wm.shell.MockToken
@@ -239,6 +239,7 @@ class DesktopTasksTransitionObserverTest {
}
@Test
+ @EnableFlags(Flags.FLAG_ENABLE_DESKTOP_WALLPAPER_ACTIVITY_ON_SYSTEM_USER)
fun closeLastTask_wallpaperTokenExists_wallpaperIsRemoved() {
val mockTransition = Mockito.mock(IBinder::class.java)
val task = createTaskInfo(1, WINDOWING_MODE_FREEFORM)
@@ -252,9 +253,9 @@ class DesktopTasksTransitionObserverTest {
)
transitionObserver.onTransitionFinished(mockTransition, false)
- val wct = getLatestWct(type = TRANSIT_CLOSE)
+ val wct = getLatestWct(type = TRANSIT_TO_BACK)
assertThat(wct.hierarchyOps).hasSize(1)
- wct.assertRemoveAt(index = 0, wallpaperToken)
+ wct.assertReorderAt(index = 0, wallpaperToken, toTop = false)
}
@Test
@@ -381,11 +382,16 @@ class DesktopTasksTransitionObserverTest {
return arg.value
}
- private fun WindowContainerTransaction.assertRemoveAt(index: Int, token: WindowContainerToken) {
+ private fun WindowContainerTransaction.assertReorderAt(
+ index: Int,
+ token: WindowContainerToken,
+ toTop: Boolean? = null,
+ ) {
assertIndexInBounds(index)
val op = hierarchyOps[index]
- assertThat(op.type).isEqualTo(HIERARCHY_OP_TYPE_REMOVE_TASK)
+ assertThat(op.type).isEqualTo(HIERARCHY_OP_TYPE_REORDER)
assertThat(op.container).isEqualTo(token.asBinder())
+ toTop?.let { assertThat(op.toTop).isEqualTo(it) }
}
private fun WindowContainerTransaction.assertIndexInBounds(index: Int) {