diff options
| author | 2020-03-05 11:00:47 -0500 | |
|---|---|---|
| committer | 2020-03-05 15:12:40 -0500 | |
| commit | 6de51a70f1ab3fa5028e0d74f0bd3783c2c8c8dc (patch) | |
| tree | 88f29a75afa24cfa43b0c72f4c1e464cf08103e2 | |
| parent | 307d3854f3934ca6360449d5f871785074443af9 (diff) | |
Fix people header placement when only hub visible
Bug: 150166074
Test: atest, manual
Change-Id: If85b08731bad75096e14ea83a59fe6230c337313
2 files changed, 27 insertions, 0 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationSectionsManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationSectionsManager.java index 8ee2f5002f0d..42a7c6a07e0f 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationSectionsManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationSectionsManager.java @@ -332,6 +332,10 @@ public class NotificationSectionsManager implements StackScrollAlgorithm.Section // Put it at the end of the list. peopleHeaderTarget = lastNotifIndex; } + // Offset the target to account for the current position of the people header. + if (currentPeopleHeaderIdx != -1 && currentPeopleHeaderIdx < peopleHeaderTarget) { + peopleHeaderTarget--; + } } // Add headers in reverse order to preserve indices @@ -459,6 +463,11 @@ public class NotificationSectionsManager implements StackScrollAlgorithm.Section return mPeopleHubView; } + @VisibleForTesting + void setPeopleHubVisible(boolean visible) { + mPeopleHubVisible = visible; + } + private final ConfigurationListener mConfigurationListener = new ConfigurationListener() { @Override public void onLocaleListChanged() { diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationSectionsManagerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationSectionsManagerTest.java index c64dd093a4c2..a263a7232352 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationSectionsManagerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationSectionsManagerTest.java @@ -315,6 +315,24 @@ public class NotificationSectionsManagerTest extends SysuiTestCase { verify(mNssl).changeViewPosition(mSectionsManager.getPeopleHeaderView(), 0); } + @Test + public void testPeopleFiltering_keepPeopleHeaderWhenSectionEmpty() { + mSectionsManager.setPeopleHubVisible(true); + enablePeopleFiltering(); + + setStackState( + ChildType.PEOPLE_HEADER, + ChildType.ALERTING_HEADER, + ChildType.ALERTING, + ChildType.GENTLE_HEADER, + ChildType.GENTLE + ); + mSectionsManager.updateSectionBoundaries(); + + verify(mNssl, never()).removeView(mSectionsManager.getPeopleHeaderView()); + verify(mNssl).changeViewPosition(mSectionsManager.getPeopleHeaderView(), 0); + } + private void enablePeopleFiltering() { when(mSectionsFeatureManager.isFilteringEnabled()).thenReturn(true); when(mSectionsFeatureManager.getNumberOfBuckets()).thenReturn(4); |