Loading packages/SystemUI/src/com/android/systemui/SwipeHelper.java +35 −5 Original line number Diff line number Diff line Loading @@ -548,6 +548,10 @@ public class SwipeHelper implements Gefingerpoken, Dumpable { if (!cancelled) { updateSwipeProgressFromOffset(animView, canBeDismissed); resetSwipeOfView(animView); // Clear the snapped view after success, assuming it's not being swiped now if (animView == mTouchedView && !mIsSwiping) { mTouchedView = null; } } onChildSnappedBack(animView, targetLeft); }); Loading Loading @@ -813,13 +817,39 @@ public class SwipeHelper implements Gefingerpoken, Dumpable { } } public void resetSwipeState() { View swipedView = getSwipedView(); private void resetSwipeState() { resetSwipeStates(/* resetAll= */ false); } public void resetTouchState() { resetSwipeStates(/* resetAll= */ true); } /** This method resets the swipe state, and if `resetAll` is true, also resets the snap state */ private void resetSwipeStates(boolean resetAll) { final View touchedView = mTouchedView; final boolean wasSnapping = mSnappingChild; final boolean wasSwiping = mIsSwiping; mTouchedView = null; mIsSwiping = false; if (swipedView != null) { snapChildIfNeeded(swipedView, false, 0); onChildSnappedBack(swipedView, 0); // If we were swiping, then we resetting swipe requires resetting everything. resetAll |= wasSwiping; if (resetAll) { mSnappingChild = false; } if (touchedView == null) return; // No view to reset visually // When snap needs to be reset, first thing is to cancel any translation animation final boolean snapNeedsReset = resetAll && wasSnapping; if (snapNeedsReset) { cancelTranslateAnimation(touchedView); } // actually reset the view to default state if (resetAll) { snapChildIfNeeded(touchedView, false, 0); } // report if a swipe or snap was reset. if (wasSwiping || snapNeedsReset) { onChildSnappedBack(touchedView, 0); } } Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java +2 −1 Original line number Diff line number Diff line Loading @@ -4387,6 +4387,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable boolean nowHiddenAtAll = mAmbientState.isHiddenAtAll(); if (nowFullyHidden != wasFullyHidden) { updateVisibility(); mSwipeHelper.resetTouchState(); } if (!wasHiddenAtAll && nowHiddenAtAll) { resetExposedMenuView(true /* animate */, true /* animate */); Loading Loading @@ -5847,7 +5848,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable } private void cancelActiveSwipe() { mSwipeHelper.resetSwipeState(); mSwipeHelper.resetTouchState(); updateContinuousShadowDrawing(); } Loading packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutTest.java +6 −6 Original line number Diff line number Diff line Loading @@ -836,7 +836,7 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase { } @Test public void onShadeClosesWithAnimationWillResetSwipeState() { public void onShadeClosesWithAnimationWillResetTouchState() { // GIVEN shade is expanded mStackScroller.setIsExpanded(true); clearInvocations(mNotificationSwipeHelper); Loading @@ -846,12 +846,12 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase { mStackScroller.setIsExpanded(false); mStackScroller.onExpansionStopped(); // VERIFY swipe is reset verify(mNotificationSwipeHelper).resetSwipeState(); // VERIFY touch is reset verify(mNotificationSwipeHelper).resetTouchState(); } @Test public void onShadeClosesWithoutAnimationWillResetSwipeState() { public void onShadeClosesWithoutAnimationWillResetTouchState() { // GIVEN shade is expanded mStackScroller.setIsExpanded(true); clearInvocations(mNotificationSwipeHelper); Loading @@ -859,8 +859,8 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase { // WHEN closing the shade without the animation mStackScroller.setIsExpanded(false); // VERIFY swipe is reset verify(mNotificationSwipeHelper).resetSwipeState(); // VERIFY touch is reset verify(mNotificationSwipeHelper).resetTouchState(); } @Test Loading Loading
packages/SystemUI/src/com/android/systemui/SwipeHelper.java +35 −5 Original line number Diff line number Diff line Loading @@ -548,6 +548,10 @@ public class SwipeHelper implements Gefingerpoken, Dumpable { if (!cancelled) { updateSwipeProgressFromOffset(animView, canBeDismissed); resetSwipeOfView(animView); // Clear the snapped view after success, assuming it's not being swiped now if (animView == mTouchedView && !mIsSwiping) { mTouchedView = null; } } onChildSnappedBack(animView, targetLeft); }); Loading Loading @@ -813,13 +817,39 @@ public class SwipeHelper implements Gefingerpoken, Dumpable { } } public void resetSwipeState() { View swipedView = getSwipedView(); private void resetSwipeState() { resetSwipeStates(/* resetAll= */ false); } public void resetTouchState() { resetSwipeStates(/* resetAll= */ true); } /** This method resets the swipe state, and if `resetAll` is true, also resets the snap state */ private void resetSwipeStates(boolean resetAll) { final View touchedView = mTouchedView; final boolean wasSnapping = mSnappingChild; final boolean wasSwiping = mIsSwiping; mTouchedView = null; mIsSwiping = false; if (swipedView != null) { snapChildIfNeeded(swipedView, false, 0); onChildSnappedBack(swipedView, 0); // If we were swiping, then we resetting swipe requires resetting everything. resetAll |= wasSwiping; if (resetAll) { mSnappingChild = false; } if (touchedView == null) return; // No view to reset visually // When snap needs to be reset, first thing is to cancel any translation animation final boolean snapNeedsReset = resetAll && wasSnapping; if (snapNeedsReset) { cancelTranslateAnimation(touchedView); } // actually reset the view to default state if (resetAll) { snapChildIfNeeded(touchedView, false, 0); } // report if a swipe or snap was reset. if (wasSwiping || snapNeedsReset) { onChildSnappedBack(touchedView, 0); } } Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java +2 −1 Original line number Diff line number Diff line Loading @@ -4387,6 +4387,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable boolean nowHiddenAtAll = mAmbientState.isHiddenAtAll(); if (nowFullyHidden != wasFullyHidden) { updateVisibility(); mSwipeHelper.resetTouchState(); } if (!wasHiddenAtAll && nowHiddenAtAll) { resetExposedMenuView(true /* animate */, true /* animate */); Loading Loading @@ -5847,7 +5848,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable } private void cancelActiveSwipe() { mSwipeHelper.resetSwipeState(); mSwipeHelper.resetTouchState(); updateContinuousShadowDrawing(); } Loading
packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutTest.java +6 −6 Original line number Diff line number Diff line Loading @@ -836,7 +836,7 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase { } @Test public void onShadeClosesWithAnimationWillResetSwipeState() { public void onShadeClosesWithAnimationWillResetTouchState() { // GIVEN shade is expanded mStackScroller.setIsExpanded(true); clearInvocations(mNotificationSwipeHelper); Loading @@ -846,12 +846,12 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase { mStackScroller.setIsExpanded(false); mStackScroller.onExpansionStopped(); // VERIFY swipe is reset verify(mNotificationSwipeHelper).resetSwipeState(); // VERIFY touch is reset verify(mNotificationSwipeHelper).resetTouchState(); } @Test public void onShadeClosesWithoutAnimationWillResetSwipeState() { public void onShadeClosesWithoutAnimationWillResetTouchState() { // GIVEN shade is expanded mStackScroller.setIsExpanded(true); clearInvocations(mNotificationSwipeHelper); Loading @@ -859,8 +859,8 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase { // WHEN closing the shade without the animation mStackScroller.setIsExpanded(false); // VERIFY swipe is reset verify(mNotificationSwipeHelper).resetSwipeState(); // VERIFY touch is reset verify(mNotificationSwipeHelper).resetTouchState(); } @Test Loading