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

Commit eca8ee30 authored by Eghosa Ewansiha-Vlachavas's avatar Eghosa Ewansiha-Vlachavas Committed by Android (Google) Code Review
Browse files

Merge changes I592f8c97,I2a6a87bb into main

* changes:
  Split `verifyWCTNotExecuted` into handler specific methods
  Clean up `DesktopTasksControllerTest`
parents a9dbddfe 6c246dbb
Loading
Loading
Loading
Loading
+42 −75
Original line number Diff line number Diff line
@@ -484,57 +484,52 @@ class DesktopTasksControllerTest : ShellTestCase() {
  @Test
  @EnableFlags(Flags.FLAG_ENABLE_WINDOWING_DYNAMIC_INITIAL_BOUNDS)
  fun moveToDesktop_landscapeDevice_resizable_undefinedOrientation_defaultLandscapeBounds() {
    doReturn(true).`when` { DesktopModeStatus.isDesktopModeSupported(any()) }
    val task = setUpFullscreenTask()
    setUpLandscapeDisplay()

    controller.moveToDesktop(task, transitionSource = UNKNOWN)
    val wct = getLatestMoveToDesktopWct()
    val wct = getLatestEnterDesktopWct()
    assertThat(findBoundsChange(wct, task)).isEqualTo(DEFAULT_LANDSCAPE_BOUNDS)
  }

  @Test
  @EnableFlags(Flags.FLAG_ENABLE_WINDOWING_DYNAMIC_INITIAL_BOUNDS)
  fun moveToDesktop_landscapeDevice_resizable_landscapeOrientation_defaultLandscapeBounds() {
    doReturn(true).`when` { DesktopModeStatus.isDesktopModeSupported(any()) }
    val task = setUpFullscreenTask(screenOrientation = SCREEN_ORIENTATION_LANDSCAPE)
    setUpLandscapeDisplay()

    controller.moveToDesktop(task, transitionSource = UNKNOWN)
    val wct = getLatestMoveToDesktopWct()
    val wct = getLatestEnterDesktopWct()
    assertThat(findBoundsChange(wct, task)).isEqualTo(DEFAULT_LANDSCAPE_BOUNDS)
  }

  @Test
  @EnableFlags(Flags.FLAG_ENABLE_WINDOWING_DYNAMIC_INITIAL_BOUNDS)
  fun moveToDesktop_landscapeDevice_resizable_portraitOrientation_resizablePortraitBounds() {
    doReturn(true).`when` { DesktopModeStatus.isDesktopModeSupported(any()) }
    val task =
        setUpFullscreenTask(screenOrientation = SCREEN_ORIENTATION_PORTRAIT, shouldLetterbox = true)
    setUpLandscapeDisplay()

    controller.moveToDesktop(task, transitionSource = UNKNOWN)
    val wct = getLatestMoveToDesktopWct()
    val wct = getLatestEnterDesktopWct()
    assertThat(findBoundsChange(wct, task)).isEqualTo(RESIZABLE_PORTRAIT_BOUNDS)
  }

  @Test
  @EnableFlags(Flags.FLAG_ENABLE_WINDOWING_DYNAMIC_INITIAL_BOUNDS)
  fun moveToDesktop_landscapeDevice_unResizable_landscapeOrientation_defaultLandscapeBounds() {
    doReturn(true).`when` { DesktopModeStatus.isDesktopModeSupported(any()) }
    val task =
        setUpFullscreenTask(isResizable = false, screenOrientation = SCREEN_ORIENTATION_LANDSCAPE)
    setUpLandscapeDisplay()

    controller.moveToDesktop(task, transitionSource = UNKNOWN)
    val wct = getLatestMoveToDesktopWct()
    val wct = getLatestEnterDesktopWct()
    assertThat(findBoundsChange(wct, task)).isEqualTo(DEFAULT_LANDSCAPE_BOUNDS)
  }

  @Test
  @EnableFlags(Flags.FLAG_ENABLE_WINDOWING_DYNAMIC_INITIAL_BOUNDS)
  fun moveToDesktop_landscapeDevice_unResizable_portraitOrientation_unResizablePortraitBounds() {
    doReturn(true).`when` { DesktopModeStatus.isDesktopModeSupported(any()) }
    val task =
        setUpFullscreenTask(
            isResizable = false,
@@ -543,26 +538,24 @@ class DesktopTasksControllerTest : ShellTestCase() {
    setUpLandscapeDisplay()

    controller.moveToDesktop(task, transitionSource = UNKNOWN)
    val wct = getLatestMoveToDesktopWct()
    val wct = getLatestEnterDesktopWct()
    assertThat(findBoundsChange(wct, task)).isEqualTo(UNRESIZABLE_PORTRAIT_BOUNDS)
  }

  @Test
  @EnableFlags(Flags.FLAG_ENABLE_WINDOWING_DYNAMIC_INITIAL_BOUNDS)
  fun moveToDesktop_portraitDevice_resizable_undefinedOrientation_defaultPortraitBounds() {
    doReturn(true).`when` { DesktopModeStatus.isDesktopModeSupported(any()) }
    val task = setUpFullscreenTask(deviceOrientation = ORIENTATION_PORTRAIT)
    setUpPortraitDisplay()

    controller.moveToDesktop(task, transitionSource = UNKNOWN)
    val wct = getLatestMoveToDesktopWct()
    val wct = getLatestEnterDesktopWct()
    assertThat(findBoundsChange(wct, task)).isEqualTo(DEFAULT_PORTRAIT_BOUNDS)
  }

  @Test
  @EnableFlags(Flags.FLAG_ENABLE_WINDOWING_DYNAMIC_INITIAL_BOUNDS)
  fun moveToDesktop_portraitDevice_resizable_portraitOrientation_defaultPortraitBounds() {
    doReturn(true).`when` { DesktopModeStatus.isDesktopModeSupported(any()) }
    val task =
        setUpFullscreenTask(
            deviceOrientation = ORIENTATION_PORTRAIT,
@@ -570,14 +563,13 @@ class DesktopTasksControllerTest : ShellTestCase() {
    setUpPortraitDisplay()

    controller.moveToDesktop(task, transitionSource = UNKNOWN)
    val wct = getLatestMoveToDesktopWct()
    val wct = getLatestEnterDesktopWct()
    assertThat(findBoundsChange(wct, task)).isEqualTo(DEFAULT_PORTRAIT_BOUNDS)
  }

  @Test
  @EnableFlags(Flags.FLAG_ENABLE_WINDOWING_DYNAMIC_INITIAL_BOUNDS)
  fun moveToDesktop_portraitDevice_resizable_landscapeOrientation_resizableLandscapeBounds() {
    doReturn(true).`when` { DesktopModeStatus.isDesktopModeSupported(any()) }
    val task =
        setUpFullscreenTask(
            deviceOrientation = ORIENTATION_PORTRAIT,
@@ -586,14 +578,13 @@ class DesktopTasksControllerTest : ShellTestCase() {
    setUpPortraitDisplay()

    controller.moveToDesktop(task, transitionSource = UNKNOWN)
    val wct = getLatestMoveToDesktopWct()
    val wct = getLatestEnterDesktopWct()
    assertThat(findBoundsChange(wct, task)).isEqualTo(RESIZABLE_LANDSCAPE_BOUNDS)
  }

  @Test
  @EnableFlags(Flags.FLAG_ENABLE_WINDOWING_DYNAMIC_INITIAL_BOUNDS)
  fun moveToDesktop_portraitDevice_unResizable_portraitOrientation_defaultPortraitBounds() {
    doReturn(true).`when` { DesktopModeStatus.isDesktopModeSupported(any()) }
    val task =
        setUpFullscreenTask(
            isResizable = false,
@@ -602,14 +593,13 @@ class DesktopTasksControllerTest : ShellTestCase() {
    setUpPortraitDisplay()

    controller.moveToDesktop(task, transitionSource = UNKNOWN)
    val wct = getLatestMoveToDesktopWct()
    val wct = getLatestEnterDesktopWct()
    assertThat(findBoundsChange(wct, task)).isEqualTo(DEFAULT_PORTRAIT_BOUNDS)
  }

  @Test
  @EnableFlags(Flags.FLAG_ENABLE_WINDOWING_DYNAMIC_INITIAL_BOUNDS)
  fun moveToDesktop_portraitDevice_unResizable_landscapeOrientation_unResizableLandscapeBounds() {
    doReturn(true).`when` { DesktopModeStatus.isDesktopModeSupported(any()) }
    val task =
        setUpFullscreenTask(
            isResizable = false,
@@ -619,7 +609,7 @@ class DesktopTasksControllerTest : ShellTestCase() {
    setUpPortraitDisplay()

    controller.moveToDesktop(task, transitionSource = UNKNOWN)
    val wct = getLatestMoveToDesktopWct()
    val wct = getLatestEnterDesktopWct()
    assertThat(findBoundsChange(wct, task)).isEqualTo(UNRESIZABLE_LANDSCAPE_BOUNDS)
  }

@@ -629,7 +619,7 @@ class DesktopTasksControllerTest : ShellTestCase() {
    val tda = rootTaskDisplayAreaOrganizer.getDisplayAreaInfo(DEFAULT_DISPLAY)!!
    tda.configuration.windowConfiguration.windowingMode = WINDOWING_MODE_FULLSCREEN
    controller.moveToDesktop(task, transitionSource = UNKNOWN)
    val wct = getLatestMoveToDesktopWct()
    val wct = getLatestEnterDesktopWct()
    assertThat(wct.changes[task.token.asBinder()]?.windowingMode).isEqualTo(WINDOWING_MODE_FREEFORM)
  }

@@ -639,7 +629,7 @@ class DesktopTasksControllerTest : ShellTestCase() {
    val tda = rootTaskDisplayAreaOrganizer.getDisplayAreaInfo(DEFAULT_DISPLAY)!!
    tda.configuration.windowConfiguration.windowingMode = WINDOWING_MODE_FREEFORM
    controller.moveToDesktop(task, transitionSource = UNKNOWN)
    val wct = getLatestMoveToDesktopWct()
    val wct = getLatestEnterDesktopWct()
    assertThat(wct.changes[task.token.asBinder()]?.windowingMode)
        .isEqualTo(WINDOWING_MODE_UNDEFINED)
  }
@@ -647,7 +637,7 @@ class DesktopTasksControllerTest : ShellTestCase() {
  @Test
  fun moveToDesktop_nonExistentTask_doesNothing() {
    controller.moveToDesktop(999, transitionSource = UNKNOWN)
    verifyWCTNotExecuted()
    verifyEnterDesktopWCTNotExecuted()
  }

  @Test
@@ -659,7 +649,7 @@ class DesktopTasksControllerTest : ShellTestCase() {
    whenever(recentTasksController.findTaskInBackground(anyInt())).thenReturn(task)

    controller.moveToDesktop(task.taskId, transitionSource = UNKNOWN)
    with(getLatestMoveToDesktopWct()) {
    with(getLatestEnterDesktopWct()) {
      assertLaunchTaskAt(0, task.taskId, WINDOWING_MODE_FREEFORM)
    }
  }
@@ -674,34 +664,7 @@ class DesktopTasksControllerTest : ShellTestCase() {
        }

    controller.moveToDesktop(task, transitionSource = UNKNOWN)
    verifyWCTNotExecuted()
  }

  @Test
  fun moveToDesktop_deviceNotSupported_doesNothing() {
    val task = setUpFullscreenTask()

    // Simulate non compatible device
    doReturn(false).`when` { DesktopModeStatus.isDesktopModeSupported(any()) }

    controller.moveToDesktop(task, transitionSource = UNKNOWN)
    verifyWCTNotExecuted()
  }

  @Test
  fun moveToDesktop_deviceNotSupported_deviceRestrictionsOverridden_taskIsMovedToDesktop() {
    val task = setUpFullscreenTask()

    // Simulate non compatible device
    doReturn(false).`when` { DesktopModeStatus.isDesktopModeSupported(any()) }

    // Simulate enforce device restrictions system property overridden to false
    whenever(DesktopModeStatus.enforceDeviceRestrictions()).thenReturn(false)

    controller.moveToDesktop(task, transitionSource = UNKNOWN)

    val wct = getLatestMoveToDesktopWct()
    assertThat(wct.changes[task.token.asBinder()]?.windowingMode).isEqualTo(WINDOWING_MODE_FREEFORM)
    verifyEnterDesktopWCTNotExecuted()
  }

  @Test
@@ -710,7 +673,7 @@ class DesktopTasksControllerTest : ShellTestCase() {

    controller.moveToDesktop(task, transitionSource = UNKNOWN)

    val wct = getLatestMoveToDesktopWct()
    val wct = getLatestEnterDesktopWct()
    assertThat(wct.changes[task.token.asBinder()]?.windowingMode).isEqualTo(WINDOWING_MODE_FREEFORM)
  }

@@ -724,7 +687,7 @@ class DesktopTasksControllerTest : ShellTestCase() {

    controller.moveToDesktop(fullscreenTask, transitionSource = UNKNOWN)

    with(getLatestMoveToDesktopWct()) {
    with(getLatestEnterDesktopWct()) {
      // Operations should include home task, freeform task
      assertThat(hierarchyOps).hasSize(3)
      assertReorderSequence(homeTask, freeformTask, fullscreenTask)
@@ -742,7 +705,7 @@ class DesktopTasksControllerTest : ShellTestCase() {

    controller.moveToDesktop(fullscreenTask, transitionSource = UNKNOWN)

    with(getLatestMoveToDesktopWct()) {
    with(getLatestEnterDesktopWct()) {
      // Operations should include wallpaper intent, freeform task, fullscreen task
      assertThat(hierarchyOps).hasSize(3)
      assertPendingIntentAt(index = 0, desktopWallpaperIntent)
@@ -766,7 +729,7 @@ class DesktopTasksControllerTest : ShellTestCase() {

    controller.moveToDesktop(fullscreenTaskDefault, transitionSource = UNKNOWN)

    with(getLatestMoveToDesktopWct()) {
    with(getLatestEnterDesktopWct()) {
      // Check that hierarchy operations do not include tasks from second display
      assertThat(hierarchyOps.map { it.container }).doesNotContain(homeTaskSecond.token.asBinder())
      assertThat(hierarchyOps.map { it.container })
@@ -778,7 +741,7 @@ class DesktopTasksControllerTest : ShellTestCase() {
  fun moveToDesktop_splitTaskExitsSplit() {
    val task = setUpSplitScreenTask()
    controller.moveToDesktop(task, transitionSource = UNKNOWN)
    val wct = getLatestMoveToDesktopWct()
    val wct = getLatestEnterDesktopWct()
    assertThat(wct.changes[task.token.asBinder()]?.windowingMode).isEqualTo(WINDOWING_MODE_FREEFORM)
    verify(splitScreenController)
        .prepareExitSplitScreen(any(), anyInt(), eq(SplitScreenController.EXIT_REASON_DESKTOP_MODE))
@@ -788,7 +751,7 @@ class DesktopTasksControllerTest : ShellTestCase() {
  fun moveToDesktop_fullscreenTaskDoesNotExitSplit() {
    val task = setUpFullscreenTask()
    controller.moveToDesktop(task, transitionSource = UNKNOWN)
    val wct = getLatestMoveToDesktopWct()
    val wct = getLatestEnterDesktopWct()
    assertThat(wct.changes[task.token.asBinder()]?.windowingMode).isEqualTo(WINDOWING_MODE_FREEFORM)
    verify(splitScreenController, never())
        .prepareExitSplitScreen(any(), anyInt(), eq(SplitScreenController.EXIT_REASON_DESKTOP_MODE))
@@ -803,7 +766,7 @@ class DesktopTasksControllerTest : ShellTestCase() {

    controller.moveToDesktop(newTask, transitionSource = UNKNOWN)

    val wct = getLatestMoveToDesktopWct()
    val wct = getLatestEnterDesktopWct()
    assertThat(wct.hierarchyOps.size).isEqualTo(taskLimit + 1) // visible tasks + home
    wct.assertReorderAt(0, homeTask)
    for (i in 1..<taskLimit) { // Skipping freeformTasks[0]
@@ -837,7 +800,7 @@ class DesktopTasksControllerTest : ShellTestCase() {
  @Test
  fun moveToFullscreen_nonExistentTask_doesNothing() {
    controller.moveToFullscreen(999, transitionSource = UNKNOWN)
    verifyWCTNotExecuted()
    verifyExitDesktopWCTNotExecuted()
  }

  @Test
@@ -1284,7 +1247,7 @@ class DesktopTasksControllerTest : ShellTestCase() {

    controller.moveFocusedTaskToDesktop(DEFAULT_DISPLAY, transitionSource = UNKNOWN)

    val wct = getLatestMoveToDesktopWct()
    val wct = getLatestEnterDesktopWct()
    assertThat(wct.changes[task1.token.asBinder()]?.windowingMode)
        .isEqualTo(WINDOWING_MODE_FREEFORM)
  }
@@ -1305,7 +1268,7 @@ class DesktopTasksControllerTest : ShellTestCase() {

    controller.moveFocusedTaskToDesktop(DEFAULT_DISPLAY, transitionSource = UNKNOWN)

    val wct = getLatestMoveToDesktopWct()
    val wct = getLatestEnterDesktopWct()
    assertThat(wct.changes[task4.token.asBinder()]?.windowingMode)
        .isEqualTo(WINDOWING_MODE_FREEFORM)
    verify(splitScreenController)
@@ -1332,7 +1295,6 @@ class DesktopTasksControllerTest : ShellTestCase() {
  @Test
  @EnableFlags(Flags.FLAG_ENABLE_WINDOWING_DYNAMIC_INITIAL_BOUNDS)
  fun dragToDesktop_landscapeDevice_resizable_undefinedOrientation_defaultLandscapeBounds() {
    doReturn(true).`when` { DesktopModeStatus.isDesktopModeSupported(any()) }
    val spyController = spy(controller)
    whenever(spyController.getVisualIndicator()).thenReturn(desktopModeVisualIndicator)
    whenever(desktopModeVisualIndicator.updateIndicatorType(anyOrNull(), anyOrNull()))
@@ -1349,7 +1311,6 @@ class DesktopTasksControllerTest : ShellTestCase() {
  @Test
  @EnableFlags(Flags.FLAG_ENABLE_WINDOWING_DYNAMIC_INITIAL_BOUNDS)
  fun dragToDesktop_landscapeDevice_resizable_landscapeOrientation_defaultLandscapeBounds() {
    doReturn(true).`when` { DesktopModeStatus.isDesktopModeSupported(any()) }
    val spyController = spy(controller)
    whenever(spyController.getVisualIndicator()).thenReturn(desktopModeVisualIndicator)
    whenever(desktopModeVisualIndicator.updateIndicatorType(anyOrNull(), anyOrNull()))
@@ -1366,7 +1327,6 @@ class DesktopTasksControllerTest : ShellTestCase() {
  @Test
  @EnableFlags(Flags.FLAG_ENABLE_WINDOWING_DYNAMIC_INITIAL_BOUNDS)
  fun dragToDesktop_landscapeDevice_resizable_portraitOrientation_resizablePortraitBounds() {
    doReturn(true).`when` { DesktopModeStatus.isDesktopModeSupported(any()) }
    val spyController = spy(controller)
    whenever(spyController.getVisualIndicator()).thenReturn(desktopModeVisualIndicator)
    whenever(desktopModeVisualIndicator.updateIndicatorType(anyOrNull(), anyOrNull()))
@@ -1384,7 +1344,6 @@ class DesktopTasksControllerTest : ShellTestCase() {
  @Test
  @EnableFlags(Flags.FLAG_ENABLE_WINDOWING_DYNAMIC_INITIAL_BOUNDS)
  fun dragToDesktop_landscapeDevice_unResizable_landscapeOrientation_defaultLandscapeBounds() {
    doReturn(true).`when` { DesktopModeStatus.isDesktopModeSupported(any()) }
    val spyController = spy(controller)
    whenever(spyController.getVisualIndicator()).thenReturn(desktopModeVisualIndicator)
    whenever(desktopModeVisualIndicator.updateIndicatorType(anyOrNull(), anyOrNull()))
@@ -1402,7 +1361,6 @@ class DesktopTasksControllerTest : ShellTestCase() {
  @Test
  @EnableFlags(Flags.FLAG_ENABLE_WINDOWING_DYNAMIC_INITIAL_BOUNDS)
  fun dragToDesktop_landscapeDevice_unResizable_portraitOrientation_unResizablePortraitBounds() {
    doReturn(true).`when` { DesktopModeStatus.isDesktopModeSupported(any()) }
    val spyController = spy(controller)
    whenever(spyController.getVisualIndicator()).thenReturn(desktopModeVisualIndicator)
    whenever(desktopModeVisualIndicator.updateIndicatorType(anyOrNull(), anyOrNull()))
@@ -1423,7 +1381,6 @@ class DesktopTasksControllerTest : ShellTestCase() {
  @Test
  @EnableFlags(Flags.FLAG_ENABLE_WINDOWING_DYNAMIC_INITIAL_BOUNDS)
  fun dragToDesktop_portraitDevice_resizable_undefinedOrientation_defaultPortraitBounds() {
    doReturn(true).`when` { DesktopModeStatus.isDesktopModeSupported(any()) }
    val spyController = spy(controller)
    whenever(spyController.getVisualIndicator()).thenReturn(desktopModeVisualIndicator)
    whenever(desktopModeVisualIndicator.updateIndicatorType(anyOrNull(), anyOrNull()))
@@ -1440,7 +1397,6 @@ class DesktopTasksControllerTest : ShellTestCase() {
  @Test
  @EnableFlags(Flags.FLAG_ENABLE_WINDOWING_DYNAMIC_INITIAL_BOUNDS)
  fun dragToDesktop_portraitDevice_resizable_portraitOrientation_defaultPortraitBounds() {
    doReturn(true).`when` { DesktopModeStatus.isDesktopModeSupported(any()) }
    val spyController = spy(controller)
    whenever(spyController.getVisualIndicator()).thenReturn(desktopModeVisualIndicator)
    whenever(desktopModeVisualIndicator.updateIndicatorType(anyOrNull(), anyOrNull()))
@@ -1460,7 +1416,6 @@ class DesktopTasksControllerTest : ShellTestCase() {
  @Test
  @EnableFlags(Flags.FLAG_ENABLE_WINDOWING_DYNAMIC_INITIAL_BOUNDS)
  fun dragToDesktop_portraitDevice_resizable_landscapeOrientation_resizableLandscapeBounds() {
    doReturn(true).`when` { DesktopModeStatus.isDesktopModeSupported(any()) }
    val spyController = spy(controller)
    whenever(spyController.getVisualIndicator()).thenReturn(desktopModeVisualIndicator)
    whenever(desktopModeVisualIndicator.updateIndicatorType(anyOrNull(), anyOrNull()))
@@ -1481,7 +1436,6 @@ class DesktopTasksControllerTest : ShellTestCase() {
  @Test
  @EnableFlags(Flags.FLAG_ENABLE_WINDOWING_DYNAMIC_INITIAL_BOUNDS)
  fun dragToDesktop_portraitDevice_unResizable_portraitOrientation_defaultPortraitBounds() {
    doReturn(true).`when` { DesktopModeStatus.isDesktopModeSupported(any()) }
    val spyController = spy(controller)
    whenever(spyController.getVisualIndicator()).thenReturn(desktopModeVisualIndicator)
    whenever(desktopModeVisualIndicator.updateIndicatorType(anyOrNull(), anyOrNull()))
@@ -1502,7 +1456,6 @@ class DesktopTasksControllerTest : ShellTestCase() {
  @Test
  @EnableFlags(Flags.FLAG_ENABLE_WINDOWING_DYNAMIC_INITIAL_BOUNDS)
  fun dragToDesktop_portraitDevice_unResizable_landscapeOrientation_unResizableLandscapeBounds() {
    doReturn(true).`when` { DesktopModeStatus.isDesktopModeSupported(any()) }
    val spyController = spy(controller)
    whenever(spyController.getVisualIndicator()).thenReturn(desktopModeVisualIndicator)
    whenever(desktopModeVisualIndicator.updateIndicatorType(anyOrNull(), anyOrNull()))
@@ -1685,7 +1638,6 @@ class DesktopTasksControllerTest : ShellTestCase() {
            Rect(0, 0, DISPLAY_DIMENSION_SHORT, DISPLAY_DIMENSION_LONG)
      }
    }
    whenever(DesktopModeStatus.enforceDeviceRestrictions()).thenReturn(true)
    whenever(shellTaskOrganizer.getRunningTaskInfo(task.taskId)).thenReturn(task)
    runningTasks.add(task)
    return task
@@ -1703,7 +1655,6 @@ class DesktopTasksControllerTest : ShellTestCase() {

  private fun setUpSplitScreenTask(displayId: Int = DEFAULT_DISPLAY): RunningTaskInfo {
    val task = createSplitScreenTask(displayId)
    whenever(DesktopModeStatus.enforceDeviceRestrictions()).thenReturn(true)
    whenever(splitScreenController.isTaskInSplitScreen(task.taskId)).thenReturn(true)
    whenever(shellTaskOrganizer.getRunningTaskInfo(task.taskId)).thenReturn(task)
    runningTasks.add(task)
@@ -1748,7 +1699,7 @@ class DesktopTasksControllerTest : ShellTestCase() {
    return arg.value
  }

  private fun getLatestMoveToDesktopWct(): WindowContainerTransaction {
  private fun getLatestEnterDesktopWct(): WindowContainerTransaction {
    val arg = ArgumentCaptor.forClass(WindowContainerTransaction::class.java)
    if (ENABLE_SHELL_TRANSITIONS) {
      verify(enterDesktopTransitionHandler).moveToDesktop(arg.capture(), any())
@@ -1790,6 +1741,22 @@ class DesktopTasksControllerTest : ShellTestCase() {
    }
  }

  private fun verifyExitDesktopWCTNotExecuted() {
    if (ENABLE_SHELL_TRANSITIONS) {
      verify(exitDesktopTransitionHandler, never()).startTransition(any(), any(), any(), any())
    } else {
      verify(shellTaskOrganizer, never()).applyTransaction(any())
    }
  }

  private fun verifyEnterDesktopWCTNotExecuted() {
    if (ENABLE_SHELL_TRANSITIONS) {
      verify(enterDesktopTransitionHandler, never()).moveToDesktop(any(), any())
    } else {
      verify(shellTaskOrganizer, never()).applyTransaction(any())
    }
  }

  private fun createTransition(
      task: RunningTaskInfo?,
      @WindowManager.TransitionType type: Int = TRANSIT_OPEN