diff options
2 files changed, 32 insertions, 0 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 b9e38abf8ab2..f37f7f990cf9 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 @@ -2630,6 +2630,7 @@ public class NotificationStackScrollLayout private void updateContentHeight() { if (SceneContainerFlag.isEnabled()) { updateIntrinsicStackHeight(); + updateStackEndHeightAndStackHeight(mAmbientState.getExpansionFraction()); 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 11b19f95c1c0..99467cb11282 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 @@ -1275,6 +1275,37 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase { } @Test + @EnableSceneContainer + public void testChildHeightUpdated_whenMaxDisplayedNotificationsSet_updatesStackHeight() { + ExpandableNotificationRow row = mock(ExpandableNotificationRow.class); + int maxNotifs = 1; // any non-zero limit + float stackTop = 100; + float stackCutoff = 1100; + mStackScroller.setStackTop(stackTop); + mStackScroller.setStackCutoff(stackCutoff); + + // Given we have a limit on max displayed notifications + int stackHeightBeforeUpdate = 100; + when(mStackSizeCalculator.computeHeight(eq(mStackScroller), eq(maxNotifs), anyFloat())) + .thenReturn((float) stackHeightBeforeUpdate); + mStackScroller.setMaxDisplayedNotifications(maxNotifs); + + // And the stack heights are set + assertThat(mStackScroller.getIntrinsicStackHeight()).isEqualTo(stackHeightBeforeUpdate); + assertThat(mAmbientState.getStackEndHeight()).isEqualTo(stackHeightBeforeUpdate); + + // When a child changes its height + int stackHeightAfterUpdate = 300; + when(mStackSizeCalculator.computeHeight(eq(mStackScroller), eq(maxNotifs), anyFloat())) + .thenReturn((float) stackHeightAfterUpdate); + mStackScroller.onChildHeightChanged(row, /* needsAnimation = */ false); + + // Then the stack heights are updated + assertThat(mStackScroller.getIntrinsicStackHeight()).isEqualTo(stackHeightAfterUpdate); + assertThat(mAmbientState.getStackEndHeight()).isEqualTo(stackHeightAfterUpdate); + } + + @Test @DisableSceneContainer public void testSetMaxDisplayedNotifications_notifiesListeners() { ExpandableView.OnHeightChangedListener listener = |