Loading packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/NotificationListViewModelTest.kt +41 −27 Original line number Diff line number Diff line Loading @@ -148,36 +148,40 @@ class NotificationListViewModelTest(flags: FlagsParameterization) : SysuiTestCas assertThat(important).isTrue() } // NOTE: The empty shade view and the footer view should be mutually exclusive. @Test fun shouldIncludeEmptyShadeView_trueWhenNoNotifs() = fun shouldShowEmptyShadeView_trueWhenNoNotifs() = testScope.runTest { val shouldInclude by collectLastValue(underTest.shouldShowEmptyShadeView) val shouldShowEmptyShadeView by collectLastValue(underTest.shouldShowEmptyShadeView) val shouldIncludeFooterView by collectLastValue(underTest.shouldIncludeFooterView) // WHEN has no notifs activeNotificationListRepository.setActiveNotifs(count = 0) runCurrent() // THEN empty shade is visible assertThat(shouldInclude).isTrue() assertThat(shouldShowEmptyShadeView).isTrue() assertThat(shouldIncludeFooterView?.value).isFalse() } @Test fun shouldIncludeEmptyShadeView_falseWhenNotifs() = fun shouldShowEmptyShadeView_falseWhenNotifs() = testScope.runTest { val shouldInclude by collectLastValue(underTest.shouldShowEmptyShadeView) val shouldShowEmptyShadeView by collectLastValue(underTest.shouldShowEmptyShadeView) // WHEN has notifs activeNotificationListRepository.setActiveNotifs(count = 2) runCurrent() // THEN empty shade is not visible assertThat(shouldInclude).isFalse() assertThat(shouldShowEmptyShadeView).isFalse() } @Test fun shouldIncludeEmptyShadeView_falseWhenQsExpandedDefault() = fun shouldShowEmptyShadeView_falseWhenQsExpandedDefault() = testScope.runTest { val shouldInclude by collectLastValue(underTest.shouldShowEmptyShadeView) val shouldShow by collectLastValue(underTest.shouldShowEmptyShadeView) // WHEN has no notifs activeNotificationListRepository.setActiveNotifs(count = 0) Loading @@ -186,13 +190,14 @@ class NotificationListViewModelTest(flags: FlagsParameterization) : SysuiTestCas runCurrent() // THEN empty shade is not visible assertThat(shouldInclude).isFalse() assertThat(shouldShow).isFalse() } @Test fun shouldIncludeEmptyShadeView_trueWhenQsExpandedInSplitShade() = fun shouldShowEmptyShadeView_trueWhenQsExpandedInSplitShade() = testScope.runTest { val shouldInclude by collectLastValue(underTest.shouldShowEmptyShadeView) val shouldShowEmptyShadeView by collectLastValue(underTest.shouldShowEmptyShadeView) val shouldIncludeFooterView by collectLastValue(underTest.shouldIncludeFooterView) // WHEN has no notifs activeNotificationListRepository.setActiveNotifs(count = 0) Loading @@ -205,13 +210,15 @@ class NotificationListViewModelTest(flags: FlagsParameterization) : SysuiTestCas runCurrent() // THEN empty shade is visible assertThat(shouldInclude).isTrue() assertThat(shouldShowEmptyShadeView).isTrue() assertThat(shouldIncludeFooterView?.value).isFalse() } @Test fun shouldIncludeEmptyShadeView_trueWhenLockedShade() = fun shouldShowEmptyShadeView_trueWhenLockedShade() = testScope.runTest { val shouldInclude by collectLastValue(underTest.shouldShowEmptyShadeView) val shouldShowEmptyShadeView by collectLastValue(underTest.shouldShowEmptyShadeView) val shouldIncludeFooterView by collectLastValue(underTest.shouldIncludeFooterView) // WHEN has no notifs activeNotificationListRepository.setActiveNotifs(count = 0) Loading @@ -220,13 +227,14 @@ class NotificationListViewModelTest(flags: FlagsParameterization) : SysuiTestCas runCurrent() // THEN empty shade is visible assertThat(shouldInclude).isTrue() assertThat(shouldShowEmptyShadeView).isTrue() assertThat(shouldIncludeFooterView?.value).isFalse() } @Test fun shouldIncludeEmptyShadeView_falseWhenKeyguard() = fun shouldShowEmptyShadeView_falseWhenKeyguard() = testScope.runTest { val shouldInclude by collectLastValue(underTest.shouldShowEmptyShadeView) val shouldShow by collectLastValue(underTest.shouldShowEmptyShadeView) // WHEN has no notifs activeNotificationListRepository.setActiveNotifs(count = 0) Loading @@ -235,13 +243,13 @@ class NotificationListViewModelTest(flags: FlagsParameterization) : SysuiTestCas runCurrent() // THEN empty shade is not visible assertThat(shouldInclude).isFalse() assertThat(shouldShow).isFalse() } @Test fun shouldIncludeEmptyShadeView_falseWhenStartingToSleep() = fun shouldShowEmptyShadeView_falseWhenStartingToSleep() = testScope.runTest { val shouldInclude by collectLastValue(underTest.shouldShowEmptyShadeView) val shouldShow by collectLastValue(underTest.shouldShowEmptyShadeView) // WHEN has no notifs activeNotificationListRepository.setActiveNotifs(count = 0) Loading @@ -252,7 +260,7 @@ class NotificationListViewModelTest(flags: FlagsParameterization) : SysuiTestCas runCurrent() // THEN empty shade is not visible assertThat(shouldInclude).isFalse() assertThat(shouldShow).isFalse() } @Test Loading Loading @@ -308,7 +316,8 @@ class NotificationListViewModelTest(flags: FlagsParameterization) : SysuiTestCas @Test fun shouldIncludeFooterView_trueWhenShade() = testScope.runTest { val shouldInclude by collectLastValue(underTest.shouldIncludeFooterView) val shouldIncludeFooterView by collectLastValue(underTest.shouldIncludeFooterView) val shouldShowEmptyShadeView by collectLastValue(underTest.shouldShowEmptyShadeView) // WHEN has notifs activeNotificationListRepository.setActiveNotifs(count = 2) Loading @@ -318,13 +327,15 @@ class NotificationListViewModelTest(flags: FlagsParameterization) : SysuiTestCas runCurrent() // THEN footer is visible assertThat(shouldInclude?.value).isTrue() assertThat(shouldIncludeFooterView?.value).isTrue() assertThat(shouldShowEmptyShadeView).isFalse() } @Test fun shouldIncludeFooterView_trueWhenLockedShade() = testScope.runTest { val shouldInclude by collectLastValue(underTest.shouldIncludeFooterView) val shouldIncludeFooterView by collectLastValue(underTest.shouldIncludeFooterView) val shouldShowEmptyShadeView by collectLastValue(underTest.shouldShowEmptyShadeView) // WHEN has notifs activeNotificationListRepository.setActiveNotifs(count = 2) Loading @@ -334,7 +345,8 @@ class NotificationListViewModelTest(flags: FlagsParameterization) : SysuiTestCas runCurrent() // THEN footer is visible assertThat(shouldInclude?.value).isTrue() assertThat(shouldIncludeFooterView?.value).isTrue() assertThat(shouldShowEmptyShadeView).isFalse() } @Test Loading Loading @@ -410,7 +422,8 @@ class NotificationListViewModelTest(flags: FlagsParameterization) : SysuiTestCas @Test fun shouldIncludeFooterView_trueWhenQsExpandedSplitShade() = testScope.runTest { val shouldInclude by collectLastValue(underTest.shouldIncludeFooterView) val shouldIncludeFooterView by collectLastValue(underTest.shouldIncludeFooterView) val shouldShowEmptyShadeView by collectLastValue(underTest.shouldShowEmptyShadeView) // WHEN has notifs activeNotificationListRepository.setActiveNotifs(count = 2) Loading @@ -425,7 +438,8 @@ class NotificationListViewModelTest(flags: FlagsParameterization) : SysuiTestCas runCurrent() // THEN footer is visible assertThat(shouldInclude?.value).isTrue() assertThat(shouldIncludeFooterView?.value).isTrue() assertThat(shouldShowEmptyShadeView).isFalse() } @Test Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithm.java +14 −0 Original line number Diff line number Diff line Loading @@ -445,12 +445,26 @@ public class StackScrollAlgorithm { state.visibleChildren.clear(); state.visibleChildren.ensureCapacity(childCount); int notGoneIndex = 0; boolean emptyShadeVisible = false; for (int i = 0; i < childCount; i++) { ExpandableView v = (ExpandableView) mHostView.getChildAt(i); if (v.getVisibility() != View.GONE) { if (v == ambientState.getShelf()) { continue; } if (FooterViewRefactor.isEnabled()) { if (v instanceof EmptyShadeView) { emptyShadeVisible = true; } if (v instanceof FooterView) { if (emptyShadeVisible || notGoneIndex == 0) { // if the empty shade is visible or the footer is the first visible // view, we're in a transitory state so let's leave the footer alone. continue; } } } notGoneIndex = updateNotGoneIndex(state, notGoneIndex, v); if (v instanceof ExpandableNotificationRow row) { Loading packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithmTest.kt +2 −0 Original line number Diff line number Diff line Loading @@ -8,6 +8,7 @@ import android.widget.FrameLayout import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SmallTest import com.android.keyguard.BouncerPanelExpansionCalculator.aboutToShowBouncerProgress import com.android.systemui.Flags import com.android.systemui.SysuiTestCase import com.android.systemui.animation.ShadeInterpolation.getContentAlpha import com.android.systemui.dump.DumpManager Loading Loading @@ -549,6 +550,7 @@ class StackScrollAlgorithmTest : SysuiTestCase() { assertThat((footerView.viewState as FooterViewState).hideContent).isTrue() } @DisableFlags(Flags.FLAG_NOTIFICATIONS_FOOTER_VIEW_REFACTOR) @Test fun resetViewStates_clearAllInProgress_allRowsRemoved_emptyShade_footerHidden() { ambientState.isClearAllInProgress = true Loading Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/NotificationListViewModelTest.kt +41 −27 Original line number Diff line number Diff line Loading @@ -148,36 +148,40 @@ class NotificationListViewModelTest(flags: FlagsParameterization) : SysuiTestCas assertThat(important).isTrue() } // NOTE: The empty shade view and the footer view should be mutually exclusive. @Test fun shouldIncludeEmptyShadeView_trueWhenNoNotifs() = fun shouldShowEmptyShadeView_trueWhenNoNotifs() = testScope.runTest { val shouldInclude by collectLastValue(underTest.shouldShowEmptyShadeView) val shouldShowEmptyShadeView by collectLastValue(underTest.shouldShowEmptyShadeView) val shouldIncludeFooterView by collectLastValue(underTest.shouldIncludeFooterView) // WHEN has no notifs activeNotificationListRepository.setActiveNotifs(count = 0) runCurrent() // THEN empty shade is visible assertThat(shouldInclude).isTrue() assertThat(shouldShowEmptyShadeView).isTrue() assertThat(shouldIncludeFooterView?.value).isFalse() } @Test fun shouldIncludeEmptyShadeView_falseWhenNotifs() = fun shouldShowEmptyShadeView_falseWhenNotifs() = testScope.runTest { val shouldInclude by collectLastValue(underTest.shouldShowEmptyShadeView) val shouldShowEmptyShadeView by collectLastValue(underTest.shouldShowEmptyShadeView) // WHEN has notifs activeNotificationListRepository.setActiveNotifs(count = 2) runCurrent() // THEN empty shade is not visible assertThat(shouldInclude).isFalse() assertThat(shouldShowEmptyShadeView).isFalse() } @Test fun shouldIncludeEmptyShadeView_falseWhenQsExpandedDefault() = fun shouldShowEmptyShadeView_falseWhenQsExpandedDefault() = testScope.runTest { val shouldInclude by collectLastValue(underTest.shouldShowEmptyShadeView) val shouldShow by collectLastValue(underTest.shouldShowEmptyShadeView) // WHEN has no notifs activeNotificationListRepository.setActiveNotifs(count = 0) Loading @@ -186,13 +190,14 @@ class NotificationListViewModelTest(flags: FlagsParameterization) : SysuiTestCas runCurrent() // THEN empty shade is not visible assertThat(shouldInclude).isFalse() assertThat(shouldShow).isFalse() } @Test fun shouldIncludeEmptyShadeView_trueWhenQsExpandedInSplitShade() = fun shouldShowEmptyShadeView_trueWhenQsExpandedInSplitShade() = testScope.runTest { val shouldInclude by collectLastValue(underTest.shouldShowEmptyShadeView) val shouldShowEmptyShadeView by collectLastValue(underTest.shouldShowEmptyShadeView) val shouldIncludeFooterView by collectLastValue(underTest.shouldIncludeFooterView) // WHEN has no notifs activeNotificationListRepository.setActiveNotifs(count = 0) Loading @@ -205,13 +210,15 @@ class NotificationListViewModelTest(flags: FlagsParameterization) : SysuiTestCas runCurrent() // THEN empty shade is visible assertThat(shouldInclude).isTrue() assertThat(shouldShowEmptyShadeView).isTrue() assertThat(shouldIncludeFooterView?.value).isFalse() } @Test fun shouldIncludeEmptyShadeView_trueWhenLockedShade() = fun shouldShowEmptyShadeView_trueWhenLockedShade() = testScope.runTest { val shouldInclude by collectLastValue(underTest.shouldShowEmptyShadeView) val shouldShowEmptyShadeView by collectLastValue(underTest.shouldShowEmptyShadeView) val shouldIncludeFooterView by collectLastValue(underTest.shouldIncludeFooterView) // WHEN has no notifs activeNotificationListRepository.setActiveNotifs(count = 0) Loading @@ -220,13 +227,14 @@ class NotificationListViewModelTest(flags: FlagsParameterization) : SysuiTestCas runCurrent() // THEN empty shade is visible assertThat(shouldInclude).isTrue() assertThat(shouldShowEmptyShadeView).isTrue() assertThat(shouldIncludeFooterView?.value).isFalse() } @Test fun shouldIncludeEmptyShadeView_falseWhenKeyguard() = fun shouldShowEmptyShadeView_falseWhenKeyguard() = testScope.runTest { val shouldInclude by collectLastValue(underTest.shouldShowEmptyShadeView) val shouldShow by collectLastValue(underTest.shouldShowEmptyShadeView) // WHEN has no notifs activeNotificationListRepository.setActiveNotifs(count = 0) Loading @@ -235,13 +243,13 @@ class NotificationListViewModelTest(flags: FlagsParameterization) : SysuiTestCas runCurrent() // THEN empty shade is not visible assertThat(shouldInclude).isFalse() assertThat(shouldShow).isFalse() } @Test fun shouldIncludeEmptyShadeView_falseWhenStartingToSleep() = fun shouldShowEmptyShadeView_falseWhenStartingToSleep() = testScope.runTest { val shouldInclude by collectLastValue(underTest.shouldShowEmptyShadeView) val shouldShow by collectLastValue(underTest.shouldShowEmptyShadeView) // WHEN has no notifs activeNotificationListRepository.setActiveNotifs(count = 0) Loading @@ -252,7 +260,7 @@ class NotificationListViewModelTest(flags: FlagsParameterization) : SysuiTestCas runCurrent() // THEN empty shade is not visible assertThat(shouldInclude).isFalse() assertThat(shouldShow).isFalse() } @Test Loading Loading @@ -308,7 +316,8 @@ class NotificationListViewModelTest(flags: FlagsParameterization) : SysuiTestCas @Test fun shouldIncludeFooterView_trueWhenShade() = testScope.runTest { val shouldInclude by collectLastValue(underTest.shouldIncludeFooterView) val shouldIncludeFooterView by collectLastValue(underTest.shouldIncludeFooterView) val shouldShowEmptyShadeView by collectLastValue(underTest.shouldShowEmptyShadeView) // WHEN has notifs activeNotificationListRepository.setActiveNotifs(count = 2) Loading @@ -318,13 +327,15 @@ class NotificationListViewModelTest(flags: FlagsParameterization) : SysuiTestCas runCurrent() // THEN footer is visible assertThat(shouldInclude?.value).isTrue() assertThat(shouldIncludeFooterView?.value).isTrue() assertThat(shouldShowEmptyShadeView).isFalse() } @Test fun shouldIncludeFooterView_trueWhenLockedShade() = testScope.runTest { val shouldInclude by collectLastValue(underTest.shouldIncludeFooterView) val shouldIncludeFooterView by collectLastValue(underTest.shouldIncludeFooterView) val shouldShowEmptyShadeView by collectLastValue(underTest.shouldShowEmptyShadeView) // WHEN has notifs activeNotificationListRepository.setActiveNotifs(count = 2) Loading @@ -334,7 +345,8 @@ class NotificationListViewModelTest(flags: FlagsParameterization) : SysuiTestCas runCurrent() // THEN footer is visible assertThat(shouldInclude?.value).isTrue() assertThat(shouldIncludeFooterView?.value).isTrue() assertThat(shouldShowEmptyShadeView).isFalse() } @Test Loading Loading @@ -410,7 +422,8 @@ class NotificationListViewModelTest(flags: FlagsParameterization) : SysuiTestCas @Test fun shouldIncludeFooterView_trueWhenQsExpandedSplitShade() = testScope.runTest { val shouldInclude by collectLastValue(underTest.shouldIncludeFooterView) val shouldIncludeFooterView by collectLastValue(underTest.shouldIncludeFooterView) val shouldShowEmptyShadeView by collectLastValue(underTest.shouldShowEmptyShadeView) // WHEN has notifs activeNotificationListRepository.setActiveNotifs(count = 2) Loading @@ -425,7 +438,8 @@ class NotificationListViewModelTest(flags: FlagsParameterization) : SysuiTestCas runCurrent() // THEN footer is visible assertThat(shouldInclude?.value).isTrue() assertThat(shouldIncludeFooterView?.value).isTrue() assertThat(shouldShowEmptyShadeView).isFalse() } @Test Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithm.java +14 −0 Original line number Diff line number Diff line Loading @@ -445,12 +445,26 @@ public class StackScrollAlgorithm { state.visibleChildren.clear(); state.visibleChildren.ensureCapacity(childCount); int notGoneIndex = 0; boolean emptyShadeVisible = false; for (int i = 0; i < childCount; i++) { ExpandableView v = (ExpandableView) mHostView.getChildAt(i); if (v.getVisibility() != View.GONE) { if (v == ambientState.getShelf()) { continue; } if (FooterViewRefactor.isEnabled()) { if (v instanceof EmptyShadeView) { emptyShadeVisible = true; } if (v instanceof FooterView) { if (emptyShadeVisible || notGoneIndex == 0) { // if the empty shade is visible or the footer is the first visible // view, we're in a transitory state so let's leave the footer alone. continue; } } } notGoneIndex = updateNotGoneIndex(state, notGoneIndex, v); if (v instanceof ExpandableNotificationRow row) { Loading
packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithmTest.kt +2 −0 Original line number Diff line number Diff line Loading @@ -8,6 +8,7 @@ import android.widget.FrameLayout import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SmallTest import com.android.keyguard.BouncerPanelExpansionCalculator.aboutToShowBouncerProgress import com.android.systemui.Flags import com.android.systemui.SysuiTestCase import com.android.systemui.animation.ShadeInterpolation.getContentAlpha import com.android.systemui.dump.DumpManager Loading Loading @@ -549,6 +550,7 @@ class StackScrollAlgorithmTest : SysuiTestCase() { assertThat((footerView.viewState as FooterViewState).hideContent).isTrue() } @DisableFlags(Flags.FLAG_NOTIFICATIONS_FOOTER_VIEW_REFACTOR) @Test fun resetViewStates_clearAllInProgress_allRowsRemoved_emptyShade_footerHidden() { ambientState.isClearAllInProgress = true Loading