Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java +15 −4 Original line number Diff line number Diff line Loading @@ -231,8 +231,8 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable * The algorithm which calculates the properties for our children */ private final StackScrollAlgorithm mStackScrollAlgorithm; private final AmbientState mAmbientState; private GroupMembershipManager mGroupMembershipManager; private GroupExpansionManager mGroupExpansionManager; private NotificationActivityStarter mNotificationActivityStarter; Loading Loading @@ -1009,6 +1009,10 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable return mAmbientState.isPulseExpanding(); } public int getSpeedBumpIndex() { return mAmbientState.getSpeedBumpIndex(); } @Override @ShadeViewRefactor(RefactorComponent.SHADE_VIEW) protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { Loading Loading @@ -1063,7 +1067,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable } @ShadeViewRefactor(RefactorComponent.ADAPTER) public void updateSpeedBumpIndex(int newIndex, boolean noAmbient) { private void setSpeedBumpIndex(int newIndex, boolean noAmbient) { mAmbientState.setSpeedBumpIndex(newIndex); mNoAmbient = noAmbient; } Loading Loading @@ -4992,6 +4996,8 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable mController.updateShowEmptyShadeView(); updateFooter(); } updateSpeedBumpIndex(); } @ShadeViewRefactor(RefactorComponent.SHADE_VIEW) Loading @@ -5002,6 +5008,8 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable mController.updateShowEmptyShadeView(); updateFooter(); } updateSpeedBumpIndex(); } public void addContainerViewAt(View v, int index) { Loading @@ -5011,6 +5019,8 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable mController.updateShowEmptyShadeView(); updateFooter(); } updateSpeedBumpIndex(); } @ShadeViewRefactor(RefactorComponent.SHADE_VIEW) Loading Loading @@ -5237,6 +5247,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable protected void setStatusBarState(int statusBarState) { mStatusBarState = statusBarState; mAmbientState.setStatusBarState(statusBarState); updateSpeedBumpIndex(); } void onStatePostChange(boolean fromShadeLocked) { Loading Loading @@ -5777,7 +5788,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable } @ShadeViewRefactor(RefactorComponent.SHADE_VIEW) public void updateSpeedBumpIndex() { private void updateSpeedBumpIndex() { int speedBumpIndex = 0; int currentIndex = 0; final int N = getChildCount(); Loading @@ -5799,7 +5810,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable } } boolean noAmbient = speedBumpIndex == N; updateSpeedBumpIndex(speedBumpIndex, noAmbient); setSpeedBumpIndex(speedBumpIndex, noAmbient); } /** Updates the indices of the boundaries between sections. */ Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java +0 −4 Original line number Diff line number Diff line Loading @@ -1035,10 +1035,6 @@ public class NotificationStackScrollLayoutController { mView.updateSectionBoundaries(reason); } public void updateSpeedBumpIndex() { mView.updateSpeedBumpIndex(); } public void updateFooter() { mView.updateFooter(); } Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java +0 −1 Original line number Diff line number Diff line Loading @@ -3069,7 +3069,6 @@ public class NotificationPanelViewController extends PanelViewController { */ public void updateNotificationViews(String reason) { mNotificationStackScrollLayoutController.updateSectionBoundaries(reason); mNotificationStackScrollLayoutController.updateSpeedBumpIndex(); mNotificationStackScrollLayoutController.updateFooter(); mNotificationIconAreaController.updateNotificationIcons(createVisibleEntriesList()); Loading packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutTest.java +54 −0 Original line number Diff line number Diff line Loading @@ -449,6 +449,60 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase { .DISMISS_SILENT_NOTIFICATIONS_PANEL.getId(), mUiEventLoggerFake.eventId(0)); } @Test public void testAddNotificationUpdatesSpeedBumpIndex() { // initial state == -1 assertEquals(-1, mStackScroller.getSpeedBumpIndex()); // add notification that's before the speed bump ExpandableNotificationRow row = mock(ExpandableNotificationRow.class); NotificationEntry entry = mock(NotificationEntry.class); when(row.getEntry()).thenReturn(entry); when(entry.isAmbient()).thenReturn(false); mStackScroller.addContainerView(row); // speed bump = 1 assertEquals(1, mStackScroller.getSpeedBumpIndex()); } @Test public void testAddAmbientNotificationNoSpeedBumpUpdate() { // initial state == -1 assertEquals(-1, mStackScroller.getSpeedBumpIndex()); // add notification that's after the speed bump ExpandableNotificationRow row = mock(ExpandableNotificationRow.class); NotificationEntry entry = mock(NotificationEntry.class); when(row.getEntry()).thenReturn(entry); when(entry.isAmbient()).thenReturn(true); mStackScroller.addContainerView(row); // speed bump is set to 0 assertEquals(0, mStackScroller.getSpeedBumpIndex()); } @Test public void testRemoveNotificationUpdatesSpeedBump() { // initial state == -1 assertEquals(-1, mStackScroller.getSpeedBumpIndex()); // add 3 notification that are after the speed bump ExpandableNotificationRow row = mock(ExpandableNotificationRow.class); NotificationEntry entry = mock(NotificationEntry.class); when(row.getEntry()).thenReturn(entry); when(entry.isAmbient()).thenReturn(false); mStackScroller.addContainerView(row); // speed bump is 1 assertEquals(1, mStackScroller.getSpeedBumpIndex()); // remove the notification that was before the speed bump mStackScroller.removeContainerView(row); // speed bump is now 0 assertEquals(0, mStackScroller.getSpeedBumpIndex()); } private void setBarStateForTest(int state) { // Can't inject this through the listener or we end up on the actual implementation // rather than the mock because the spy just coppied the anonymous inner /shruggie. Loading Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java +15 −4 Original line number Diff line number Diff line Loading @@ -231,8 +231,8 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable * The algorithm which calculates the properties for our children */ private final StackScrollAlgorithm mStackScrollAlgorithm; private final AmbientState mAmbientState; private GroupMembershipManager mGroupMembershipManager; private GroupExpansionManager mGroupExpansionManager; private NotificationActivityStarter mNotificationActivityStarter; Loading Loading @@ -1009,6 +1009,10 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable return mAmbientState.isPulseExpanding(); } public int getSpeedBumpIndex() { return mAmbientState.getSpeedBumpIndex(); } @Override @ShadeViewRefactor(RefactorComponent.SHADE_VIEW) protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { Loading Loading @@ -1063,7 +1067,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable } @ShadeViewRefactor(RefactorComponent.ADAPTER) public void updateSpeedBumpIndex(int newIndex, boolean noAmbient) { private void setSpeedBumpIndex(int newIndex, boolean noAmbient) { mAmbientState.setSpeedBumpIndex(newIndex); mNoAmbient = noAmbient; } Loading Loading @@ -4992,6 +4996,8 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable mController.updateShowEmptyShadeView(); updateFooter(); } updateSpeedBumpIndex(); } @ShadeViewRefactor(RefactorComponent.SHADE_VIEW) Loading @@ -5002,6 +5008,8 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable mController.updateShowEmptyShadeView(); updateFooter(); } updateSpeedBumpIndex(); } public void addContainerViewAt(View v, int index) { Loading @@ -5011,6 +5019,8 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable mController.updateShowEmptyShadeView(); updateFooter(); } updateSpeedBumpIndex(); } @ShadeViewRefactor(RefactorComponent.SHADE_VIEW) Loading Loading @@ -5237,6 +5247,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable protected void setStatusBarState(int statusBarState) { mStatusBarState = statusBarState; mAmbientState.setStatusBarState(statusBarState); updateSpeedBumpIndex(); } void onStatePostChange(boolean fromShadeLocked) { Loading Loading @@ -5777,7 +5788,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable } @ShadeViewRefactor(RefactorComponent.SHADE_VIEW) public void updateSpeedBumpIndex() { private void updateSpeedBumpIndex() { int speedBumpIndex = 0; int currentIndex = 0; final int N = getChildCount(); Loading @@ -5799,7 +5810,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable } } boolean noAmbient = speedBumpIndex == N; updateSpeedBumpIndex(speedBumpIndex, noAmbient); setSpeedBumpIndex(speedBumpIndex, noAmbient); } /** Updates the indices of the boundaries between sections. */ Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java +0 −4 Original line number Diff line number Diff line Loading @@ -1035,10 +1035,6 @@ public class NotificationStackScrollLayoutController { mView.updateSectionBoundaries(reason); } public void updateSpeedBumpIndex() { mView.updateSpeedBumpIndex(); } public void updateFooter() { mView.updateFooter(); } Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java +0 −1 Original line number Diff line number Diff line Loading @@ -3069,7 +3069,6 @@ public class NotificationPanelViewController extends PanelViewController { */ public void updateNotificationViews(String reason) { mNotificationStackScrollLayoutController.updateSectionBoundaries(reason); mNotificationStackScrollLayoutController.updateSpeedBumpIndex(); mNotificationStackScrollLayoutController.updateFooter(); mNotificationIconAreaController.updateNotificationIcons(createVisibleEntriesList()); Loading
packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutTest.java +54 −0 Original line number Diff line number Diff line Loading @@ -449,6 +449,60 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase { .DISMISS_SILENT_NOTIFICATIONS_PANEL.getId(), mUiEventLoggerFake.eventId(0)); } @Test public void testAddNotificationUpdatesSpeedBumpIndex() { // initial state == -1 assertEquals(-1, mStackScroller.getSpeedBumpIndex()); // add notification that's before the speed bump ExpandableNotificationRow row = mock(ExpandableNotificationRow.class); NotificationEntry entry = mock(NotificationEntry.class); when(row.getEntry()).thenReturn(entry); when(entry.isAmbient()).thenReturn(false); mStackScroller.addContainerView(row); // speed bump = 1 assertEquals(1, mStackScroller.getSpeedBumpIndex()); } @Test public void testAddAmbientNotificationNoSpeedBumpUpdate() { // initial state == -1 assertEquals(-1, mStackScroller.getSpeedBumpIndex()); // add notification that's after the speed bump ExpandableNotificationRow row = mock(ExpandableNotificationRow.class); NotificationEntry entry = mock(NotificationEntry.class); when(row.getEntry()).thenReturn(entry); when(entry.isAmbient()).thenReturn(true); mStackScroller.addContainerView(row); // speed bump is set to 0 assertEquals(0, mStackScroller.getSpeedBumpIndex()); } @Test public void testRemoveNotificationUpdatesSpeedBump() { // initial state == -1 assertEquals(-1, mStackScroller.getSpeedBumpIndex()); // add 3 notification that are after the speed bump ExpandableNotificationRow row = mock(ExpandableNotificationRow.class); NotificationEntry entry = mock(NotificationEntry.class); when(row.getEntry()).thenReturn(entry); when(entry.isAmbient()).thenReturn(false); mStackScroller.addContainerView(row); // speed bump is 1 assertEquals(1, mStackScroller.getSpeedBumpIndex()); // remove the notification that was before the speed bump mStackScroller.removeContainerView(row); // speed bump is now 0 assertEquals(0, mStackScroller.getSpeedBumpIndex()); } private void setBarStateForTest(int state) { // Can't inject this through the listener or we end up on the actual implementation // rather than the mock because the spy just coppied the anonymous inner /shruggie. Loading