diff --git a/quickstep/src/com/android/quickstep/views/DesktopTaskView.kt b/quickstep/src/com/android/quickstep/views/DesktopTaskView.kt index 3c47e0eed8..000455be2d 100644 --- a/quickstep/src/com/android/quickstep/views/DesktopTaskView.kt +++ b/quickstep/src/com/android/quickstep/views/DesktopTaskView.kt @@ -417,8 +417,22 @@ class DesktopTaskView @JvmOverloads constructor(context: Context, attrs: Attribu val endCallback = RunnableList() val desktopController = recentsView.desktopRecentsController checkNotNull(desktopController) { "recentsController is null" } - desktopController.launchDesktopFromRecents(this, animated) { - endCallback.executeAllAndDestroy() + + val launchDesktopFromRecents = { + desktopController.launchDesktopFromRecents(this, animated) { + endCallback.executeAllAndDestroy() + } + } + if (enableMultipleDesktops(context) && desktopTask?.tasks?.isEmpty() == true) { + recentsView.switchToScreenshot { + recentsView.finishRecentsAnimation( + /* toRecents= */ true, + /* shouldPip= */ false, + launchDesktopFromRecents, + ) + } + } else { + launchDesktopFromRecents() } Log.d( TAG, diff --git a/quickstep/src/com/android/quickstep/views/RecentsViewUtils.kt b/quickstep/src/com/android/quickstep/views/RecentsViewUtils.kt index 0aa9215745..67485baa80 100644 --- a/quickstep/src/com/android/quickstep/views/RecentsViewUtils.kt +++ b/quickstep/src/com/android/quickstep/views/RecentsViewUtils.kt @@ -303,11 +303,6 @@ class RecentsViewUtils(private val recentsView: RecentsView<*, *>) : DesktopVisi } } - override fun onActiveDeskChanged(displayId: Int, newActiveDesk: Int, oldActiveDesk: Int) { - // TODO: b/400870600 - We may need to add code here to special case when an empty desk gets - // activated, since `RemoteDesktopLaunchTransitionRunner` doesn't always get triggered. - } - /** * Gets the list of accessibility children. Currently all the children of RecentsViews are * added, and in the reverse order to the list.