Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java +1 −0 Original line number Diff line number Diff line Loading @@ -2630,6 +2630,7 @@ public class NotificationStackScrollLayout private void updateContentHeight() { if (SceneContainerFlag.isEnabled()) { updateIntrinsicStackHeight(); updateStackEndHeightAndStackHeight(mAmbientState.getExpansionFraction()); return; } Loading packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutTest.java +31 −0 Original line number Diff line number Diff line Loading @@ -1274,6 +1274,37 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase { assertThat(mAmbientState.getStackEndHeight()).isEqualTo(stackViewPortHeight); } @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() { Loading Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java +1 −0 Original line number Diff line number Diff line Loading @@ -2630,6 +2630,7 @@ public class NotificationStackScrollLayout private void updateContentHeight() { if (SceneContainerFlag.isEnabled()) { updateIntrinsicStackHeight(); updateStackEndHeightAndStackHeight(mAmbientState.getExpansionFraction()); return; } Loading
packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutTest.java +31 −0 Original line number Diff line number Diff line Loading @@ -1274,6 +1274,37 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase { assertThat(mAmbientState.getStackEndHeight()).isEqualTo(stackViewPortHeight); } @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() { Loading