Prevent tap in swipe up zone from closing KQS
Tap down action in swipe up start zone may or may not be start of a navigation gesture - for example, it may be start of a tab on an icon in the task bar. If the user taps on the taskbar overflow button, closing the KQS on tap down produces unintended behavior (KQS is closed on tap down, and reopened on tap up). Additionally, this produces inconsistent behavior in response to app icon taps depending on whether gesture navigation is enabled or not. Instead, close KQS as part of `hideOverlayWindow()`, which gets called when a swipe gesture actually starts (note that KQS is added to the overlay's drag layer). Additionally, make sure that KeyboardQuickSwitchController state is reset if KeyboardQuickSwitchView gets detached from UI due to the taskbar overlay getting hidden (e.g. in response to home button). Without this, in certain situations, KQS may get hidden with the controller thinking the UI is still shown - in case the user releases the Alt + Tab key combination in this state, the shortcut would end up getting handled, and switch to the next task. Bug: 368119679 Test: Press and hold Alt+Tab (while an app is open). After KQS is open, Swipe up to transition to overflow, or home screen - KQS gets hidden. Releasing Alt+Tab is no-op. Test: Press and hold Alt+Tab (while an app is open) with three button navigation enabled. Press home button. KQS gets hidden. Releasting Alt+Tab is no-op. Test: Press and hold Alt+Tab. After KQS is open, open an app from task bar (either transient or persistent), or all apps list. KQS gets closed, Releasing Alt+Tab is no-op. Flag: EXEMPT bugfix Change-Id: I8b561db3c6ec8a9c7de93e330faf8e3e4d3c8f4e
This commit is contained in:
@@ -68,6 +68,8 @@ public class KeyboardQuickSwitchViewController {
|
||||
private boolean mOnDesktop;
|
||||
private boolean mWasDesktopTaskFilteredOut;
|
||||
|
||||
private boolean mDetachingFromWindow = false;
|
||||
|
||||
protected KeyboardQuickSwitchViewController(
|
||||
@NonNull TaskbarControllers controllers,
|
||||
@NonNull TaskbarOverlayContext overlayContext,
|
||||
@@ -229,7 +231,12 @@ public class KeyboardQuickSwitchViewController {
|
||||
|
||||
private void onCloseComplete() {
|
||||
mCloseAnimation = null;
|
||||
mOverlayContext.getDragLayer().removeView(mKeyboardQuickSwitchView);
|
||||
// Reset the view callbacks to prevent `onDetachedFromWindow` getting called in response to
|
||||
// the `removeView(mKeyboardQuickSwitchView)` call.
|
||||
mKeyboardQuickSwitchView.resetViewCallbacks();
|
||||
if (!mDetachingFromWindow) {
|
||||
mOverlayContext.getDragLayer().removeView(mKeyboardQuickSwitchView);
|
||||
}
|
||||
mControllerCallbacks.onCloseComplete();
|
||||
InteractionJankMonitorWrapper.end(Cuj.CUJ_LAUNCHER_KEYBOARD_QUICK_SWITCH_CLOSE);
|
||||
}
|
||||
@@ -319,5 +326,11 @@ public class KeyboardQuickSwitchViewController {
|
||||
boolean isAspectRatioSquare() {
|
||||
return mControllerCallbacks.isAspectRatioSquare();
|
||||
}
|
||||
|
||||
void onViewDetchedFromWindow() {
|
||||
mDetachingFromWindow = true;
|
||||
closeQuickSwitchView(false);
|
||||
mDetachingFromWindow = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user