diff options
| author | 2018-11-16 15:46:10 +0000 | |
|---|---|---|
| committer | 2018-11-16 15:46:10 +0000 | |
| commit | ac8d4232c94edb155b55e8e28ce7a970600cdd08 (patch) | |
| tree | 5b3765df5938579fac28bbef867bea7c640df936 | |
| parent | 258274714d2f5abbe9ce385d0330118629c4ac3f (diff) | |
| parent | 9dc9d4fbecb69b62600fbe1ee475f28307d7e48c (diff) | |
Merge "Fix regression where drag down could start during swipe."
3 files changed, 16 insertions, 15 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/SwipeHelper.java b/packages/SystemUI/src/com/android/systemui/SwipeHelper.java index e3584cf7493e..36664004a4a6 100644 --- a/packages/SystemUI/src/com/android/systemui/SwipeHelper.java +++ b/packages/SystemUI/src/com/android/systemui/SwipeHelper.java @@ -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); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java index a7329b0f181a..ff31b261eb85 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java @@ -401,6 +401,8 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd */ private float mBackgroundXFactor = 1f; + private boolean mSwipingInProgress; + private boolean mUsingLightTheme; private boolean mQsExpanded; private boolean mForwardScrollable; @@ -3286,7 +3288,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); @@ -3341,7 +3343,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; } @@ -3568,7 +3570,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); } @@ -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 @ShadeViewRefactor(RefactorComponent.SHADE_VIEW) public void onWindowFocusChanged(boolean hasWindowFocus) { @@ -5642,6 +5652,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd @Override public void onDragCancelled(View v) { + setSwipingInProgress(false); mFalsingManager.onNotificatonStopDismissing(); } @@ -5669,6 +5680,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd */ public void handleChildViewDismissed(View view) { + setSwipingInProgress(false); if (mDismissAllInProgress) { return; } @@ -5737,6 +5749,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))) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationSwipeHelper.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationSwipeHelper.java index 599da3b280be..a4909c77af8c 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationSwipeHelper.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationSwipeHelper.java @@ -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(); |