diff --git a/quickstep/src/com/android/quickstep/inputconsumers/NavHandleLongPressInputConsumer.java b/quickstep/src/com/android/quickstep/inputconsumers/NavHandleLongPressInputConsumer.java index ed4f7b85bd..07c85bbbf6 100644 --- a/quickstep/src/com/android/quickstep/inputconsumers/NavHandleLongPressInputConsumer.java +++ b/quickstep/src/com/android/quickstep/inputconsumers/NavHandleLongPressInputConsumer.java @@ -67,6 +67,18 @@ public class NavHandleLongPressInputConsumer extends DelegateInputConsumer { @Override public void onMotionEvent(MotionEvent ev) { + if (mDelegate.allowInterceptByParent()) { + handleMotionEvent(ev); + } else if (MAIN_EXECUTOR.getHandler().hasCallbacks(mTriggerLongPress)) { + cancelLongPress(); + } + + if (mState != STATE_ACTIVE) { + mDelegate.onMotionEvent(ev); + } + } + + private void handleMotionEvent(MotionEvent ev) { switch (ev.getAction()) { case MotionEvent.ACTION_DOWN -> { if (mCurrentDownEvent != null) { @@ -101,10 +113,6 @@ public class NavHandleLongPressInputConsumer extends DelegateInputConsumer { MAIN_EXECUTOR.getHandler().removeCallbacks(mTriggerLongPress); MAIN_EXECUTOR.getHandler().post(mTriggerLongPress); } - - if (mState != STATE_ACTIVE) { - mDelegate.onMotionEvent(ev); - } } private void triggerLongPress() {