Merge "Prevent tap in swipe up zone from closing KQS" into main

This commit is contained in:
Treehugger Robot
2024-10-29 01:57:55 +00:00
committed by Android (Google) Code Review
5 changed files with 30 additions and 8 deletions
@@ -70,6 +70,8 @@ public class KeyboardQuickSwitchViewController {
private boolean mOnDesktop;
private boolean mWasDesktopTaskFilteredOut;
private boolean mDetachingFromWindow = false;
protected KeyboardQuickSwitchViewController(
@NonNull TaskbarControllers controllers,
@NonNull TaskbarOverlayContext overlayContext,
@@ -237,7 +239,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);
}
@@ -327,5 +334,11 @@ public class KeyboardQuickSwitchViewController {
boolean isAspectRatioSquare() {
return mControllerCallbacks.isAspectRatioSquare();
}
void onViewDetchedFromWindow() {
mDetachingFromWindow = true;
closeQuickSwitchView(false);
mDetachingFromWindow = false;
}
}
}