Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 94bacb64 authored by Automerger Merge Worker's avatar Automerger Merge Worker
Browse files

Merge "Adds fling gesture suppression to Launcher" into rvc-dev am: 64673b03

Change-Id: Id6aaf1e9f4ec5709a97d7f295b43bdbab6d33541
parents 6b9d3c4a 64673b03
Loading
Loading
Loading
Loading
+11 −3
Original line number Diff line number Diff line
@@ -453,8 +453,11 @@ public class TouchInteractionService extends Service implements PluginListener<O
                // 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;
            }
@@ -494,7 +497,12 @@ public class TouchInteractionService extends Service implements PluginListener<O
        }
        if (mDeviceState.isFullyGesturalNavMode()) {
            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()) {
+10 −3
Original line number Diff line number Diff line
@@ -90,12 +90,18 @@ public class AssistantInputConsumer extends DelegateInputConsumer {
    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 @@ public class AssistantInputConsumer extends DelegateInputConsumer {
    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) {
+5 −0
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import static android.content.Intent.ACTION_PACKAGE_REMOVED;

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 @@ public final class OverviewComponentObserver {
        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.