From 8f7d2b0dfd4aa0ab060b6e0be893eee136e5f2a4 Mon Sep 17 00:00:00 2001 From: Adam Cohen Date: Tue, 21 May 2019 15:45:43 -0700 Subject: [PATCH] Fix issue where Assistant could be invoked at the same time as all apps issue 132366412 -> First, we shouldn't accept flings when the delegate has intercepted. This prevents any situation where both are triggered. -> Modified the slop to be the standard 8dp. This acts as a standalone fix because it means that there are no situations where we cross all apps slop before assistant slop. ie. in a purely vertical gesture from the corner, without this change, it's possible to trigger all apps instead of Assistant. Change-Id: I39e3d8a525e165024399d9802d4cc1d7ae329ee6 --- .../quickstep/inputconsumers/AssistantTouchConsumer.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/AssistantTouchConsumer.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/AssistantTouchConsumer.java index 2ff5e23865..bf276e1e16 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/AssistantTouchConsumer.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/AssistantTouchConsumer.java @@ -41,6 +41,7 @@ import android.os.SystemClock; import android.util.Log; import android.view.HapticFeedbackConstants; import android.view.MotionEvent; +import android.view.ViewConfiguration; import com.android.launcher3.BaseDraggingActivity; import com.android.launcher3.R; @@ -97,7 +98,9 @@ public class AssistantTouchConsumer extends DelegateInputConsumer mDistThreshold = res.getDimension(R.dimen.gestures_assistant_drag_threshold); mTimeThreshold = res.getInteger(R.integer.assistant_gesture_min_time_threshold); mAngleThreshold = res.getInteger(R.integer.assistant_gesture_corner_deg_threshold); - float slop = QuickStepContract.getQuickStepDragSlopPx(); + + float slop = ViewConfiguration.get(context).getScaledTouchSlop(); + mSquaredSlop = slop * slop; mActivityControlHelper = activityControlHelper; mSwipeDetector = new SwipeDetector(mContext, this, SwipeDetector.VERTICAL); @@ -273,7 +276,7 @@ public class AssistantTouchConsumer extends DelegateInputConsumer @Override public void onDragEnd(float velocity, boolean fling) { - if (fling && !mLaunchedAssistant) { + if (fling && !mLaunchedAssistant && mState != STATE_DELEGATE_ACTIVE) { mLastProgress = 1; try { mSysUiProxy.onAssistantGestureCompletion(velocity);