diff --git a/quickstep/src/com/android/launcher3/statehandlers/DesktopVisibilityController.java b/quickstep/src/com/android/launcher3/statehandlers/DesktopVisibilityController.java index dc4441d6c4..ecf483caa4 100644 --- a/quickstep/src/com/android/launcher3/statehandlers/DesktopVisibilityController.java +++ b/quickstep/src/com/android/launcher3/statehandlers/DesktopVisibilityController.java @@ -27,6 +27,7 @@ import com.android.launcher3.Launcher; import com.android.launcher3.LauncherState; import com.android.launcher3.statemanager.StatefulActivity; import com.android.launcher3.uioverrides.QuickstepLauncher; +import com.android.quickstep.GestureState; import com.android.quickstep.SystemUiProxy; import com.android.quickstep.views.DesktopAppSelectView; import com.android.wm.shell.desktopmode.IDesktopTaskListener; @@ -170,20 +171,40 @@ public class DesktopVisibilityController { /** * Whether recents gesture is currently in progress. */ - public boolean isGestureInProgress() { + public boolean isRecentsGestureInProgress() { return mGestureInProgress; } /** - * Sets whether recents gesture is in progress. + * Notify controller that recents gesture has started. */ - public void setGestureInProgress(boolean gestureInProgress) { - if (DEBUG) { - Log.d(TAG, "setGestureInProgress: inProgress=" + gestureInProgress); - } + public void setRecentsGestureStart() { if (!isDesktopModeSupported()) { return; } + setRecentsGestureInProgress(true); + } + + /** + * Notify controller that recents gesture finished with the given + * {@link com.android.quickstep.GestureState.GestureEndTarget} + */ + public void setRecentsGestureEnd(@Nullable GestureState.GestureEndTarget endTarget) { + if (!isDesktopModeSupported()) { + return; + } + setRecentsGestureInProgress(false); + + if (endTarget == null) { + // Gesture did not result in a new end target. Ensure launchers gets paused again. + markLauncherPaused(); + } + } + + private void setRecentsGestureInProgress(boolean gestureInProgress) { + if (DEBUG) { + Log.d(TAG, "setGestureInProgress: inProgress=" + gestureInProgress); + } if (gestureInProgress != mGestureInProgress) { mGestureInProgress = gestureInProgress; } diff --git a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java index 1e1bff3340..20383f4971 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java +++ b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java @@ -867,7 +867,7 @@ public class QuickstepLauncher extends Launcher { if (DesktopTaskView.DESKTOP_MODE_SUPPORTED) { DesktopVisibilityController controller = mDesktopVisibilityController; if (controller != null && controller.areFreeformTasksVisible() - && !controller.isGestureInProgress()) { + && !controller.isRecentsGestureInProgress()) { // Return early to skip setting activity to appear as resumed // TODO(b/255649902): shouldn't be needed when we have a separate launcher state // for desktop that we can use to control other parts of launcher diff --git a/quickstep/src/com/android/quickstep/views/LauncherRecentsView.java b/quickstep/src/com/android/quickstep/views/LauncherRecentsView.java index 5e488cc66d..4f119c07bc 100644 --- a/quickstep/src/com/android/quickstep/views/LauncherRecentsView.java +++ b/quickstep/src/com/android/quickstep/views/LauncherRecentsView.java @@ -249,7 +249,7 @@ public class LauncherRecentsView extends RecentsView