From 9b97217ffb99f06ae668cdce63edc329ee733000 Mon Sep 17 00:00:00 2001 From: Winson Chung Date: Thu, 2 Nov 2023 22:46:23 +0000 Subject: [PATCH] Handle long press directly if recents transition is deferred - For 3p launchers, the starting of the home activity is deferred until the user moves past a slop, in these cases we don't need to worry about finishing the recents transition before handling long press (since it was never started) Fixes: 307254136 Test: Enable 3p launcher and invoke omni Change-Id: I0aed7e7d442e010c38979e3f806f6cf0eb33cfe8 --- .../inputconsumers/NavHandleLongPressInputConsumer.java | 2 +- .../inputconsumers/OtherActivityInputConsumer.java | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/quickstep/src/com/android/quickstep/inputconsumers/NavHandleLongPressInputConsumer.java b/quickstep/src/com/android/quickstep/inputconsumers/NavHandleLongPressInputConsumer.java index 32f7bd535c..efa84d3b5d 100644 --- a/quickstep/src/com/android/quickstep/inputconsumers/NavHandleLongPressInputConsumer.java +++ b/quickstep/src/com/android/quickstep/inputconsumers/NavHandleLongPressInputConsumer.java @@ -114,7 +114,7 @@ public class NavHandleLongPressInputConsumer extends DelegateInputConsumer { if (longPressRunnable != null) { OtherActivityInputConsumer oaic = getInputConsumerOfClass( OtherActivityInputConsumer.class); - if (oaic != null) { + if (oaic != null && oaic.hasStartedTouchTracking()) { oaic.setForceFinishRecentsTransitionCallback(longPressRunnable); setActive(mCurrentDownEvent); } else { diff --git a/quickstep/src/com/android/quickstep/inputconsumers/OtherActivityInputConsumer.java b/quickstep/src/com/android/quickstep/inputconsumers/OtherActivityInputConsumer.java index e724547d3e..eedd20485b 100644 --- a/quickstep/src/com/android/quickstep/inputconsumers/OtherActivityInputConsumer.java +++ b/quickstep/src/com/android/quickstep/inputconsumers/OtherActivityInputConsumer.java @@ -412,6 +412,14 @@ public class OtherActivityInputConsumer extends ContextWrapper implements InputC } } + /** + * Returns whether this input consumer has started touch tracking (if touch tracking is not + * deferred). + */ + public boolean hasStartedTouchTracking() { + return mInteractionHandler != null; + } + /** * Called when the gesture has ended. Does not correlate to the completion of the interaction as * the animation can still be running.