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

Commit ac8d4232 authored by Aaron Heuckroth's avatar Aaron Heuckroth Committed by Android (Google) Code Review
Browse files

Merge "Fix regression where drag down could start during swipe."

parents 25827471 9dc9d4fb
Loading
Loading
Loading
Loading
+0 −9
Original line number Original line Diff line number Diff line
@@ -88,8 +88,6 @@ public class SwipeHelper implements Gefingerpoken {
    private Runnable mWatchLongPress;
    private Runnable mWatchLongPress;
    private final long mLongPressTimeout;
    private final long mLongPressTimeout;


    protected boolean mSwipingInProgress;

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


    public boolean isSwipingInProgress() {
        return mSwipingInProgress;
    }

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


    private boolean mSwipingInProgress;

    private boolean mUsingLightTheme;
    private boolean mUsingLightTheme;
    private boolean mQsExpanded;
    private boolean mQsExpanded;
    private boolean mForwardScrollable;
    private boolean mForwardScrollable;
@@ -3286,7 +3288,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
                || ev.getActionMasked() == MotionEvent.ACTION_UP;
                || ev.getActionMasked() == MotionEvent.ACTION_UP;
        handleEmptySpaceClick(ev);
        handleEmptySpaceClick(ev);
        boolean expandWantsIt = false;
        boolean expandWantsIt = false;
        boolean swipingInProgress = mSwipeHelper.isSwipingInProgress();
        boolean swipingInProgress = mSwipingInProgress;
        if (mIsExpanded && !swipingInProgress && !mOnlyScrollingInThisMotion) {
        if (mIsExpanded && !swipingInProgress && !mOnlyScrollingInThisMotion) {
            if (isCancelOrUp) {
            if (isCancelOrUp) {
                mExpandHelper.onlyObserveMovements(false);
                mExpandHelper.onlyObserveMovements(false);
@@ -3341,7 +3343,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
    @Override
    @Override
    @ShadeViewRefactor(RefactorComponent.INPUT)
    @ShadeViewRefactor(RefactorComponent.INPUT)
    public boolean onGenericMotionEvent(MotionEvent event) {
    public boolean onGenericMotionEvent(MotionEvent event) {
        if (!isScrollingEnabled() || !mIsExpanded || mSwipeHelper.isSwipingInProgress() || mExpandingNotification
        if (!isScrollingEnabled() || !mIsExpanded || mSwipingInProgress || mExpandingNotification
                || mDisallowScrollingInThisMotion) {
                || mDisallowScrollingInThisMotion) {
            return false;
            return false;
        }
        }
@@ -3568,7 +3570,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
        initDownStates(ev);
        initDownStates(ev);
        handleEmptySpaceClick(ev);
        handleEmptySpaceClick(ev);
        boolean expandWantsIt = false;
        boolean expandWantsIt = false;
        boolean swipingInProgress = mSwipeHelper.isSwipingInProgress();
        boolean swipingInProgress = mSwipingInProgress;
        if (!swipingInProgress && !mOnlyScrollingInThisMotion) {
        if (!swipingInProgress && !mOnlyScrollingInThisMotion) {
            expandWantsIt = mExpandHelper.onInterceptTouchEvent(ev);
            expandWantsIt = mExpandHelper.onInterceptTouchEvent(ev);
        }
        }
@@ -3847,6 +3849,14 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
        }
        }
    }
    }


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

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


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


@@ -5669,6 +5680,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
         */
         */


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


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