Loading packages/SystemUI/aconfig/systemui.aconfig +8 −0 Original line number Diff line number Diff line Loading @@ -492,6 +492,14 @@ flag { bug: "372964148" } flag { name: "status_bar_no_hun_behavior" namespace: "systemui" description: "When there's a HUN, don't show the HUN text or icon in the status bar. Instead, " "continue showing the usual status bar." bug: "385740230" } flag { name: "promote_notifications_automatically" namespace: "systemui" Loading packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/icon/ui/viewmodel/NotificationIconContainerStatusBarViewModelTest.kt +35 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,8 @@ package com.android.systemui.statusbar.notification.icon.ui.viewmodel import android.graphics.Rect import android.graphics.drawable.Icon import android.platform.test.annotations.DisableFlags import android.platform.test.annotations.EnableFlags import android.platform.test.flag.junit.FlagsParameterization import androidx.test.filters.SmallTest import com.android.systemui.SysuiTestCase Loading @@ -36,6 +38,7 @@ import com.android.systemui.power.data.repository.fakePowerRepository import com.android.systemui.power.shared.model.WakeSleepReason import com.android.systemui.power.shared.model.WakefulnessState import com.android.systemui.shade.shadeTestUtil import com.android.systemui.statusbar.headsup.shared.StatusBarNoHunBehavior import com.android.systemui.statusbar.notification.data.model.activeNotificationModel import com.android.systemui.statusbar.notification.data.repository.ActiveNotificationsStore import com.android.systemui.statusbar.notification.data.repository.activeNotificationListRepository Loading Loading @@ -258,6 +261,7 @@ class NotificationIconContainerStatusBarViewModelTest(flags: FlagsParameterizati } @Test @DisableFlags(StatusBarNoHunBehavior.FLAG_NAME) fun isolatedIcon_animateOnAppear_shadeCollapsed() = testScope.runTest { val icon: Icon = mock() Loading Loading @@ -285,6 +289,7 @@ class NotificationIconContainerStatusBarViewModelTest(flags: FlagsParameterizati } @Test @DisableFlags(StatusBarNoHunBehavior.FLAG_NAME) fun isolatedIcon_dontAnimateOnAppear_shadeExpanded() = testScope.runTest { val icon: Icon = mock() Loading Loading @@ -312,6 +317,7 @@ class NotificationIconContainerStatusBarViewModelTest(flags: FlagsParameterizati } @Test @DisableFlags(StatusBarNoHunBehavior.FLAG_NAME) fun isolatedIcon_updateWhenIconDataChanges() = testScope.runTest { val icon: Icon = mock() Loading Loading @@ -339,6 +345,7 @@ class NotificationIconContainerStatusBarViewModelTest(flags: FlagsParameterizati } @Test @DisableFlags(StatusBarNoHunBehavior.FLAG_NAME) fun isolatedIcon_lastMessageIsFromReply_notNull() = testScope.runTest { val icon: Icon = mock() Loading @@ -362,4 +369,32 @@ class NotificationIconContainerStatusBarViewModelTest(flags: FlagsParameterizati assertThat(isolatedIcon?.value?.notifKey).isEqualTo("notif1") } @Test @EnableFlags(StatusBarNoHunBehavior.FLAG_NAME) fun isolatedIcon_noHunBehaviorFlagEnabled_doesNothing() = testScope.runTest { val icon: Icon = mock() val isolatedIcon by collectLastValue(underTest.isolatedIcon) runCurrent() headsUpViewStateRepository.isolatedNotification.value = "notif1" runCurrent() activeNotificationsRepository.activeNotifications.value = ActiveNotificationsStore.Builder() .apply { addIndividualNotif( activeNotificationModel( key = "notif1", groupKey = "group", statusBarIcon = icon, ) ) } .build() runCurrent() assertThat(isolatedIcon?.value).isNull() } } packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/HeadsUpAppearanceControllerTest.kt +62 −10 Original line number Diff line number Diff line Loading @@ -34,6 +34,7 @@ import com.android.systemui.shade.shadeViewController import com.android.systemui.statusbar.HeadsUpStatusBarView import com.android.systemui.statusbar.chips.notification.shared.StatusBarNotifChips import com.android.systemui.statusbar.commandQueue import com.android.systemui.statusbar.headsup.shared.StatusBarNoHunBehavior import com.android.systemui.statusbar.notification.collection.NotificationEntry import com.android.systemui.statusbar.notification.domain.interactor.HeadsUpNotificationIconInteractor import com.android.systemui.statusbar.notification.domain.interactor.headsUpNotificationIconInteractor Loading Loading @@ -118,6 +119,7 @@ class HeadsUpAppearanceControllerTest : SysuiTestCase() { } @Test @DisableFlags(StatusBarNoHunBehavior.FLAG_NAME) fun showingEntryUpdated_whenPinnedBySystem() { row.setPinnedStatus(PinnedStatus.PinnedBySystem) setHeadsUpNotifOnManager(entry) Loading @@ -133,8 +135,18 @@ class HeadsUpAppearanceControllerTest : SysuiTestCase() { } @Test @DisableFlags(StatusBarNotifChips.FLAG_NAME) fun showingEntryUpdated_whenPinnedByUser_andFlagOff() { @EnableFlags(StatusBarNoHunBehavior.FLAG_NAME) fun showingEntryNotUpdated_whenPinnedBySystem_whenNoHunBehaviorEnabled() { row.setPinnedStatus(PinnedStatus.PinnedBySystem) setHeadsUpNotifOnManager(entry) underTest.onHeadsUpPinned(entry) assertThat(headsUpStatusBarView.showingEntry).isNull() } @Test @DisableFlags(StatusBarNotifChips.FLAG_NAME, StatusBarNoHunBehavior.FLAG_NAME) fun showingEntryUpdated_whenPinnedByUser_andNotifChipsFlagOff() { row.setPinnedStatus(PinnedStatus.PinnedByUser) setHeadsUpNotifOnManager(entry) underTest.onHeadsUpPinned(entry) Loading @@ -144,7 +156,7 @@ class HeadsUpAppearanceControllerTest : SysuiTestCase() { @Test @EnableFlags(StatusBarNotifChips.FLAG_NAME) fun showingEntryNotUpdated_whenPinnedByUser_andFlagOn() { fun showingEntryNotUpdated_whenPinnedByUser_andNotifChipsFlagOn() { // WHEN the HUN was pinned by the user row.setPinnedStatus(PinnedStatus.PinnedByUser) setHeadsUpNotifOnManager(entry) Loading @@ -155,6 +167,7 @@ class HeadsUpAppearanceControllerTest : SysuiTestCase() { } @Test @DisableFlags(StatusBarNoHunBehavior.FLAG_NAME) fun pinnedStatusUpdatedToSystem_whenPinnedBySystem() { row.setPinnedStatus(PinnedStatus.PinnedBySystem) setHeadsUpNotifOnManager(entry) Loading @@ -167,9 +180,20 @@ class HeadsUpAppearanceControllerTest : SysuiTestCase() { assertThat(underTest.pinnedStatus).isEqualTo(PinnedStatus.NotPinned) } @Test @EnableFlags(StatusBarNoHunBehavior.FLAG_NAME) fun pinnedStatusNotUpdatedToSystem_whenPinnedBySystem_whenNoHunBehaviorEnabled() { row.setPinnedStatus(PinnedStatus.PinnedBySystem) setHeadsUpNotifOnManager(entry) underTest.onHeadsUpPinned(entry) assertThat(underTest.pinnedStatus).isEqualTo(PinnedStatus.NotPinned) } @Test @EnableFlags(StatusBarNotifChips.FLAG_NAME) fun pinnedStatusUpdatedToNotPinned_whenPinnedByUser_andFlagOn() { @DisableFlags(StatusBarNoHunBehavior.FLAG_NAME) fun pinnedStatusUpdatedToNotPinned_whenPinnedByUser_andNotifChipsFlagOn() { row.setPinnedStatus(PinnedStatus.PinnedByUser) setHeadsUpNotifOnManager(entry) underTest.onHeadsUpPinned(entry) Loading @@ -182,6 +206,7 @@ class HeadsUpAppearanceControllerTest : SysuiTestCase() { } @Test @DisableFlags(StatusBarNoHunBehavior.FLAG_NAME) fun isolatedIconSet_whenPinnedBySystem() = kosmos.runTest { val latestIsolatedIcon by Loading @@ -201,8 +226,22 @@ class HeadsUpAppearanceControllerTest : SysuiTestCase() { } @Test @DisableFlags(StatusBarNotifChips.FLAG_NAME) fun isolatedIconSet_whenPinnedByUser_andFlagOff() = @EnableFlags(StatusBarNoHunBehavior.FLAG_NAME) fun isolatedIconNotSet_whenPinnedBySystem_whenNoHunBehaviorEnabled() = kosmos.runTest { val latestIsolatedIcon by collectLastValue(kosmos.headsUpNotificationIconInteractor.isolatedNotification) row.setPinnedStatus(PinnedStatus.PinnedBySystem) setHeadsUpNotifOnManager(entry) underTest.onHeadsUpPinned(entry) assertThat(latestIsolatedIcon).isNull() } @Test @DisableFlags(StatusBarNotifChips.FLAG_NAME, StatusBarNoHunBehavior.FLAG_NAME) fun isolatedIconSet_whenPinnedByUser_andNotifChipsFlagOff() = kosmos.runTest { val latestIsolatedIcon by collectLastValue(kosmos.headsUpNotificationIconInteractor.isolatedNotification) Loading @@ -216,7 +255,7 @@ class HeadsUpAppearanceControllerTest : SysuiTestCase() { @Test @EnableFlags(StatusBarNotifChips.FLAG_NAME) fun isolatedIconNotSet_whenPinnedByUser_andFlagOn() = fun isolatedIconNotSet_whenPinnedByUser_andNotifChipsFlagOn() = kosmos.runTest { val latestIsolatedIcon by collectLastValue(kosmos.headsUpNotificationIconInteractor.isolatedNotification) Loading @@ -243,6 +282,7 @@ class HeadsUpAppearanceControllerTest : SysuiTestCase() { } @Test @DisableFlags(StatusBarNoHunBehavior.FLAG_NAME) fun operatorNameViewUpdated_whenPinnedBySystem() { underTest.setAnimationsEnabled(false) Loading @@ -258,8 +298,20 @@ class HeadsUpAppearanceControllerTest : SysuiTestCase() { } @Test @DisableFlags(StatusBarNotifChips.FLAG_NAME) fun operatorNameViewUpdated_whenPinnedByUser_andFlagOff() { @EnableFlags(StatusBarNoHunBehavior.FLAG_NAME) fun operatorNameViewNotUpdated_whenPinnedBySystem_whenNoHunBehaviorEnabled() { underTest.setAnimationsEnabled(false) row.setPinnedStatus(PinnedStatus.PinnedBySystem) setHeadsUpNotifOnManager(entry) underTest.onHeadsUpPinned(entry) assertThat(operatorNameView.visibility).isEqualTo(View.VISIBLE) } @Test @DisableFlags(StatusBarNotifChips.FLAG_NAME, StatusBarNoHunBehavior.FLAG_NAME) fun operatorNameViewUpdated_whenPinnedByUser_andNotifChipsFlagOff() { underTest.setAnimationsEnabled(false) row.setPinnedStatus(PinnedStatus.PinnedByUser) Loading @@ -271,7 +323,7 @@ class HeadsUpAppearanceControllerTest : SysuiTestCase() { @Test @EnableFlags(StatusBarNotifChips.FLAG_NAME) fun operatorNameViewNotUpdated_whenPinnedByUser_andFlagOn() { fun operatorNameViewNotUpdated_whenPinnedByUser_andNotifChipsFlagOn() { underTest.setAnimationsEnabled(false) // WHEN the row was pinned by the user Loading packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/shared/ui/viewmodel/HomeStatusBarViewModelImplTest.kt +58 −7 Original line number Diff line number Diff line Loading @@ -70,6 +70,7 @@ import com.android.systemui.statusbar.events.data.repository.systemStatusEventAn import com.android.systemui.statusbar.events.shared.model.SystemEventAnimationState.AnimatingIn import com.android.systemui.statusbar.events.shared.model.SystemEventAnimationState.AnimatingOut import com.android.systemui.statusbar.events.shared.model.SystemEventAnimationState.Idle import com.android.systemui.statusbar.headsup.shared.StatusBarNoHunBehavior import com.android.systemui.statusbar.notification.data.model.activeNotificationModel import com.android.systemui.statusbar.notification.data.repository.ActiveNotificationsStore import com.android.systemui.statusbar.notification.data.repository.UnconfinedFakeHeadsUpRowRepository Loading Loading @@ -552,9 +553,10 @@ class HomeStatusBarViewModelImplTest : SysuiTestCase() { } @Test fun shouldShowOperatorNameView_allowedByInteractor_hunPinned_false() = @DisableFlags(StatusBarNoHunBehavior.FLAG_NAME) fun shouldShowOperatorNameView_allowedByInteractor_hunPinned_noHunBehaviorFlagOff_false() = kosmos.runTest { kosmos.setHomeStatusBarInteractorShowOperatorName(false) kosmos.setHomeStatusBarInteractorShowOperatorName(true) transitionKeyguardToGone() Loading @@ -565,7 +567,7 @@ class HomeStatusBarViewModelImplTest : SysuiTestCase() { headsUpNotificationRepository.setNotifications( UnconfinedFakeHeadsUpRowRepository( key = "key", pinnedStatus = MutableStateFlow(PinnedStatus.PinnedByUser), pinnedStatus = MutableStateFlow(PinnedStatus.PinnedBySystem), ) ) Loading @@ -574,6 +576,31 @@ class HomeStatusBarViewModelImplTest : SysuiTestCase() { assertThat(latest).isFalse() } @Test @EnableFlags(StatusBarNoHunBehavior.FLAG_NAME) fun shouldShowOperatorNameView_allowedByInteractor_hunPinned_noHunBehaviorFlagOn_true() = kosmos.runTest { kosmos.setHomeStatusBarInteractorShowOperatorName(true) transitionKeyguardToGone() fakeDisableFlagsRepository.disableFlags.value = DisableFlagsModel(DISABLE_NONE, DISABLE2_NONE) // WHEN there is an active HUN headsUpNotificationRepository.setNotifications( UnconfinedFakeHeadsUpRowRepository( key = "key", pinnedStatus = MutableStateFlow(PinnedStatus.PinnedBySystem), ) ) val latest by collectLastValue(underTest.shouldShowOperatorNameView) // THEN we still show the operator name view if NoHunBehavior flag is enabled assertThat(latest).isTrue() } @Test fun shouldHomeStatusBarBeVisible_keyguardNotGone_noHun_false() = kosmos.runTest { Loading Loading @@ -692,7 +719,7 @@ class HomeStatusBarViewModelImplTest : SysuiTestCase() { @Test @EnableFlags(StatusBarNotifChips.FLAG_NAME) fun isClockVisible_allowedByFlags_hunPinnedByUser_visible() = fun isClockVisible_allowedByDisableFlags_hunPinnedByUser_visible() = kosmos.runTest { val latest by collectLastValue(underTest.isClockVisible) transitionKeyguardToGone() Loading @@ -711,7 +738,8 @@ class HomeStatusBarViewModelImplTest : SysuiTestCase() { } @Test fun isClockVisible_allowedByFlags_hunPinnedBySystem_notVisible() = @DisableFlags(StatusBarNoHunBehavior.FLAG_NAME) fun isClockVisible_allowedByDisableFlags_hunPinnedBySystem_noHunBehaviorFlagOff_notVisible() = kosmos.runTest { val latest by collectLastValue(underTest.isClockVisible) transitionKeyguardToGone() Loading @@ -730,7 +758,29 @@ class HomeStatusBarViewModelImplTest : SysuiTestCase() { } @Test fun isClockVisible_allowedByFlags_hunBecomesInactive_visibleAgain() = @EnableFlags(StatusBarNoHunBehavior.FLAG_NAME) fun isClockVisible_allowedByDisableFlags_hunPinnedBySystem_noHunBehaviorFlagOn_visible() = kosmos.runTest { val latest by collectLastValue(underTest.isClockVisible) transitionKeyguardToGone() fakeDisableFlagsRepository.disableFlags.value = DisableFlagsModel(DISABLE_NONE, DISABLE2_NONE) // WHEN there is an active HUN headsUpNotificationRepository.setNotifications( UnconfinedFakeHeadsUpRowRepository( key = "key", pinnedStatus = MutableStateFlow(PinnedStatus.PinnedBySystem), ) ) // THEN we still show the clock view if NoHunBehavior flag is enabled assertThat(latest!!.visibility).isEqualTo(View.VISIBLE) } @Test @DisableFlags(StatusBarNoHunBehavior.FLAG_NAME) fun isClockVisible_allowedByDisableFlags_hunBecomesInactive_visibleAgain() = kosmos.runTest { val latest by collectLastValue(underTest.isClockVisible) transitionKeyguardToGone() Loading @@ -753,7 +803,8 @@ class HomeStatusBarViewModelImplTest : SysuiTestCase() { } @Test fun isClockVisible_disabledByFlags_hunBecomesInactive_neverVisible() = @DisableFlags(StatusBarNoHunBehavior.FLAG_NAME) fun isClockVisible_disableFlagsProhibitClock_hunBecomesInactive_neverVisible() = kosmos.runTest { val latest by collectLastValue(underTest.isClockVisible) transitionKeyguardToGone() Loading packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/ui/viewmodel/KeyguardStatusBarViewModelTest.kt +25 −1 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package com.android.systemui.statusbar.ui.viewmodel import android.platform.test.annotations.DisableFlags import android.platform.test.annotations.EnableFlags import android.platform.test.flag.junit.FlagsParameterization import androidx.test.filters.SmallTest import com.android.systemui.SysuiTestCase Loading @@ -32,6 +34,7 @@ import com.android.systemui.scene.data.repository.sceneContainerRepository import com.android.systemui.scene.domain.interactor.sceneInteractor import com.android.systemui.scene.shared.model.Scenes import com.android.systemui.statusbar.domain.interactor.keyguardStatusBarInteractor import com.android.systemui.statusbar.headsup.shared.StatusBarNoHunBehavior import com.android.systemui.statusbar.notification.data.repository.FakeHeadsUpRowRepository import com.android.systemui.statusbar.notification.stack.data.repository.headsUpNotificationRepository import com.android.systemui.statusbar.notification.stack.domain.interactor.headsUpNotificationInteractor Loading Loading @@ -127,7 +130,8 @@ class KeyguardStatusBarViewModelTest(flags: FlagsParameterization) : SysuiTestCa @Test @EnableSceneContainer fun isVisible_headsUpStatusBarShown_false() = @DisableFlags(StatusBarNoHunBehavior.FLAG_NAME) fun isVisible_headsUpShown_noHunBehaviorFlagOff_false() = testScope.runTest { val latest by collectLastValue(underTest.isVisible) Loading @@ -144,6 +148,26 @@ class KeyguardStatusBarViewModelTest(flags: FlagsParameterization) : SysuiTestCa assertThat(latest).isFalse() } @Test @EnableSceneContainer @EnableFlags(StatusBarNoHunBehavior.FLAG_NAME) fun isVisible_headsUpShown_noHunBehaviorFlagOn_true() = testScope.runTest { val latest by collectLastValue(underTest.isVisible) // WHEN HUN displayed on the bypass lock screen headsUpRepository.setNotifications(FakeHeadsUpRowRepository("key 0", isPinned = true)) keyguardTransitionRepository.emitInitialStepsFromOff( KeyguardState.LOCKSCREEN, testSetup = true, ) kosmos.sceneContainerRepository.snapToScene(Scenes.Lockscreen) faceAuthRepository.isBypassEnabled.value = true // THEN KeyguardStatusBar is still visible because StatusBarNoHunBehavior is enabled assertThat(latest).isTrue() } @Test fun isVisible_sceneLockscreen_andNotDozing_andNotShowingHeadsUpStatusBar_true() = testScope.runTest { Loading Loading
packages/SystemUI/aconfig/systemui.aconfig +8 −0 Original line number Diff line number Diff line Loading @@ -492,6 +492,14 @@ flag { bug: "372964148" } flag { name: "status_bar_no_hun_behavior" namespace: "systemui" description: "When there's a HUN, don't show the HUN text or icon in the status bar. Instead, " "continue showing the usual status bar." bug: "385740230" } flag { name: "promote_notifications_automatically" namespace: "systemui" Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/icon/ui/viewmodel/NotificationIconContainerStatusBarViewModelTest.kt +35 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,8 @@ package com.android.systemui.statusbar.notification.icon.ui.viewmodel import android.graphics.Rect import android.graphics.drawable.Icon import android.platform.test.annotations.DisableFlags import android.platform.test.annotations.EnableFlags import android.platform.test.flag.junit.FlagsParameterization import androidx.test.filters.SmallTest import com.android.systemui.SysuiTestCase Loading @@ -36,6 +38,7 @@ import com.android.systemui.power.data.repository.fakePowerRepository import com.android.systemui.power.shared.model.WakeSleepReason import com.android.systemui.power.shared.model.WakefulnessState import com.android.systemui.shade.shadeTestUtil import com.android.systemui.statusbar.headsup.shared.StatusBarNoHunBehavior import com.android.systemui.statusbar.notification.data.model.activeNotificationModel import com.android.systemui.statusbar.notification.data.repository.ActiveNotificationsStore import com.android.systemui.statusbar.notification.data.repository.activeNotificationListRepository Loading Loading @@ -258,6 +261,7 @@ class NotificationIconContainerStatusBarViewModelTest(flags: FlagsParameterizati } @Test @DisableFlags(StatusBarNoHunBehavior.FLAG_NAME) fun isolatedIcon_animateOnAppear_shadeCollapsed() = testScope.runTest { val icon: Icon = mock() Loading Loading @@ -285,6 +289,7 @@ class NotificationIconContainerStatusBarViewModelTest(flags: FlagsParameterizati } @Test @DisableFlags(StatusBarNoHunBehavior.FLAG_NAME) fun isolatedIcon_dontAnimateOnAppear_shadeExpanded() = testScope.runTest { val icon: Icon = mock() Loading Loading @@ -312,6 +317,7 @@ class NotificationIconContainerStatusBarViewModelTest(flags: FlagsParameterizati } @Test @DisableFlags(StatusBarNoHunBehavior.FLAG_NAME) fun isolatedIcon_updateWhenIconDataChanges() = testScope.runTest { val icon: Icon = mock() Loading Loading @@ -339,6 +345,7 @@ class NotificationIconContainerStatusBarViewModelTest(flags: FlagsParameterizati } @Test @DisableFlags(StatusBarNoHunBehavior.FLAG_NAME) fun isolatedIcon_lastMessageIsFromReply_notNull() = testScope.runTest { val icon: Icon = mock() Loading @@ -362,4 +369,32 @@ class NotificationIconContainerStatusBarViewModelTest(flags: FlagsParameterizati assertThat(isolatedIcon?.value?.notifKey).isEqualTo("notif1") } @Test @EnableFlags(StatusBarNoHunBehavior.FLAG_NAME) fun isolatedIcon_noHunBehaviorFlagEnabled_doesNothing() = testScope.runTest { val icon: Icon = mock() val isolatedIcon by collectLastValue(underTest.isolatedIcon) runCurrent() headsUpViewStateRepository.isolatedNotification.value = "notif1" runCurrent() activeNotificationsRepository.activeNotifications.value = ActiveNotificationsStore.Builder() .apply { addIndividualNotif( activeNotificationModel( key = "notif1", groupKey = "group", statusBarIcon = icon, ) ) } .build() runCurrent() assertThat(isolatedIcon?.value).isNull() } }
packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/HeadsUpAppearanceControllerTest.kt +62 −10 Original line number Diff line number Diff line Loading @@ -34,6 +34,7 @@ import com.android.systemui.shade.shadeViewController import com.android.systemui.statusbar.HeadsUpStatusBarView import com.android.systemui.statusbar.chips.notification.shared.StatusBarNotifChips import com.android.systemui.statusbar.commandQueue import com.android.systemui.statusbar.headsup.shared.StatusBarNoHunBehavior import com.android.systemui.statusbar.notification.collection.NotificationEntry import com.android.systemui.statusbar.notification.domain.interactor.HeadsUpNotificationIconInteractor import com.android.systemui.statusbar.notification.domain.interactor.headsUpNotificationIconInteractor Loading Loading @@ -118,6 +119,7 @@ class HeadsUpAppearanceControllerTest : SysuiTestCase() { } @Test @DisableFlags(StatusBarNoHunBehavior.FLAG_NAME) fun showingEntryUpdated_whenPinnedBySystem() { row.setPinnedStatus(PinnedStatus.PinnedBySystem) setHeadsUpNotifOnManager(entry) Loading @@ -133,8 +135,18 @@ class HeadsUpAppearanceControllerTest : SysuiTestCase() { } @Test @DisableFlags(StatusBarNotifChips.FLAG_NAME) fun showingEntryUpdated_whenPinnedByUser_andFlagOff() { @EnableFlags(StatusBarNoHunBehavior.FLAG_NAME) fun showingEntryNotUpdated_whenPinnedBySystem_whenNoHunBehaviorEnabled() { row.setPinnedStatus(PinnedStatus.PinnedBySystem) setHeadsUpNotifOnManager(entry) underTest.onHeadsUpPinned(entry) assertThat(headsUpStatusBarView.showingEntry).isNull() } @Test @DisableFlags(StatusBarNotifChips.FLAG_NAME, StatusBarNoHunBehavior.FLAG_NAME) fun showingEntryUpdated_whenPinnedByUser_andNotifChipsFlagOff() { row.setPinnedStatus(PinnedStatus.PinnedByUser) setHeadsUpNotifOnManager(entry) underTest.onHeadsUpPinned(entry) Loading @@ -144,7 +156,7 @@ class HeadsUpAppearanceControllerTest : SysuiTestCase() { @Test @EnableFlags(StatusBarNotifChips.FLAG_NAME) fun showingEntryNotUpdated_whenPinnedByUser_andFlagOn() { fun showingEntryNotUpdated_whenPinnedByUser_andNotifChipsFlagOn() { // WHEN the HUN was pinned by the user row.setPinnedStatus(PinnedStatus.PinnedByUser) setHeadsUpNotifOnManager(entry) Loading @@ -155,6 +167,7 @@ class HeadsUpAppearanceControllerTest : SysuiTestCase() { } @Test @DisableFlags(StatusBarNoHunBehavior.FLAG_NAME) fun pinnedStatusUpdatedToSystem_whenPinnedBySystem() { row.setPinnedStatus(PinnedStatus.PinnedBySystem) setHeadsUpNotifOnManager(entry) Loading @@ -167,9 +180,20 @@ class HeadsUpAppearanceControllerTest : SysuiTestCase() { assertThat(underTest.pinnedStatus).isEqualTo(PinnedStatus.NotPinned) } @Test @EnableFlags(StatusBarNoHunBehavior.FLAG_NAME) fun pinnedStatusNotUpdatedToSystem_whenPinnedBySystem_whenNoHunBehaviorEnabled() { row.setPinnedStatus(PinnedStatus.PinnedBySystem) setHeadsUpNotifOnManager(entry) underTest.onHeadsUpPinned(entry) assertThat(underTest.pinnedStatus).isEqualTo(PinnedStatus.NotPinned) } @Test @EnableFlags(StatusBarNotifChips.FLAG_NAME) fun pinnedStatusUpdatedToNotPinned_whenPinnedByUser_andFlagOn() { @DisableFlags(StatusBarNoHunBehavior.FLAG_NAME) fun pinnedStatusUpdatedToNotPinned_whenPinnedByUser_andNotifChipsFlagOn() { row.setPinnedStatus(PinnedStatus.PinnedByUser) setHeadsUpNotifOnManager(entry) underTest.onHeadsUpPinned(entry) Loading @@ -182,6 +206,7 @@ class HeadsUpAppearanceControllerTest : SysuiTestCase() { } @Test @DisableFlags(StatusBarNoHunBehavior.FLAG_NAME) fun isolatedIconSet_whenPinnedBySystem() = kosmos.runTest { val latestIsolatedIcon by Loading @@ -201,8 +226,22 @@ class HeadsUpAppearanceControllerTest : SysuiTestCase() { } @Test @DisableFlags(StatusBarNotifChips.FLAG_NAME) fun isolatedIconSet_whenPinnedByUser_andFlagOff() = @EnableFlags(StatusBarNoHunBehavior.FLAG_NAME) fun isolatedIconNotSet_whenPinnedBySystem_whenNoHunBehaviorEnabled() = kosmos.runTest { val latestIsolatedIcon by collectLastValue(kosmos.headsUpNotificationIconInteractor.isolatedNotification) row.setPinnedStatus(PinnedStatus.PinnedBySystem) setHeadsUpNotifOnManager(entry) underTest.onHeadsUpPinned(entry) assertThat(latestIsolatedIcon).isNull() } @Test @DisableFlags(StatusBarNotifChips.FLAG_NAME, StatusBarNoHunBehavior.FLAG_NAME) fun isolatedIconSet_whenPinnedByUser_andNotifChipsFlagOff() = kosmos.runTest { val latestIsolatedIcon by collectLastValue(kosmos.headsUpNotificationIconInteractor.isolatedNotification) Loading @@ -216,7 +255,7 @@ class HeadsUpAppearanceControllerTest : SysuiTestCase() { @Test @EnableFlags(StatusBarNotifChips.FLAG_NAME) fun isolatedIconNotSet_whenPinnedByUser_andFlagOn() = fun isolatedIconNotSet_whenPinnedByUser_andNotifChipsFlagOn() = kosmos.runTest { val latestIsolatedIcon by collectLastValue(kosmos.headsUpNotificationIconInteractor.isolatedNotification) Loading @@ -243,6 +282,7 @@ class HeadsUpAppearanceControllerTest : SysuiTestCase() { } @Test @DisableFlags(StatusBarNoHunBehavior.FLAG_NAME) fun operatorNameViewUpdated_whenPinnedBySystem() { underTest.setAnimationsEnabled(false) Loading @@ -258,8 +298,20 @@ class HeadsUpAppearanceControllerTest : SysuiTestCase() { } @Test @DisableFlags(StatusBarNotifChips.FLAG_NAME) fun operatorNameViewUpdated_whenPinnedByUser_andFlagOff() { @EnableFlags(StatusBarNoHunBehavior.FLAG_NAME) fun operatorNameViewNotUpdated_whenPinnedBySystem_whenNoHunBehaviorEnabled() { underTest.setAnimationsEnabled(false) row.setPinnedStatus(PinnedStatus.PinnedBySystem) setHeadsUpNotifOnManager(entry) underTest.onHeadsUpPinned(entry) assertThat(operatorNameView.visibility).isEqualTo(View.VISIBLE) } @Test @DisableFlags(StatusBarNotifChips.FLAG_NAME, StatusBarNoHunBehavior.FLAG_NAME) fun operatorNameViewUpdated_whenPinnedByUser_andNotifChipsFlagOff() { underTest.setAnimationsEnabled(false) row.setPinnedStatus(PinnedStatus.PinnedByUser) Loading @@ -271,7 +323,7 @@ class HeadsUpAppearanceControllerTest : SysuiTestCase() { @Test @EnableFlags(StatusBarNotifChips.FLAG_NAME) fun operatorNameViewNotUpdated_whenPinnedByUser_andFlagOn() { fun operatorNameViewNotUpdated_whenPinnedByUser_andNotifChipsFlagOn() { underTest.setAnimationsEnabled(false) // WHEN the row was pinned by the user Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/shared/ui/viewmodel/HomeStatusBarViewModelImplTest.kt +58 −7 Original line number Diff line number Diff line Loading @@ -70,6 +70,7 @@ import com.android.systemui.statusbar.events.data.repository.systemStatusEventAn import com.android.systemui.statusbar.events.shared.model.SystemEventAnimationState.AnimatingIn import com.android.systemui.statusbar.events.shared.model.SystemEventAnimationState.AnimatingOut import com.android.systemui.statusbar.events.shared.model.SystemEventAnimationState.Idle import com.android.systemui.statusbar.headsup.shared.StatusBarNoHunBehavior import com.android.systemui.statusbar.notification.data.model.activeNotificationModel import com.android.systemui.statusbar.notification.data.repository.ActiveNotificationsStore import com.android.systemui.statusbar.notification.data.repository.UnconfinedFakeHeadsUpRowRepository Loading Loading @@ -552,9 +553,10 @@ class HomeStatusBarViewModelImplTest : SysuiTestCase() { } @Test fun shouldShowOperatorNameView_allowedByInteractor_hunPinned_false() = @DisableFlags(StatusBarNoHunBehavior.FLAG_NAME) fun shouldShowOperatorNameView_allowedByInteractor_hunPinned_noHunBehaviorFlagOff_false() = kosmos.runTest { kosmos.setHomeStatusBarInteractorShowOperatorName(false) kosmos.setHomeStatusBarInteractorShowOperatorName(true) transitionKeyguardToGone() Loading @@ -565,7 +567,7 @@ class HomeStatusBarViewModelImplTest : SysuiTestCase() { headsUpNotificationRepository.setNotifications( UnconfinedFakeHeadsUpRowRepository( key = "key", pinnedStatus = MutableStateFlow(PinnedStatus.PinnedByUser), pinnedStatus = MutableStateFlow(PinnedStatus.PinnedBySystem), ) ) Loading @@ -574,6 +576,31 @@ class HomeStatusBarViewModelImplTest : SysuiTestCase() { assertThat(latest).isFalse() } @Test @EnableFlags(StatusBarNoHunBehavior.FLAG_NAME) fun shouldShowOperatorNameView_allowedByInteractor_hunPinned_noHunBehaviorFlagOn_true() = kosmos.runTest { kosmos.setHomeStatusBarInteractorShowOperatorName(true) transitionKeyguardToGone() fakeDisableFlagsRepository.disableFlags.value = DisableFlagsModel(DISABLE_NONE, DISABLE2_NONE) // WHEN there is an active HUN headsUpNotificationRepository.setNotifications( UnconfinedFakeHeadsUpRowRepository( key = "key", pinnedStatus = MutableStateFlow(PinnedStatus.PinnedBySystem), ) ) val latest by collectLastValue(underTest.shouldShowOperatorNameView) // THEN we still show the operator name view if NoHunBehavior flag is enabled assertThat(latest).isTrue() } @Test fun shouldHomeStatusBarBeVisible_keyguardNotGone_noHun_false() = kosmos.runTest { Loading Loading @@ -692,7 +719,7 @@ class HomeStatusBarViewModelImplTest : SysuiTestCase() { @Test @EnableFlags(StatusBarNotifChips.FLAG_NAME) fun isClockVisible_allowedByFlags_hunPinnedByUser_visible() = fun isClockVisible_allowedByDisableFlags_hunPinnedByUser_visible() = kosmos.runTest { val latest by collectLastValue(underTest.isClockVisible) transitionKeyguardToGone() Loading @@ -711,7 +738,8 @@ class HomeStatusBarViewModelImplTest : SysuiTestCase() { } @Test fun isClockVisible_allowedByFlags_hunPinnedBySystem_notVisible() = @DisableFlags(StatusBarNoHunBehavior.FLAG_NAME) fun isClockVisible_allowedByDisableFlags_hunPinnedBySystem_noHunBehaviorFlagOff_notVisible() = kosmos.runTest { val latest by collectLastValue(underTest.isClockVisible) transitionKeyguardToGone() Loading @@ -730,7 +758,29 @@ class HomeStatusBarViewModelImplTest : SysuiTestCase() { } @Test fun isClockVisible_allowedByFlags_hunBecomesInactive_visibleAgain() = @EnableFlags(StatusBarNoHunBehavior.FLAG_NAME) fun isClockVisible_allowedByDisableFlags_hunPinnedBySystem_noHunBehaviorFlagOn_visible() = kosmos.runTest { val latest by collectLastValue(underTest.isClockVisible) transitionKeyguardToGone() fakeDisableFlagsRepository.disableFlags.value = DisableFlagsModel(DISABLE_NONE, DISABLE2_NONE) // WHEN there is an active HUN headsUpNotificationRepository.setNotifications( UnconfinedFakeHeadsUpRowRepository( key = "key", pinnedStatus = MutableStateFlow(PinnedStatus.PinnedBySystem), ) ) // THEN we still show the clock view if NoHunBehavior flag is enabled assertThat(latest!!.visibility).isEqualTo(View.VISIBLE) } @Test @DisableFlags(StatusBarNoHunBehavior.FLAG_NAME) fun isClockVisible_allowedByDisableFlags_hunBecomesInactive_visibleAgain() = kosmos.runTest { val latest by collectLastValue(underTest.isClockVisible) transitionKeyguardToGone() Loading @@ -753,7 +803,8 @@ class HomeStatusBarViewModelImplTest : SysuiTestCase() { } @Test fun isClockVisible_disabledByFlags_hunBecomesInactive_neverVisible() = @DisableFlags(StatusBarNoHunBehavior.FLAG_NAME) fun isClockVisible_disableFlagsProhibitClock_hunBecomesInactive_neverVisible() = kosmos.runTest { val latest by collectLastValue(underTest.isClockVisible) transitionKeyguardToGone() Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/ui/viewmodel/KeyguardStatusBarViewModelTest.kt +25 −1 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package com.android.systemui.statusbar.ui.viewmodel import android.platform.test.annotations.DisableFlags import android.platform.test.annotations.EnableFlags import android.platform.test.flag.junit.FlagsParameterization import androidx.test.filters.SmallTest import com.android.systemui.SysuiTestCase Loading @@ -32,6 +34,7 @@ import com.android.systemui.scene.data.repository.sceneContainerRepository import com.android.systemui.scene.domain.interactor.sceneInteractor import com.android.systemui.scene.shared.model.Scenes import com.android.systemui.statusbar.domain.interactor.keyguardStatusBarInteractor import com.android.systemui.statusbar.headsup.shared.StatusBarNoHunBehavior import com.android.systemui.statusbar.notification.data.repository.FakeHeadsUpRowRepository import com.android.systemui.statusbar.notification.stack.data.repository.headsUpNotificationRepository import com.android.systemui.statusbar.notification.stack.domain.interactor.headsUpNotificationInteractor Loading Loading @@ -127,7 +130,8 @@ class KeyguardStatusBarViewModelTest(flags: FlagsParameterization) : SysuiTestCa @Test @EnableSceneContainer fun isVisible_headsUpStatusBarShown_false() = @DisableFlags(StatusBarNoHunBehavior.FLAG_NAME) fun isVisible_headsUpShown_noHunBehaviorFlagOff_false() = testScope.runTest { val latest by collectLastValue(underTest.isVisible) Loading @@ -144,6 +148,26 @@ class KeyguardStatusBarViewModelTest(flags: FlagsParameterization) : SysuiTestCa assertThat(latest).isFalse() } @Test @EnableSceneContainer @EnableFlags(StatusBarNoHunBehavior.FLAG_NAME) fun isVisible_headsUpShown_noHunBehaviorFlagOn_true() = testScope.runTest { val latest by collectLastValue(underTest.isVisible) // WHEN HUN displayed on the bypass lock screen headsUpRepository.setNotifications(FakeHeadsUpRowRepository("key 0", isPinned = true)) keyguardTransitionRepository.emitInitialStepsFromOff( KeyguardState.LOCKSCREEN, testSetup = true, ) kosmos.sceneContainerRepository.snapToScene(Scenes.Lockscreen) faceAuthRepository.isBypassEnabled.value = true // THEN KeyguardStatusBar is still visible because StatusBarNoHunBehavior is enabled assertThat(latest).isTrue() } @Test fun isVisible_sceneLockscreen_andNotDozing_andNotShowingHeadsUpStatusBar_true() = testScope.runTest { Loading