Don't cancel or commit predictive back on multi touch in 3-button-nav
Bug: 381054861
Test: Manual, i.e. verify that tapping the taskbar while predictive back is in progress does not cancel or commit it
Flag: com.android.window.flags.predictive_back_three_button_nav
Change-Id: I4117aca74216849519a0cabcbd3cb14f7fc5b38f
diff --git a/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java b/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java
index cb4e5e2..9ee4b95 100644
--- a/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java
@@ -866,13 +866,19 @@
TaskbarNavButtonController navButtonController) {
final RectF rect = new RectF();
buttonView.setOnTouchListener((v, event) -> {
- if (event.getAction() == MotionEvent.ACTION_DOWN) {
+ int motionEventAction = event.getAction();
+ if (motionEventAction == MotionEvent.ACTION_DOWN) {
rect.set(0, 0, v.getWidth(), v.getHeight());
}
- boolean isCancelled = event.getAction() == MotionEvent.ACTION_CANCEL
- || !rect.contains(event.getX(), event.getY());
- if (event.getAction() == MotionEvent.ACTION_MOVE && !isCancelled) return false;
- int motionEventAction = event.getAction();
+ boolean isCancelled = motionEventAction == MotionEvent.ACTION_CANCEL
+ || (!rect.contains(event.getX(), event.getY())
+ && (motionEventAction == MotionEvent.ACTION_MOVE
+ || motionEventAction == MotionEvent.ACTION_UP));
+ if (motionEventAction != MotionEvent.ACTION_DOWN
+ && motionEventAction != MotionEvent.ACTION_UP && !isCancelled) {
+ // return early. we don't care about any other cases than DOWN, UP and CANCEL
+ return false;
+ }
int keyEventAction = motionEventAction == MotionEvent.ACTION_DOWN
? KeyEvent.ACTION_DOWN : ACTION_UP;
navButtonController.sendBackKeyEvent(keyEventAction, isCancelled);