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

Commit 9dc9d4fb authored by Aaron Heuckroth's avatar Aaron Heuckroth
Browse files

Fix regression where drag down could start during swipe.

Test: Automated tests pass, manual testing for swipe behavior on lockscreen.

Change-Id: Id9c9b9ccb9102bbdaa9a9ebe76b96beb4060933b
Fixes: 118786971
parent d27f6b3f
Loading
Loading
Loading
Loading
+0 −9
Original line number Diff line number Diff line
@@ -88,8 +88,6 @@ public class SwipeHelper implements Gefingerpoken {
    private Runnable mWatchLongPress;
    private final long mLongPressTimeout;

    protected boolean mSwipingInProgress;

    final private int[] mTmpPos = new int[2];
    private final int mFalsingThreshold;
    private boolean mTouchAboveFalsingThreshold;
@@ -130,10 +128,6 @@ public class SwipeHelper implements Gefingerpoken {
        mDisableHwLayers = disableHwLayers;
    }

    public boolean isSwipingInProgress() {
        return mSwipingInProgress;
    }

    private float getPos(MotionEvent ev) {
        return mSwipeDirection == X ? ev.getX() : ev.getY();
    }
@@ -325,7 +319,6 @@ public class SwipeHelper implements Gefingerpoken {
                    if (Math.abs(delta) > mPagingTouchSlop
                            && Math.abs(delta) > Math.abs(deltaPerpendicular)) {
                        if (mCallback.canChildBeDragged(mCurrView)) {
                            mSwipingInProgress = true;
                            mCallback.onBeginDrag(mCurrView);
                            mDragging = true;
                            mInitialTouchPos = getPos(ev);
@@ -445,7 +438,6 @@ public class SwipeHelper implements Gefingerpoken {
                    wasRemoved = row.isRemoved();
                }
                if (!mCancelled || wasRemoved) {
                    mSwipingInProgress = false;
                    mCallback.onChildDismissed(animView);
                }
                if (endAction != null) {
@@ -637,7 +629,6 @@ public class SwipeHelper implements Gefingerpoken {
                                !swipedFastEnough() /* useAccelerateInterpolator */);
                    } else {
                        // snappity
                        mSwipingInProgress = false;
                        mCallback.onDragCancelled(mCurrView);
                        snapChild(mCurrView, 0 /* leftTarget */, velocity);
                    }
+16 −3
Original line number Diff line number Diff line
@@ -404,6 +404,8 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
     */
    private float mBackgroundXFactor = 1f;

    private boolean mSwipingInProgress;

    private boolean mUsingLightTheme;
    private boolean mQsExpanded;
    private boolean mForwardScrollable;
@@ -3175,7 +3177,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
                || ev.getActionMasked() == MotionEvent.ACTION_UP;
        handleEmptySpaceClick(ev);
        boolean expandWantsIt = false;
        boolean swipingInProgress = mSwipeHelper.isSwipingInProgress();
        boolean swipingInProgress = mSwipingInProgress;
        if (mIsExpanded && !swipingInProgress && !mOnlyScrollingInThisMotion) {
            if (isCancelOrUp) {
                mExpandHelper.onlyObserveMovements(false);
@@ -3230,7 +3232,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
    @Override
    @ShadeViewRefactor(RefactorComponent.INPUT)
    public boolean onGenericMotionEvent(MotionEvent event) {
        if (!isScrollingEnabled() || !mIsExpanded || mSwipeHelper.isSwipingInProgress() || mExpandingNotification
        if (!isScrollingEnabled() || !mIsExpanded || mSwipingInProgress || mExpandingNotification
                || mDisallowScrollingInThisMotion) {
            return false;
        }
@@ -3457,7 +3459,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
        initDownStates(ev);
        handleEmptySpaceClick(ev);
        boolean expandWantsIt = false;
        boolean swipingInProgress = mSwipeHelper.isSwipingInProgress();
        boolean swipingInProgress = mSwipingInProgress;
        if (!swipingInProgress && !mOnlyScrollingInThisMotion) {
            expandWantsIt = mExpandHelper.onInterceptTouchEvent(ev);
        }
@@ -3736,6 +3738,14 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
        }
    }

    @ShadeViewRefactor(RefactorComponent.INPUT)
    private void setSwipingInProgress(boolean swiping) {
        mSwipingInProgress = swiping;
        if (swiping) {
            requestDisallowInterceptTouchEvent(true);
        }
    }

    @Override
    @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
    public void onWindowFocusChanged(boolean hasWindowFocus) {
@@ -5502,6 +5512,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd

        @Override
        public void onDragCancelled(View v) {
            setSwipingInProgress(false);
            mFalsingManager.onNotificatonStopDismissing();
        }

@@ -5529,6 +5540,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
         */

        public void handleChildViewDismissed(View view) {
            setSwipingInProgress(false);
            if (mDismissAllInProgress) {
                return;
            }
@@ -5597,6 +5609,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
        @Override
        public void onBeginDrag(View v) {
            mFalsingManager.onNotificatonStartDismissing();
            setSwipingInProgress(true);
            mAmbientState.onBeginDrag(v);
            updateContinuousShadowDrawing();
            if (mAnimationsEnabled && (mIsExpanded || !isPinnedHeadsUp(v))) {
+0 −3
Original line number Diff line number Diff line
@@ -227,7 +227,6 @@ class NotificationSwipeHelper extends SwipeHelper
        if (mCallback.isExpanded()) {
            // We don't want to quick-dismiss when it's a heads up as this might lead to closing
            // of the panel early.
            mSwipingInProgress = false;
            mCallback.handleChildViewDismissed(view);
        }
        mCallback.onDismiss();
@@ -247,7 +246,6 @@ class NotificationSwipeHelper extends SwipeHelper
    @Override
    public void snapChild(final View animView, final float targetLeft, float velocity) {
        superSnapChild(animView, targetLeft, velocity);
        mSwipingInProgress = false;
        mCallback.onDragCancelled(animView);
        if (targetLeft == 0) {
            handleMenuCoveredOrDismissed();
@@ -354,7 +352,6 @@ class NotificationSwipeHelper extends SwipeHelper

    public void onMenuShown(View animView) {
        setExposedMenuView(getTranslatingParentView());
        mSwipingInProgress = false;
        mCallback.onDragCancelled(animView);
        Handler handler = getHandler();