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

Commit d013ed92 authored by Selim Cinek's avatar Selim Cinek Committed by The Android Automerger
Browse files

Increased the falsing threshold when woken up by touch

Bug: 17649103
Change-Id: Iea4736a761a1108e7832aa62cc2060ea0bd89376
parent 6de4dd70
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -412,7 +412,7 @@ public class SwipeHelper implements Gefingerpoken {
                if (mCurrView != null) {
                    float delta = getPos(ev) - mInitialTouchPos;
                    float absDelta = Math.abs(delta);
                    if (absDelta >= mFalsingThreshold) {
                    if (absDelta >= getFalsingThreshold()) {
                        mTouchAboveFalsingThreshold = true;
                    }
                    // don't let items that can't be dismissed be dragged more than
@@ -466,6 +466,11 @@ public class SwipeHelper implements Gefingerpoken {
        return true;
    }

    private int getFalsingThreshold() {
        float factor = mCallback.getFalsingThresholdFactor();
        return (int) (mFalsingThreshold * factor);
    }

    public interface Callback {
        View getChildAtPosition(MotionEvent ev);

@@ -489,6 +494,11 @@ public class SwipeHelper implements Gefingerpoken {
         * @return if true, prevents the default alpha fading.
         */
        boolean updateSwipeProgress(View animView, boolean dismissable, float swipeProgress);

        /**
         * @return The factor the falsing threshold should be multiplied with
         */
        float getFalsingThresholdFactor();
    }

    /**
+5 −0
Original line number Diff line number Diff line
@@ -196,6 +196,11 @@ public class RecentsHorizontalScrollView extends HorizontalScrollView
        return false;
    }

    @Override
    public float getFalsingThresholdFactor() {
        return 1.0f;
    }

    public void dismissChild(View v) {
        mSwipeHelper.dismissChild(v, 0);
    }
+5 −0
Original line number Diff line number Diff line
@@ -204,6 +204,11 @@ public class RecentsVerticalScrollView extends ScrollView
        return false;
    }

    @Override
    public float getFalsingThresholdFactor() {
        return 1.0f;
    }

    public void dismissChild(View v) {
        mSwipeHelper.dismissChild(v, 0);
    }
+13 −4
Original line number Diff line number Diff line
@@ -303,8 +303,12 @@ public class KeyguardAffordanceHelper {
    }

    private boolean isBelowFalsingThreshold() {
        return Math.abs(mTranslation) < Math.abs(mTranslationOnDown)
                + mMinTranslationAmount;
        return Math.abs(mTranslation) < Math.abs(mTranslationOnDown) + getMinTranslationAmount();
    }

    private int getMinTranslationAmount() {
        float factor = mCallback.getAffordanceFalsingFactor();
        return (int) (mMinTranslationAmount * factor);
    }

    private void fling(float vel, final boolean snapBack) {
@@ -339,14 +343,14 @@ public class KeyguardAffordanceHelper {
        translation = rightSwipePossible() ? translation : Math.max(0, translation);
        translation = leftSwipePossible() ? translation : Math.min(0, translation);
        float absTranslation = Math.abs(translation);
        if (absTranslation > Math.abs(mTranslationOnDown) + mMinTranslationAmount ||
        if (absTranslation > Math.abs(mTranslationOnDown) + getMinTranslationAmount() ||
                mMotionPerformedByUser) {
            mMotionPerformedByUser = true;
        }
        if (translation != mTranslation || isReset) {
            KeyguardAffordanceView targetView = translation > 0 ? mLeftIcon : mRightIcon;
            KeyguardAffordanceView otherView = translation > 0 ? mRightIcon : mLeftIcon;
            float alpha = absTranslation / mMinTranslationAmount;
            float alpha = absTranslation / getMinTranslationAmount();

            // We interpolate the alpha of the other icons to 0
            float fadeOutAlpha = SWIPE_RESTING_ALPHA_AMOUNT * (1.0f - alpha);
@@ -482,5 +486,10 @@ public class KeyguardAffordanceHelper {
        View getLeftPreview();

        View getRightPreview();

        /**
         * @return The factor the minimum swipe amount should be multiplied with.
         */
        float getAffordanceFalsingFactor();
    }
}
+11 −1
Original line number Diff line number Diff line
@@ -706,7 +706,7 @@ public class NotificationPanelView extends PanelView implements
            case MotionEvent.ACTION_MOVE:
                final float h = y - mInitialTouchY;
                setQsExpansion(h + mInitialHeightOnTouch);
                if (h >= mQsFalsingThreshold) {
                if (h >= getFalsingThreshold()) {
                    mQsTouchAboveFalsingThreshold = true;
                }
                trackMovement(event);
@@ -732,6 +732,11 @@ public class NotificationPanelView extends PanelView implements
        }
    }

    private int getFalsingThreshold() {
        float factor = mStatusBar.isScreenOnComingFromTouch() ? 1.5f : 1.0f;
        return (int) (mQsFalsingThreshold * factor);
    }

    @Override
    public void onOverscrolled(float lastTouchX, float lastTouchY, int amount) {
        if (mIntercepting && shouldQuickSettingsIntercept(lastTouchX, lastTouchY,
@@ -1632,6 +1637,11 @@ public class NotificationPanelView extends PanelView implements
                : mKeyguardBottomArea.getCameraPreview();
    }

    @Override
    public float getAffordanceFalsingFactor() {
        return mStatusBar.isScreenOnComingFromTouch() ? 1.5f : 1.0f;
    }

    @Override
    protected float getPeekHeight() {
        if (mNotificationStackScroller.getNotGoneChildCount() > 0) {
Loading