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

Commit 6f72636b authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Using correct slop for checking quickstep gesture" into qt-dev

parents 8a1174bc c55bac63
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -21,7 +21,9 @@ import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_3BUTTON;
import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL;

import android.annotation.IntDef;
import android.content.Context;
import android.content.res.Resources;
import android.view.ViewConfiguration;
import android.view.WindowManagerPolicyConstants;

import com.android.internal.policy.ScreenDecorationsUtils;
@@ -100,6 +102,18 @@ public class QuickStepContract {
        return str.toString();
    }

    /**
     * Ratio of quickstep touch slop (when system takes over the touch) to view touch slop
     */
    public static final float QUICKSTEP_TOUCH_SLOP_RATIO = 3;

    /**
     * Touch slop for quickstep gesture
     */
    public static final float getQuickStepTouchSlopPx(Context context) {
        return QUICKSTEP_TOUCH_SLOP_RATIO * ViewConfiguration.get(context).getScaledTouchSlop();
    }

    /**
     * Touch slopes and thresholds for quick step operations. Drag slop is the point where the
     * home button press/long press over are ignored and will start to drag when exceeded and the
+2 −7
Original line number Diff line number Diff line
@@ -249,13 +249,8 @@ public class KeyButtonView extends ImageView implements ButtonInterface {
                x = (int)ev.getRawX();
                y = (int)ev.getRawY();

                boolean exceededTouchSlopX = Math.abs(x - mTouchDownX) > (mIsVertical
                        ? QuickStepContract.getQuickScrubTouchSlopPx()
                        : QuickStepContract.getQuickStepTouchSlopPx());
                boolean exceededTouchSlopY = Math.abs(y - mTouchDownY) > (mIsVertical
                        ? QuickStepContract.getQuickStepTouchSlopPx()
                        : QuickStepContract.getQuickScrubTouchSlopPx());
                if (exceededTouchSlopX || exceededTouchSlopY) {
                float slop = QuickStepContract.getQuickStepTouchSlopPx(getContext());
                if (Math.abs(x - mTouchDownX) > slop || Math.abs(y - mTouchDownY) > slop) {
                    // When quick step is enabled, prevent animating the ripple triggered by
                    // setPressed and decide to run it on touch up
                    setPressed(false);