diff options
author | 2023-10-31 08:47:51 +0000 | |
---|---|---|
committer | 2023-10-31 08:47:51 +0000 | |
commit | c2bc37529a3bf47717e615cd8521966bc8b725e2 (patch) | |
tree | 91c0ea6c2ead2b6d80cdde2956c23e1d776663ea | |
parent | 612e70e81a2e7170e8da3be49cade031d76a18ca (diff) | |
parent | 6506b60b89af742cf50215c7901ddb47a2ae164e (diff) |
Merge "Fix odd jumps during clear all animation" into main
2 files changed, 20 insertions, 1 deletions
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 8babcc24043a..1774000d8f87 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 @@ -4963,7 +4963,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable // Avoid Flicking during clear all // when the shade finishes closing, onExpansionStopped will call // resetScrollPosition to setOwnScrollY to 0 - if (mAmbientState.isClosing()) { + if (mAmbientState.isClosing() || mAmbientState.isClearAllInProgress()) { return; } diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutTest.java index 033c96ae84b0..4af7864e6fac 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutTest.java @@ -786,6 +786,25 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase { } @Test + public void testSetOwnScrollY_clearAllInProgress_scrollYDoesNotChange() { + // Given: clear all is in progress, scrollY is 0 + mAmbientState.setScrollY(0); + assertEquals(0, mAmbientState.getScrollY()); + mAmbientState.setClearAllInProgress(true); + + // When: call NotificationStackScrollLayout.setOwnScrollY to set scrollY to 1 + mStackScroller.setOwnScrollY(1); + + // Then: scrollY should not change, it should still be 0 + assertEquals(0, mAmbientState.getScrollY()); + + // Reset scrollY and mAmbientState.mIsClosing to avoid interfering with other tests + mAmbientState.setClearAllInProgress(false); + mStackScroller.setOwnScrollY(0); + assertEquals(0, mAmbientState.getScrollY()); + } + + @Test public void onShadeFlingClosingEnd_scrollYShouldBeSetToZero() { // Given: mAmbientState.mIsClosing is set to be true // mIsExpanded is set to be false |