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

Commit b302761d authored by Matt Pietal's avatar Matt Pietal
Browse files

Ensure alpha is reset on QS expansion

Setting a value of 1f when QS is fully expanded
allows for HUNs to show when unlocked.

Fixes: 329231698
Test: atest SharedNotificationContainerViewModelTest
Flag: ACONFIG com.android.systemui.migrate_clocks_to_blueprint
TEAMFOOD

Change-Id: I3a833d61ecba3d3b36ea0f6e581f7bf4fd98b0e3
parent 4127d641
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
@@ -38,6 +38,7 @@ import com.android.systemui.keyguard.shared.model.TransitionState
import com.android.systemui.keyguard.shared.model.TransitionStep
import com.android.systemui.keyguard.ui.viewmodel.AodBurnInViewModel
import com.android.systemui.keyguard.ui.viewmodel.BurnInParameters
import com.android.systemui.keyguard.ui.viewmodel.ViewStateAccessor
import com.android.systemui.keyguard.ui.viewmodel.aodBurnInViewModel
import com.android.systemui.keyguard.ui.viewmodel.keyguardRootViewModel
import com.android.systemui.kosmos.testScope
@@ -698,6 +699,25 @@ class SharedNotificationContainerViewModelTest : SysuiTestCase() {
            assertThat(bounds).isEqualTo(NotificationContainerBounds(top = top, bottom = bottom))
        }

    @Test
    fun alphaOnFullQsExpansion() =
        testScope.runTest {
            val viewState = ViewStateAccessor()
            val alpha by collectLastValue(underTest.keyguardAlpha(viewState))

            showLockscreenWithQSExpanded()

            // Alpha fades out as QS expands
            shadeRepository.setQsExpansion(0.5f)
            assertThat(alpha).isWithin(0.01f).of(0.5f)
            shadeRepository.setQsExpansion(0.9f)
            assertThat(alpha).isWithin(0.01f).of(0.1f)

            // Ensure that alpha is set back to 1f when QS is fully expanded
            shadeRepository.setQsExpansion(1f)
            assertThat(alpha).isEqualTo(1f)
        }

    @Test
    fun shadeCollapseFadeIn() =
        testScope.runTest {
+3 −0
Original line number Diff line number Diff line
@@ -350,6 +350,9 @@ constructor(
                    if (shadeExpansion > 0f || qsExpansion > 0f) {
                        if (configurationBasedDimensions.useSplitShade) {
                            emit(1f)
                        } else if (qsExpansion == 1f) {
                            // Ensure HUNs will be visible in QS shade (at least while unlocked)
                            emit(1f)
                        } else {
                            // Fade as QS shade expands
                            emit(1f - qsExpansion)