Adds fling gesture suppression to Launcher
Test: Tested locally
BUG: 150688842
Change-Id: Ifa96bd01363de47cf1d8cdce34d81d525c8c2c04
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java
index 0f63336..13a85f6 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java
@@ -466,8 +466,11 @@
// Do not change mConsumer as if there is an ongoing QuickSwitch gesture, we should
// not interrupt it. QuickSwitch assumes that interruption can only happen if the
// next gesture is also quick switch.
- mUncheckedConsumer = new AssistantInputConsumer(this, newGestureState,
- InputConsumer.NO_OP, mInputMonitorCompat);
+ mUncheckedConsumer = new AssistantInputConsumer(
+ this,
+ newGestureState,
+ InputConsumer.NO_OP, mInputMonitorCompat,
+ mOverviewComponentObserver.assistantGestureIsConstrained());
} else {
mUncheckedConsumer = InputConsumer.NO_OP;
}
@@ -505,7 +508,12 @@
if (mDeviceState.isFullyGesturalNavMode()) {
handleOrientationSetup(base);
if (mDeviceState.canTriggerAssistantAction(event)) {
- base = new AssistantInputConsumer(this, newGestureState, base, mInputMonitorCompat);
+ base = new AssistantInputConsumer(
+ this,
+ newGestureState,
+ base,
+ mInputMonitorCompat,
+ mOverviewComponentObserver.assistantGestureIsConstrained());
}
if (FeatureFlags.ENABLE_QUICK_CAPTURE_GESTURE.get()) {
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/AssistantInputConsumer.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/AssistantInputConsumer.java
index 94126ff..89e6931 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/AssistantInputConsumer.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/AssistantInputConsumer.java
@@ -90,12 +90,18 @@
private final float mSquaredSlop;
private final Context mContext;
private final GestureDetector mGestureDetector;
+ private final boolean mIsAssistGestureConstrained;
- public AssistantInputConsumer(Context context, GestureState gestureState,
- InputConsumer delegate, InputMonitorCompat inputMonitor) {
+ public AssistantInputConsumer(
+ Context context,
+ GestureState gestureState,
+ InputConsumer delegate,
+ InputMonitorCompat inputMonitor,
+ boolean isAssistGestureConstrained) {
super(delegate, inputMonitor);
final Resources res = context.getResources();
mContext = context;
+ mIsAssistGestureConstrained = isAssistGestureConstrained;
mDragDistThreshold = res.getDimension(R.dimen.gestures_assistant_drag_threshold);
mFlingDistThreshold = res.getDimension(R.dimen.gestures_assistant_fling_threshold);
mTimeThreshold = res.getInteger(R.integer.assistant_gesture_min_time_threshold);
@@ -258,7 +264,8 @@
private class AssistantGestureListener extends SimpleOnGestureListener {
@Override
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
- if (isValidAssistantGestureAngle(velocityX, -velocityY)
+ if (!mIsAssistGestureConstrained
+ && isValidAssistantGestureAngle(velocityX, -velocityY)
&& mDistance >= mFlingDistThreshold
&& !mLaunchedAssistant
&& mState != STATE_DELEGATE_ACTIVE) {
diff --git a/quickstep/src/com/android/quickstep/OverviewComponentObserver.java b/quickstep/src/com/android/quickstep/OverviewComponentObserver.java
index 866836e..9edc86e 100644
--- a/quickstep/src/com/android/quickstep/OverviewComponentObserver.java
+++ b/quickstep/src/com/android/quickstep/OverviewComponentObserver.java
@@ -22,6 +22,7 @@
import static com.android.launcher3.util.PackageManagerHelper.getPackageFilter;
import static com.android.systemui.shared.system.PackageManagerWrapper.ACTION_PREFERRED_ACTIVITY_CHANGED;
+import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_ASSIST_GESTURE_CONSTRAINED;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
@@ -104,6 +105,10 @@
updateOverviewTargets();
}
+ public boolean assistantGestureIsConstrained() {
+ return (mDeviceState.getSystemUiStateFlags() & SYSUI_STATE_ASSIST_GESTURE_CONSTRAINED) != 0;
+ }
+
/**
* Update overview intent and {@link BaseActivityInterface} based off the current launcher home
* component.