Loading libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopTasksController.kt +7 −4 Original line number Diff line number Diff line Loading @@ -417,7 +417,7 @@ class DesktopTasksController( ) val wct = WindowContainerTransaction() exitSplitIfApplicable(wct, taskInfo) moveHomeTaskToFront(wct) moveHomeTask(wct, true /* toTop */) val taskToMinimize = bringDesktopAppsToFrontBeforeShowingNewTask(taskInfo.displayId, wct, taskInfo.taskId) addMoveToDesktopChanges(wct, taskInfo) Loading Loading @@ -795,7 +795,7 @@ class DesktopTasksController( addWallpaperActivity(wct) } else { // Move home to front moveHomeTaskToFront(wct) moveHomeTask(wct, true /* toTop */) } val nonMinimizedTasksOrderedFrontToBack = Loading @@ -821,11 +821,11 @@ class DesktopTasksController( return taskToMinimize } private fun moveHomeTaskToFront(wct: WindowContainerTransaction) { private fun moveHomeTask(wct: WindowContainerTransaction, toTop: Boolean) { shellTaskOrganizer .getRunningTasks(context.displayId) .firstOrNull { task -> task.activityType == ACTIVITY_TYPE_HOME } ?.let { homeTask -> wct.reorder(homeTask.getToken(), true /* onTop */) } ?.let { homeTask -> wct.reorder(homeTask.getToken(), toTop /* onTop */) } } private fun addWallpaperActivity(wct: WindowContainerTransaction) { Loading Loading @@ -1040,6 +1040,9 @@ class DesktopTasksController( ) return WindowContainerTransaction().also { wct -> addMoveToDesktopChanges(wct, task) // In some launches home task is moved behind new task being launched. Make sure // that's not the case for launches in desktop. moveHomeTask(wct, false /* toTop */) // Desktop Mode is already showing and we're launching a new Task - we might need to // minimize another Task. val taskToMinimize = addAndGetMinimizeChangesIfNeeded(task.displayId, wct, task) Loading libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/desktopmode/DesktopTasksControllerTest.kt +6 −2 Original line number Diff line number Diff line Loading @@ -1087,13 +1087,17 @@ class DesktopTasksControllerTest : ShellTestCase() { fun handleRequest_fullscreenTask_freeformVisible_returnSwitchToFreeformWCT() { assumeTrue(ENABLE_SHELL_TRANSITIONS) val homeTask = setUpHomeTask() val freeformTask = setUpFreeformTask() markTaskVisible(freeformTask) val fullscreenTask = createFullscreenTask() val result = controller.handleRequest(Binder(), createTransition(fullscreenTask)) assertThat(result?.changes?.get(fullscreenTask.token.asBinder())?.windowingMode) val wct = controller.handleRequest(Binder(), createTransition(fullscreenTask)) assertThat(wct?.changes?.get(fullscreenTask.token.asBinder())?.windowingMode) .isEqualTo(WINDOWING_MODE_FREEFORM) assertThat(wct!!.hierarchyOps.size).isEqualTo(2) wct.assertReorderAt(1, homeTask, toTop = false) } @Test Loading Loading
libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopTasksController.kt +7 −4 Original line number Diff line number Diff line Loading @@ -417,7 +417,7 @@ class DesktopTasksController( ) val wct = WindowContainerTransaction() exitSplitIfApplicable(wct, taskInfo) moveHomeTaskToFront(wct) moveHomeTask(wct, true /* toTop */) val taskToMinimize = bringDesktopAppsToFrontBeforeShowingNewTask(taskInfo.displayId, wct, taskInfo.taskId) addMoveToDesktopChanges(wct, taskInfo) Loading Loading @@ -795,7 +795,7 @@ class DesktopTasksController( addWallpaperActivity(wct) } else { // Move home to front moveHomeTaskToFront(wct) moveHomeTask(wct, true /* toTop */) } val nonMinimizedTasksOrderedFrontToBack = Loading @@ -821,11 +821,11 @@ class DesktopTasksController( return taskToMinimize } private fun moveHomeTaskToFront(wct: WindowContainerTransaction) { private fun moveHomeTask(wct: WindowContainerTransaction, toTop: Boolean) { shellTaskOrganizer .getRunningTasks(context.displayId) .firstOrNull { task -> task.activityType == ACTIVITY_TYPE_HOME } ?.let { homeTask -> wct.reorder(homeTask.getToken(), true /* onTop */) } ?.let { homeTask -> wct.reorder(homeTask.getToken(), toTop /* onTop */) } } private fun addWallpaperActivity(wct: WindowContainerTransaction) { Loading Loading @@ -1040,6 +1040,9 @@ class DesktopTasksController( ) return WindowContainerTransaction().also { wct -> addMoveToDesktopChanges(wct, task) // In some launches home task is moved behind new task being launched. Make sure // that's not the case for launches in desktop. moveHomeTask(wct, false /* toTop */) // Desktop Mode is already showing and we're launching a new Task - we might need to // minimize another Task. val taskToMinimize = addAndGetMinimizeChangesIfNeeded(task.displayId, wct, task) Loading
libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/desktopmode/DesktopTasksControllerTest.kt +6 −2 Original line number Diff line number Diff line Loading @@ -1087,13 +1087,17 @@ class DesktopTasksControllerTest : ShellTestCase() { fun handleRequest_fullscreenTask_freeformVisible_returnSwitchToFreeformWCT() { assumeTrue(ENABLE_SHELL_TRANSITIONS) val homeTask = setUpHomeTask() val freeformTask = setUpFreeformTask() markTaskVisible(freeformTask) val fullscreenTask = createFullscreenTask() val result = controller.handleRequest(Binder(), createTransition(fullscreenTask)) assertThat(result?.changes?.get(fullscreenTask.token.asBinder())?.windowingMode) val wct = controller.handleRequest(Binder(), createTransition(fullscreenTask)) assertThat(wct?.changes?.get(fullscreenTask.token.asBinder())?.windowingMode) .isEqualTo(WINDOWING_MODE_FREEFORM) assertThat(wct!!.hierarchyOps.size).isEqualTo(2) wct.assertReorderAt(1, homeTask, toTop = false) } @Test Loading