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

Commit 95108f8c authored by Sunny Goyal's avatar Sunny Goyal Committed by android-build-merger
Browse files

Merge "Using correct slop for checking quickstep gesture" into qt-dev am: 6f72636b

am: f3ede326

Change-Id: I19ee39208dabcc54fe1ca38d619643cb020fb552
parents fb4642f7 f3ede326
Loading
Loading
Loading
Loading
+14 −0
Original line number Original line 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 static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL;


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


import com.android.internal.policy.ScreenDecorationsUtils;
import com.android.internal.policy.ScreenDecorationsUtils;
@@ -100,6 +102,18 @@ public class QuickStepContract {
        return str.toString();
        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
     * 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
     * home button press/long press over are ignored and will start to drag when exceeded and the
+2 −7
Original line number Original line Diff line number Diff line
@@ -249,13 +249,8 @@ public class KeyButtonView extends ImageView implements ButtonInterface {
                x = (int)ev.getRawX();
                x = (int)ev.getRawX();
                y = (int)ev.getRawY();
                y = (int)ev.getRawY();


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