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

Commit c6f71651 authored by Chandru S's avatar Chandru S Committed by Android (Google) Code Review
Browse files

Merge changes I1f61bcb7,I91638147 into main

* changes:
  Makes sure that notifications are visible on shade behind the bouncer
  Blur NSSL view when opening the primary bouncer from the shade
parents 402456a5 3bdf5b80
Loading
Loading
Loading
Loading
+44 −0
Original line number Original line Diff line number Diff line
@@ -16,10 +16,13 @@


package com.android.systemui.keyguard.ui.viewmodel
package com.android.systemui.keyguard.ui.viewmodel


import android.platform.test.annotations.EnableFlags
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.SmallTest
import androidx.test.filters.SmallTest
import com.android.systemui.Flags.FLAG_BOUNCER_UI_REVAMP
import com.android.systemui.SysuiTestCase
import com.android.systemui.SysuiTestCase
import com.android.systemui.coroutines.collectValues
import com.android.systemui.coroutines.collectValues
import com.android.systemui.flags.BrokenWithSceneContainer
import com.android.systemui.flags.Flags
import com.android.systemui.flags.Flags
import com.android.systemui.flags.fakeFeatureFlagsClassic
import com.android.systemui.flags.fakeFeatureFlagsClassic
import com.android.systemui.keyguard.data.repository.fakeKeyguardTransitionRepository
import com.android.systemui.keyguard.data.repository.fakeKeyguardTransitionRepository
@@ -71,6 +74,28 @@ class AlternateBouncerToPrimaryBouncerTransitionViewModelTest : SysuiTestCase()
            values.forEach { assertThat(it).isEqualTo(0f) }
            values.forEach { assertThat(it).isEqualTo(0f) }
        }
        }


    @Test
    @EnableFlags(FLAG_BOUNCER_UI_REVAMP)
    @BrokenWithSceneContainer(388068805)
    fun notifications_areFullyVisible_whenShadeIsOpen() =
        testScope.runTest {
            val values by collectValues(underTest.notificationAlpha)
            kosmos.bouncerWindowBlurTestUtil.shadeExpanded(true)

            keyguardTransitionRepository.sendTransitionSteps(
                listOf(
                    step(0f, TransitionState.STARTED),
                    step(0.1f),
                    step(0.2f),
                    step(0.3f),
                    step(1f),
                ),
                testScope,
            )

            values.forEach { assertThat(it).isEqualTo(1f) }
        }

    @Test
    @Test
    fun blurRadiusGoesToMaximumWhenShadeIsExpanded() =
    fun blurRadiusGoesToMaximumWhenShadeIsExpanded() =
        testScope.runTest {
        testScope.runTest {
@@ -87,6 +112,25 @@ class AlternateBouncerToPrimaryBouncerTransitionViewModelTest : SysuiTestCase()
            )
            )
        }
        }


    @Test
    @EnableFlags(FLAG_BOUNCER_UI_REVAMP)
    @BrokenWithSceneContainer(388068805)
    fun notificationBlur_isNonZero_whenShadeIsExpanded() =
        testScope.runTest {
            val values by collectValues(underTest.notificationBlurRadius)

            kosmos.bouncerWindowBlurTestUtil.shadeExpanded(true)

            kosmos.bouncerWindowBlurTestUtil.assertTransitionToBlurRadius(
                transitionProgress = listOf(0f, 0f, 0.1f, 0.2f, 0.3f, 1f),
                startValue = kosmos.blurConfig.maxBlurRadiusPx / 3.0f,
                endValue = kosmos.blurConfig.maxBlurRadiusPx / 3.0f,
                transitionFactory = ::step,
                actualValuesProvider = { values },
                checkInterpolatedValues = false,
            )
        }

    @Test
    @Test
    fun blurRadiusGoesFromMinToMaxWhenShadeIsNotExpanded() =
    fun blurRadiusGoesFromMinToMaxWhenShadeIsNotExpanded() =
        testScope.runTest {
        testScope.runTest {
+42 −2
Original line number Original line Diff line number Diff line
@@ -16,9 +16,11 @@


package com.android.systemui.keyguard.ui.viewmodel
package com.android.systemui.keyguard.ui.viewmodel


import android.platform.test.annotations.EnableFlags
import android.platform.test.flag.junit.FlagsParameterization
import android.platform.test.flag.junit.FlagsParameterization
import androidx.test.filters.SmallTest
import androidx.test.filters.SmallTest
import com.android.compose.animation.scene.ObservableTransitionState
import com.android.compose.animation.scene.ObservableTransitionState
import com.android.systemui.Flags.FLAG_BOUNCER_UI_REVAMP
import com.android.systemui.SysuiTestCase
import com.android.systemui.SysuiTestCase
import com.android.systemui.coroutines.collectLastValue
import com.android.systemui.coroutines.collectLastValue
import com.android.systemui.coroutines.collectValues
import com.android.systemui.coroutines.collectValues
@@ -153,7 +155,7 @@ class LockscreenToPrimaryBouncerTransitionViewModelTest(flags: FlagsParameteriza
        }
        }


    @Test
    @Test
    @BrokenWithSceneContainer(330311871)
    @BrokenWithSceneContainer(388068805)
    fun blurRadiusIsMaxWhenShadeIsExpanded() =
    fun blurRadiusIsMaxWhenShadeIsExpanded() =
        testScope.runTest {
        testScope.runTest {
            val values by collectValues(underTest.windowBlurRadius)
            val values by collectValues(underTest.windowBlurRadius)
@@ -170,7 +172,7 @@ class LockscreenToPrimaryBouncerTransitionViewModelTest(flags: FlagsParameteriza
        }
        }


    @Test
    @Test
    @BrokenWithSceneContainer(330311871)
    @BrokenWithSceneContainer(388068805)
    fun blurRadiusGoesFromMinToMaxWhenShadeIsNotExpanded() =
    fun blurRadiusGoesFromMinToMaxWhenShadeIsNotExpanded() =
        testScope.runTest {
        testScope.runTest {
            val values by collectValues(underTest.windowBlurRadius)
            val values by collectValues(underTest.windowBlurRadius)
@@ -185,6 +187,44 @@ class LockscreenToPrimaryBouncerTransitionViewModelTest(flags: FlagsParameteriza
            )
            )
        }
        }


    @Test
    @EnableFlags(FLAG_BOUNCER_UI_REVAMP)
    @BrokenWithSceneContainer(388068805)
    fun notificationBlur_isNonZero_whenShadeIsExpanded() =
        testScope.runTest {
            val values by collectValues(underTest.notificationBlurRadius)
            kosmos.bouncerWindowBlurTestUtil.shadeExpanded(true)
            runCurrent()

            kosmos.bouncerWindowBlurTestUtil.assertTransitionToBlurRadius(
                transitionProgress = listOf(0f, 0f, 0.1f, 0.2f, 0.3f, 1f),
                startValue = kosmos.blurConfig.maxBlurRadiusPx / 3.0f,
                endValue = kosmos.blurConfig.maxBlurRadiusPx / 3.0f,
                transitionFactory = ::step,
                actualValuesProvider = { values },
                checkInterpolatedValues = false,
            )
        }

    @Test
    @EnableFlags(FLAG_BOUNCER_UI_REVAMP)
    @BrokenWithSceneContainer(388068805)
    fun notifications_areFullyVisible_whenShadeIsExpanded() =
        testScope.runTest {
            val values by collectValues(underTest.notificationAlpha)
            kosmos.bouncerWindowBlurTestUtil.shadeExpanded(true)
            runCurrent()

            kosmos.bouncerWindowBlurTestUtil.assertTransitionToBlurRadius(
                transitionProgress = listOf(0f, 0f, 0.1f, 0.2f, 0.3f, 1f),
                startValue = 1.0f,
                endValue = 1.0f,
                transitionFactory = ::step,
                actualValuesProvider = { values },
                checkInterpolatedValues = false,
            )
        }

    private fun step(
    private fun step(
        value: Float,
        value: Float,
        state: TransitionState = TransitionState.RUNNING,
        state: TransitionState = TransitionState.RUNNING,
+14 −0
Original line number Original line Diff line number Diff line
@@ -70,6 +70,7 @@ import com.android.systemui.shade.shared.flag.DualShade
import com.android.systemui.statusbar.notification.stack.domain.interactor.sharedNotificationContainerInteractor
import com.android.systemui.statusbar.notification.stack.domain.interactor.sharedNotificationContainerInteractor
import com.android.systemui.statusbar.notification.stack.ui.viewmodel.SharedNotificationContainerViewModel.HorizontalPosition
import com.android.systemui.statusbar.notification.stack.ui.viewmodel.SharedNotificationContainerViewModel.HorizontalPosition
import com.android.systemui.testKosmos
import com.android.systemui.testKosmos
import com.android.systemui.window.ui.viewmodel.fakeBouncerTransitions
import com.google.common.collect.Range
import com.google.common.collect.Range
import com.google.common.truth.Truth.assertThat
import com.google.common.truth.Truth.assertThat
import kotlin.test.assertIs
import kotlin.test.assertIs
@@ -1395,6 +1396,19 @@ class SharedNotificationContainerViewModelTest(flags: FlagsParameterization) : S
            assertThat(stackAbsoluteBottom).isEqualTo(100F)
            assertThat(stackAbsoluteBottom).isEqualTo(100F)
        }
        }


    @Test
    fun blurRadius_emitsValues_fromPrimaryBouncerTransitions() =
        testScope.runTest {
            val blurRadius by collectLastValue(underTest.blurRadius)
            assertThat(blurRadius).isEqualTo(0.0f)

            kosmos.fakeBouncerTransitions.first().notificationBlurRadius.value = 30.0f
            assertThat(blurRadius).isEqualTo(30.0f)

            kosmos.fakeBouncerTransitions.last().notificationBlurRadius.value = 40.0f
            assertThat(blurRadius).isEqualTo(40.0f)
        }

    private suspend fun TestScope.showLockscreen() {
    private suspend fun TestScope.showLockscreen() {
        shadeTestUtil.setQsExpansion(0f)
        shadeTestUtil.setQsExpansion(0f)
        shadeTestUtil.setLockscreenShadeExpansion(0f)
        shadeTestUtil.setLockscreenShadeExpansion(0f)
+6 −0
Original line number Original line Diff line number Diff line
@@ -23,4 +23,10 @@ data class BlurConfig(val minBlurRadiusPx: Float, val maxBlurRadiusPx: Float) {
    // No-op config that will be used by dagger of other SysUI variants which don't blur the
    // No-op config that will be used by dagger of other SysUI variants which don't blur the
    // background surface.
    // background surface.
    @Inject constructor() : this(0.0f, 0.0f)
    @Inject constructor() : this(0.0f, 0.0f)

    companion object {
        // Blur the shade much lesser than the background surface so that the surface is
        // distinguishable from the background.
        @JvmStatic fun Float.maxBlurRadiusToNotificationPanelBlurRadius(): Float = this / 3.0f
    }
}
}
+3 −0
Original line number Original line Diff line number Diff line
@@ -30,6 +30,9 @@ interface PrimaryBouncerTransition {
    /** Radius of blur applied to the window's root view. */
    /** Radius of blur applied to the window's root view. */
    val windowBlurRadius: Flow<Float>
    val windowBlurRadius: Flow<Float>


    /** Radius of blur applied to the notifications on expanded shade */
    val notificationBlurRadius: Flow<Float>

    fun transitionProgressToBlurRadius(
    fun transitionProgressToBlurRadius(
        starBlurRadius: Float,
        starBlurRadius: Float,
        endBlurRadius: Float,
        endBlurRadius: Float,
Loading