From 7d72bcd46e36558bf838a815bf0eac7b45161fdd Mon Sep 17 00:00:00 2001 From: Ats Jenk Date: Fri, 28 Jul 2023 17:33:00 -0700 Subject: [PATCH] Fix tap on navbar handle when on desktop Tapping on navbar handle was hiding the stashed taskbar handle. When tappin on navbar handle, it starts the recents animation. Which gets cancelled. Normally, the fullscreen app being visible, it means launcher activity will be paused after. But when on desktop, launcher is visible in the background and we need to manually set it to paused state. When recents gesture is cancelled after navbar handle tap, the gesture end state is null. Detect this in DesktopVisibiltyController and mark launcher as paused in this case. Bug: 286140120 Flag: persist.wm.debug.desktop_mode_2 Test: open an app on desktop, tap on navbar, observe that user remains on desktop Change-Id: Iee915026265721d42a0b722d6b1595521f20a59a --- .../DesktopVisibilityController.java | 33 +++++++++++++++---- .../uioverrides/QuickstepLauncher.java | 2 +- .../quickstep/views/LauncherRecentsView.java | 8 +++-- 3 files changed, 33 insertions(+), 10 deletions(-) diff --git a/quickstep/src/com/android/launcher3/statehandlers/DesktopVisibilityController.java b/quickstep/src/com/android/launcher3/statehandlers/DesktopVisibilityController.java index 7283a184d7..719fdc9755 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; @@ -166,20 +167,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 ffd22b89e2..c41dee5fff 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java +++ b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java @@ -865,7 +865,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 80e5a54b8d..c4407182ba 100644 --- a/quickstep/src/com/android/quickstep/views/LauncherRecentsView.java +++ b/quickstep/src/com/android/quickstep/views/LauncherRecentsView.java @@ -242,7 +242,7 @@ public class LauncherRecentsView extends RecentsView