diff options
| author | 2025-03-07 15:41:20 +0000 | |
|---|---|---|
| committer | 2025-03-07 07:51:43 -0800 | |
| commit | 117dd373fceb2400d7abf1ddda08095a508c94db (patch) | |
| tree | 7738e8a9556f09f96cfd7101b3656c6411ad716b | |
| parent | 18c20b49b3181bec580e066ba0a7662fd8e29932 (diff) | |
[SB] Keep status bar hidden throughout the QQS -> QS transition.
`ShadeInteractor.isAnyFullyExpanded` is true once QQS is fully visible,
but as you do the QQS -> QS transition it becomes `false` during the
transition and `true` again at the end. (During the transition, neither
QQS nor QS is _fully_ visible)
The status bar should stay hidden throughout the QQS -> QS transition
because the shade is always covering it. So the status bar needs to
listen to a different `ShadeInteractor` flow that will stay `true`
throughout. In this CL, the status bar hides as long as at
least 20% of either shade *or* QS is visible (during the first 20% of
the nothing->QQS transition, the home status bar is still visible on
screen so we shouldn't hide it yet).
Bug: 394257529 (specifically comment24)
Bug: 364360986
Flag: com.android.systemui.status_bar_root_modernization
Test: Perform QQS -> QS transition, and QS -> QQS transition -> verify
status bar doesn't draw any frames
Test: atest HomeStatusBarViewModelImplTest
Change-Id: Ib1796c1aa2a32687f95c7dcea286b59d320a6026
2 files changed, 117 insertions, 2 deletions
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/shared/ui/viewmodel/HomeStatusBarViewModelImplTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/shared/ui/viewmodel/HomeStatusBarViewModelImplTest.kt index 12cf3b6cd2cf..2da692b4cb45 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/shared/ui/viewmodel/HomeStatusBarViewModelImplTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/shared/ui/viewmodel/HomeStatusBarViewModelImplTest.kt @@ -1513,7 +1513,39 @@ class HomeStatusBarViewModelImplTest : SysuiTestCase() { @Test @DisableSceneContainer - fun shadeShown_sceneFlagOff_noStatusBarViewsShown() = + fun shadeSlightlyShown_sceneFlagOff_statusBarViewsShown() = + kosmos.runTest { + val clockVisible by collectLastValue(underTest.isClockVisible) + val notifIconsVisible by collectLastValue(underTest.isNotificationIconContainerVisible) + val systemInfoVisible by collectLastValue(underTest.systemInfoCombinedVis) + transitionKeyguardToGone() + + kosmos.shadeTestUtil.setShadeExpansion(0.1f) + + assertThat(clockVisible!!.visibility).isEqualTo(View.VISIBLE) + assertThat(notifIconsVisible!!.visibility).isEqualTo(View.VISIBLE) + assertThat(systemInfoVisible!!.baseVisibility.visibility).isEqualTo(View.VISIBLE) + } + + @Test + @DisableSceneContainer + fun shadeHalfShown_sceneFlagOff_noStatusBarViewsShown() = + kosmos.runTest { + val clockVisible by collectLastValue(underTest.isClockVisible) + val notifIconsVisible by collectLastValue(underTest.isNotificationIconContainerVisible) + val systemInfoVisible by collectLastValue(underTest.systemInfoCombinedVis) + transitionKeyguardToGone() + + kosmos.shadeTestUtil.setShadeExpansion(0.5f) + + assertThat(clockVisible!!.visibility).isEqualTo(View.INVISIBLE) + assertThat(notifIconsVisible!!.visibility).isEqualTo(View.GONE) + assertThat(systemInfoVisible!!.baseVisibility.visibility).isEqualTo(View.GONE) + } + + @Test + @DisableSceneContainer + fun shadeFullyShown_sceneFlagOff_noStatusBarViewsShown() = kosmos.runTest { val clockVisible by collectLastValue(underTest.isClockVisible) val notifIconsVisible by collectLastValue(underTest.isNotificationIconContainerVisible) @@ -1527,6 +1559,83 @@ class HomeStatusBarViewModelImplTest : SysuiTestCase() { assertThat(systemInfoVisible!!.baseVisibility.visibility).isEqualTo(View.GONE) } + /** Regression test for b/394257529#comment24. */ + @Test + @DisableSceneContainer + fun qqsToQsTransition_sceneFlagOff_statusBarViewsNeverShown() = + kosmos.runTest { + val clockVisible by collectLastValue(underTest.isClockVisible) + val notifIconsVisible by collectLastValue(underTest.isNotificationIconContainerVisible) + val systemInfoVisible by collectLastValue(underTest.systemInfoCombinedVis) + transitionKeyguardToGone() + + kosmos.shadeTestUtil.setShadeAndQsExpansion(shadeExpansion = 1f, qsExpansion = 0f) + assertThat(clockVisible!!.visibility).isEqualTo(View.INVISIBLE) + assertThat(notifIconsVisible!!.visibility).isEqualTo(View.GONE) + assertThat(systemInfoVisible!!.baseVisibility.visibility).isEqualTo(View.GONE) + + kosmos.shadeTestUtil.setShadeAndQsExpansion(shadeExpansion = 0.9f, qsExpansion = 0.1f) + assertThat(clockVisible!!.visibility).isEqualTo(View.INVISIBLE) + assertThat(notifIconsVisible!!.visibility).isEqualTo(View.GONE) + assertThat(systemInfoVisible!!.baseVisibility.visibility).isEqualTo(View.GONE) + + kosmos.shadeTestUtil.setShadeAndQsExpansion(shadeExpansion = 0.6f, qsExpansion = 0.4f) + assertThat(clockVisible!!.visibility).isEqualTo(View.INVISIBLE) + assertThat(notifIconsVisible!!.visibility).isEqualTo(View.GONE) + assertThat(systemInfoVisible!!.baseVisibility.visibility).isEqualTo(View.GONE) + + kosmos.shadeTestUtil.setShadeAndQsExpansion(shadeExpansion = 0.5f, qsExpansion = 0.5f) + assertThat(clockVisible!!.visibility).isEqualTo(View.INVISIBLE) + assertThat(notifIconsVisible!!.visibility).isEqualTo(View.GONE) + assertThat(systemInfoVisible!!.baseVisibility.visibility).isEqualTo(View.GONE) + + kosmos.shadeTestUtil.setShadeAndQsExpansion(shadeExpansion = 0.2f, qsExpansion = 0.8f) + assertThat(clockVisible!!.visibility).isEqualTo(View.INVISIBLE) + assertThat(notifIconsVisible!!.visibility).isEqualTo(View.GONE) + assertThat(systemInfoVisible!!.baseVisibility.visibility).isEqualTo(View.GONE) + + kosmos.shadeTestUtil.setShadeAndQsExpansion(shadeExpansion = 0f, qsExpansion = 1f) + assertThat(clockVisible!!.visibility).isEqualTo(View.INVISIBLE) + assertThat(notifIconsVisible!!.visibility).isEqualTo(View.GONE) + assertThat(systemInfoVisible!!.baseVisibility.visibility).isEqualTo(View.GONE) + } + + /** Regression test for b/394257529#comment24. */ + @Test + @DisableSceneContainer + fun qsToQqsTransition_sceneFlagOff_statusBarViewsNeverShown() = + kosmos.runTest { + val clockVisible by collectLastValue(underTest.isClockVisible) + val notifIconsVisible by collectLastValue(underTest.isNotificationIconContainerVisible) + val systemInfoVisible by collectLastValue(underTest.systemInfoCombinedVis) + transitionKeyguardToGone() + + kosmos.shadeTestUtil.setShadeAndQsExpansion(shadeExpansion = 0f, qsExpansion = 1f) + assertThat(clockVisible!!.visibility).isEqualTo(View.INVISIBLE) + assertThat(notifIconsVisible!!.visibility).isEqualTo(View.GONE) + assertThat(systemInfoVisible!!.baseVisibility.visibility).isEqualTo(View.GONE) + + kosmos.shadeTestUtil.setShadeAndQsExpansion(shadeExpansion = 0.3f, qsExpansion = 0.7f) + assertThat(clockVisible!!.visibility).isEqualTo(View.INVISIBLE) + assertThat(notifIconsVisible!!.visibility).isEqualTo(View.GONE) + assertThat(systemInfoVisible!!.baseVisibility.visibility).isEqualTo(View.GONE) + + kosmos.shadeTestUtil.setShadeAndQsExpansion(shadeExpansion = 0.5f, qsExpansion = 0.5f) + assertThat(clockVisible!!.visibility).isEqualTo(View.INVISIBLE) + assertThat(notifIconsVisible!!.visibility).isEqualTo(View.GONE) + assertThat(systemInfoVisible!!.baseVisibility.visibility).isEqualTo(View.GONE) + + kosmos.shadeTestUtil.setShadeAndQsExpansion(shadeExpansion = 0.7f, qsExpansion = 0.3f) + assertThat(clockVisible!!.visibility).isEqualTo(View.INVISIBLE) + assertThat(notifIconsVisible!!.visibility).isEqualTo(View.GONE) + assertThat(systemInfoVisible!!.baseVisibility.visibility).isEqualTo(View.GONE) + + kosmos.shadeTestUtil.setShadeAndQsExpansion(shadeExpansion = 1f, qsExpansion = 0f) + assertThat(clockVisible!!.visibility).isEqualTo(View.INVISIBLE) + assertThat(notifIconsVisible!!.visibility).isEqualTo(View.GONE) + assertThat(systemInfoVisible!!.baseVisibility.visibility).isEqualTo(View.GONE) + } + @Test @EnableSceneContainer fun shadeShown_sceneFlagOn_noStatusBarViewsShown() = diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/shared/ui/viewmodel/HomeStatusBarViewModel.kt b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/shared/ui/viewmodel/HomeStatusBarViewModel.kt index 3bae91a0ebe3..c717b180575c 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/shared/ui/viewmodel/HomeStatusBarViewModel.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/shared/ui/viewmodel/HomeStatusBarViewModel.kt @@ -262,6 +262,12 @@ constructor( override val popupChips get() = statusBarPopupChips.shownPopupChips + private val isShadeExpandedEnough = + // Keep the status bar visible while the shade is just starting to open, but otherwise + // hide it so that the status bar doesn't draw while it can't be seen. + // See b/394257529#comment24. + shadeInteractor.anyExpansion.map { it >= 0.2 }.distinctUntilChanged() + /** * Whether the display of this statusbar has the shade window (that is hosting shade container * and lockscreen, among other things). @@ -283,7 +289,7 @@ constructor( Overlays.QuickSettingsShade in currentOverlays) } } else { - shadeInteractor.isAnyFullyExpanded + isShadeExpandedEnough } private val isShadeVisibleOnThisDisplay: Flow<Boolean> = |