Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7d7ad022 authored by Caitlin Shkuratov's avatar Caitlin Shkuratov
Browse files

[SB] Don't show home status bar on lockscreen, even for HUNs.

Previously, we needed to show the home status bar on lockscreen when a
HUN came in so that the HUN's app name would show. But we don't need to
do that when StatusBarNoHunBehavior is enabled.

Fixes: 406419894
Bug: 385740230
Flag: com.android.systemui.status_bar_no_hun_behavior

Test: no_hun_behavior enabled & root_modernization enabled: Have face
unlock with bypass enabled. While on lockscreen *after face unlock
fails*, receive a HUN -> verify home status bar never appears, carrier
text is always shown in the left part of the status bar while the HUN is
shown
Test: no_hun_behavior enabled & root_modernization *disabled* -> verify
same behavior

Test: no_hun_behavior *disabled* & root_modernization disabled: Have
face unlock with bypass enabled. While on lockscreen *after face unlock
fails*, receive a HUN -> verify carrier text in status bar hides and HUN
app name + app icon shows

Test: atest HomeStatusBarViewModelImplTest
Change-Id: Iadff4590ab811085cc3e59a41e24a5d33d6b7424
parent 177bd9fc
Loading
Loading
Loading
Loading
+103 −0
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@ import com.android.systemui.display.data.repository.displayRepository
import com.android.systemui.display.data.repository.fake
import com.android.systemui.flags.DisableSceneContainer
import com.android.systemui.flags.EnableSceneContainer
import com.android.systemui.keyguard.data.repository.fakeDeviceEntryFaceAuthRepository
import com.android.systemui.keyguard.data.repository.fakeKeyguardTransitionRepository
import com.android.systemui.keyguard.data.repository.keyguardOcclusionRepository
import com.android.systemui.keyguard.domain.interactor.keyguardInteractor
@@ -1014,6 +1015,108 @@ class HomeStatusBarViewModelImplTest : SysuiTestCase() {
            assertIsCallChip(underTest.ongoingActivityChips.chips.active[1], "call", context)
        }

    @Test
    @DisableSceneContainer
    @DisableFlags(StatusBarNoHunBehavior.FLAG_NAME)
    fun hunOnLockscreenWithBypass_sceneFlagOff_noHunFlagOff_everythingVisible() =
        kosmos.runTest {
            val latestNotifs by collectLastValue(underTest.isNotificationIconContainerVisible)
            val latestSystemInfo by collectLastValue(underTest.systemInfoCombinedVis)

            // WHEN on lockscreen with bypass enabled
            fakeKeyguardTransitionRepository.transitionTo(
                KeyguardState.GONE,
                KeyguardState.LOCKSCREEN,
            )
            fakeDeviceEntryFaceAuthRepository.isBypassEnabled.value = true
            // WHEN there's a HUN
            headsUpNotificationRepository.setNotifications(
                UnconfinedFakeHeadsUpRowRepository(
                    key = "key",
                    pinnedStatus = MutableStateFlow(PinnedStatus.PinnedBySystem),
                )
            )

            // THEN status bar content shows if StatusBarNoHunBehavior is off
            assertThat(latestNotifs!!.visibility).isEqualTo(View.VISIBLE)
            assertThat(latestSystemInfo!!.baseVisibility.visibility).isEqualTo(View.VISIBLE)
        }

    @Test
    @EnableSceneContainer
    @DisableFlags(StatusBarNoHunBehavior.FLAG_NAME)
    fun hunOnLockscreenWithBypass_sceneFlagOn_noHunFlagOff_everythingVisible() =
        kosmos.runTest {
            val latestNotifs by collectLastValue(underTest.isNotificationIconContainerVisible)
            val latestSystemInfo by collectLastValue(underTest.systemInfoCombinedVis)

            // WHEN on lockscreen with bypass enabled
            sceneContainerRepository.snapToScene(Scenes.Lockscreen)
            fakeDeviceEntryFaceAuthRepository.isBypassEnabled.value = true
            // WHEN there's a HUN
            headsUpNotificationRepository.setNotifications(
                UnconfinedFakeHeadsUpRowRepository(
                    key = "key",
                    pinnedStatus = MutableStateFlow(PinnedStatus.PinnedBySystem),
                )
            )

            // THEN status bar content shows if StatusBarNoHunBehavior is off
            assertThat(latestNotifs!!.visibility).isEqualTo(View.VISIBLE)
            assertThat(latestSystemInfo!!.baseVisibility.visibility).isEqualTo(View.VISIBLE)
        }

    @Test
    @DisableSceneContainer
    @EnableFlags(StatusBarNoHunBehavior.FLAG_NAME)
    fun hunOnLockscreenWithBypass_sceneFlagOff_noHunFlagOn_everythingHidden() =
        kosmos.runTest {
            val latestNotifs by collectLastValue(underTest.isNotificationIconContainerVisible)
            val latestSystemInfo by collectLastValue(underTest.systemInfoCombinedVis)

            // WHEN on lockscreen with bypass enabled
            fakeKeyguardTransitionRepository.transitionTo(
                KeyguardState.GONE,
                KeyguardState.LOCKSCREEN,
            )
            fakeDeviceEntryFaceAuthRepository.isBypassEnabled.value = true
            // WHEN there's a HUN
            headsUpNotificationRepository.setNotifications(
                UnconfinedFakeHeadsUpRowRepository(
                    key = "key",
                    pinnedStatus = MutableStateFlow(PinnedStatus.PinnedBySystem),
                )
            )

            // THEN status bar content still hides if StatusBarNoHunBehavior is on
            assertThat(latestNotifs!!.visibility).isEqualTo(View.GONE)
            assertThat(latestSystemInfo!!.baseVisibility.visibility).isEqualTo(View.GONE)
        }

    @Test
    @EnableSceneContainer
    @EnableFlags(StatusBarNoHunBehavior.FLAG_NAME)
    fun hunOnLockscreenWithBypass_sceneFlagOn_noHunFlagOn_everythingHidden() =
        kosmos.runTest {
            val latestNotifs by collectLastValue(underTest.isNotificationIconContainerVisible)
            val latestSystemInfo by collectLastValue(underTest.systemInfoCombinedVis)

            // WHEN on lockscreen with bypass enabled
            sceneContainerRepository.snapToScene(Scenes.Lockscreen)
            fakeDeviceEntryFaceAuthRepository.isBypassEnabled.value = true
            // WHEN there's a HUN
            headsUpNotificationRepository.setNotifications(
                UnconfinedFakeHeadsUpRowRepository(
                    key = "key",
                    pinnedStatus = MutableStateFlow(PinnedStatus.PinnedBySystem),
                )
            )

            // THEN status bar content still hides if StatusBarNoHunBehavior is on
            assertThat(latestNotifs!!.visibility).isEqualTo(View.GONE)
            assertThat(latestSystemInfo!!.baseVisibility.visibility).isEqualTo(View.GONE)
        }

    @Test
    fun isClockVisible_allowedByDisableFlags_visible() =
        kosmos.runTest {
+9 −1
Original line number Diff line number Diff line
@@ -400,6 +400,14 @@ constructor(
                keyguardInteractor.isSecureCameraActive,
                headsUpNotificationInteractor.statusBarHeadsUpStatus,
            ) { isHomeStatusBarAllowed, isSecureCameraActive, headsUpState ->
                val showForHeadsUp =
                    if (StatusBarNoHunBehavior.isEnabled) {
                        false
                    } else {
                        // HUNs can appear on lockscreen if face auth with bypass is enabled, in
                        // which case we need to show the HUN app name in the status bar
                        headsUpState.isPinned
                    }
                // When launching the camera over the lockscreen, the status icons would typically
                // become visible momentarily before animating out, since we're not yet aware that
                // the launching camera activity is fullscreen. Even once the activity finishes
@@ -407,7 +415,7 @@ constructor(
                // the icons and tells us to hide them. To ensure that this high-visibility
                // animation is smooth, keep the icons hidden during a camera launch. See
                // b/257292822.
                headsUpState.isPinned || (isHomeStatusBarAllowed && !isSecureCameraActive)
                showForHeadsUp || (isHomeStatusBarAllowed && !isSecureCameraActive)
            }
            .distinctUntilChanged()
            .logDiffsForTable(