From 624f96dd7201701b83ec219d8574b42f2435ee4e Mon Sep 17 00:00:00 2001 From: minch Date: Fri, 28 Mar 2025 22:21:00 +0000 Subject: [PATCH] Swtich to screenshot before trigger the desk launch Bug: 400870600 Test: m Flag: com.android.window.flags.enable_multiple_desktops_frontend Flag: com.android.window.flags.enable_multiple_desktops_backend Change-Id: I7a622a2fa865ddb26d902e0bf13f1e69257e2dfa --- .../android/quickstep/views/DesktopTaskView.kt | 18 ++++++++++++++++-- .../quickstep/views/RecentsViewUtils.kt | 5 ----- 2 files changed, 16 insertions(+), 7 deletions(-) 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.