From fe7319ec40899151099b631e84876c29dfc69bc9 Mon Sep 17 00:00:00 2001 From: Schneider Victor-tulias Date: Mon, 25 Mar 2024 12:47:00 -0400 Subject: [PATCH] Allow KQS to be reopened during the close animation for responsiveness Flag: LEGACY ENABLE_KEYBOARD_QUICK_SWITCH ENABLED Fixes: 327421402 Test: quickly quick switched during close animation Change-Id: I11dad62d11afd796aadf9b6165f0b4404f344311 --- .../taskbar/KeyboardQuickSwitchController.java | 6 +++++- .../taskbar/KeyboardQuickSwitchViewController.java | 10 +++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchController.java b/quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchController.java index 0bcf2d11f0..bed85d7bd9 100644 --- a/quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchController.java +++ b/quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchController.java @@ -97,7 +97,11 @@ public final class KeyboardQuickSwitchController implements private void openQuickSwitchView(int currentFocusedIndex) { if (mQuickSwitchViewController != null) { - return; + if (!mQuickSwitchViewController.isCloseAnimationRunning()) { + return; + } + // Allow the KQS to be reopened during the close animation to make it more responsive + closeQuickSwitchView(false); } TaskbarOverlayContext overlayContext = mControllers.taskbarOverlayController.requestWindow(); diff --git a/quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchViewController.java b/quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchViewController.java index 847088d784..69641a030e 100644 --- a/quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchViewController.java @@ -94,8 +94,12 @@ public class KeyboardQuickSwitchViewController { mViewCallbacks); } + boolean isCloseAnimationRunning() { + return mCloseAnimation != null; + } + protected void closeQuickSwitchView(boolean animate) { - if (mCloseAnimation != null) { + if (isCloseAnimationRunning()) { // Let currently-running animation finish. if (!animate) { mCloseAnimation.end(); @@ -130,7 +134,7 @@ public class KeyboardQuickSwitchViewController { } private int launchTaskAt(int index) { - if (mCloseAnimation != null) { + if (isCloseAnimationRunning()) { // Ignore taps on task views and alt key unpresses while the close animation is running. return -1; } @@ -186,7 +190,7 @@ public class KeyboardQuickSwitchViewController { pw.println(prefix + "KeyboardQuickSwitchViewController:"); pw.println(prefix + "\thasFocus=" + mKeyboardQuickSwitchView.hasFocus()); - pw.println(prefix + "\tcloseAnimationRunning=" + (mCloseAnimation != null)); + pw.println(prefix + "\tisCloseAnimationRunning=" + isCloseAnimationRunning()); pw.println(prefix + "\tmCurrentFocusIndex=" + mCurrentFocusIndex); }