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

Commit 73d3fc97 authored by Chris Göllner's avatar Chris Göllner
Browse files

Fix status bar not showing when shade expanded on another display

When flexiglass is enabled, the status bar gets hidden on all displays
when the shade is expanded on a single display.

Test: HomeStatusBarViewModelImplTest
Fixes: 416251363
Flag: com.android.systemui.shared.status_bar_connected_displays
Flag: com.android.systemui.shade_window_goes_around
Change-Id: Icf73a2209bbdd0a516fb4d20ec0f91c8be478858
parent 0e1761ff
Loading
Loading
Loading
Loading
+44 −0
Original line number Diff line number Diff line
@@ -674,6 +674,50 @@ class HomeStatusBarViewModelImplTest(flags: FlagsParameterization) : SysuiTestCa
            assertThat(latest).isFalse()
        }

    @Test
    @EnableFlags(Flags.FLAG_SHADE_WINDOW_GOES_AROUND)
    @EnableSceneContainer
    fun isHomeStatusBarAllowed_onExternalDisplay_whenNotificationShadeIsVisibleOnDefaultDisplay_isTrue() =
        kosmos.runTest {
            val underTest = homeStatusBarViewModelFactory(EXTERNAL_DISPLAY)
            val latest by collectLastValue(underTest.isHomeStatusBarAllowed)

            sceneContainerRepository.instantlyTransitionTo(Scenes.Gone)
            sceneContainerRepository.showOverlay(Overlays.NotificationsShade)
            fakeShadeDisplaysRepository.setDisplayId(DEFAULT_DISPLAY)

            assertThat(latest).isTrue()
        }

    @Test
    @EnableFlags(Flags.FLAG_SHADE_WINDOW_GOES_AROUND)
    @EnableSceneContainer
    fun isHomeStatusBarAllowed_onDefaultDisplay_whenShadeIsVisibleOnDefaultDisplay_isFalse() =
        kosmos.runTest {
            val latest by collectLastValue(underTest.isHomeStatusBarAllowed)

            sceneContainerRepository.instantlyTransitionTo(Scenes.Gone)
            sceneContainerRepository.showOverlay(Overlays.QuickSettingsShade)
            fakeShadeDisplaysRepository.setDisplayId(DEFAULT_DISPLAY)

            assertThat(latest).isFalse()
        }

    @Test
    @EnableFlags(Flags.FLAG_SHADE_WINDOW_GOES_AROUND)
    @EnableSceneContainer
    fun isHomeStatusBarAllowed_onExternalDisplay_whenShadeIsVisibleOnDefaultDisplay_isTrue() =
        kosmos.runTest {
            val underTest = homeStatusBarViewModelFactory(EXTERNAL_DISPLAY)
            val latest by collectLastValue(underTest.isHomeStatusBarAllowed)

            sceneContainerRepository.instantlyTransitionTo(Scenes.Gone)
            sceneContainerRepository.showOverlay(Overlays.QuickSettingsShade)
            fakeShadeDisplaysRepository.setDisplayId(DEFAULT_DISPLAY)

            assertThat(latest).isTrue()
        }

    @Test
    fun shouldShowOperatorNameView_allowedByInteractor_allowedByDisableFlags_visible() =
        kosmos.runTest {
+12 −11
Original line number Diff line number Diff line
@@ -348,18 +348,19 @@ constructor(
    private val isHomeStatusBarAllowedByScene: Flow<Boolean> =
        combine(
                sceneInteractor.currentScene,
                isShadeVisibleOnThisDisplay,
                isShadeVisibleOnAnyDisplay,
                sceneContainerOcclusionInteractor.invisibleDueToOcclusion,
            ) { currentScene, isShadeVisible, isOccluded ->

                // All scenes have their own status bars, so we should only show the home status bar
                // if we're not in a scene. There are two exceptions:
                // 1) The shade (notifications or quick settings) is shown, because it has its own
                // status-bar-like header.
                // 2) If the scene is occluded, then the occluding app needs to show the status bar.
                // (Fullscreen apps actually won't show the status bar but that's handled with the
                // rest of our fullscreen app logic, which lives elsewhere.)
                (currentScene == Scenes.Gone && !isShadeVisible) || isOccluded
                isShadeWindowOnThisDisplay,
            ) { currentScene, isShadeVisibleOnAnyDisplay, isOccluded, isShadeWindowOnThisDisplay ->
                if (isOccluded) {
                    true
                } else if (isShadeWindowOnThisDisplay) {
                    currentScene == Scenes.Gone && !isShadeVisibleOnAnyDisplay
                } else {
                    // When the shade is visible on another display,
                    // allow the home status bar on the current display.
                    currentScene == Scenes.Gone || isShadeVisibleOnAnyDisplay
                }
            }
            .distinctUntilChanged()
            .logDiffsForTable(