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

Commit dfffbc02 authored by brycelee's avatar brycelee
Browse files

Do not apply shade blur on transition to shade when dreaming.

Shade blur updates are triggered on shade state changes. In when the
new state is Shade and the device is dreaming, this is actually dream
entry. In this case, we should not apply a blur as it will affect dream
surfaces such as the overlay.

Fixes: 440661063
Test: atest NotificationShadeDepthControllerTest
Flag: com.android.systemui.no_shade_blur_on_dream_start
Change-Id: Ide47c86c04318096f9d391975f70b61f9c17b939
parent b94dec98
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -2204,6 +2204,16 @@ flag {
    }
}

flag {
    name: "no_shade_blur_on_dream_start"
    namespace: "systemui"
    description: "Suppress shade blur when starting dream"
    bug: "440661063"
    metadata {
      purpose: PURPOSE_BUGFIX
    }
}

flag {

    name: "qs_split_internet_tile"
+19 −0
Original line number Diff line number Diff line
@@ -106,6 +106,8 @@ class NotificationShadeDepthControllerTest : SysuiTestCase() {
    private val maxBlur = 150
    private lateinit var notificationShadeDepthController: NotificationShadeDepthController

    private val dreamingFlow = MutableStateFlow(false)

    @Before
    fun setup() {
        // Constructs kosmos.windowRootViewBlurInteractor after test starts to avoid the error that
@@ -130,6 +132,7 @@ class NotificationShadeDepthControllerTest : SysuiTestCase() {
        `when`(blurUtils.maxBlurRadius).thenReturn(maxBlur.toFloat())
        `when`(windowRootViewBlurInteractor.isBlurCurrentlySupported)
            .thenReturn(MutableStateFlow(true))
        `when`(keyguardInteractor.isDreaming).thenReturn(dreamingFlow)

        notificationShadeDepthController =
            NotificationShadeDepthController(
@@ -249,6 +252,22 @@ class NotificationShadeDepthControllerTest : SysuiTestCase() {
        verify(shadeAnimation).animateTo(eq(0))
    }

    @Test
    @EnableFlags(Flags.FLAG_NO_SHADE_BLUR_ON_DREAM_START)
    fun onStateChanged_noBlurEvaluation_ifShadeAndDreaming() {
        onPanelExpansionChanged_apliesBlur_ifShade()
        clearInvocations(choreographer)
        statusBarState = StatusBarState.KEYGUARD
        statusBarStateListener.onStateChanged(statusBarState)
        verify(shadeAnimation).animateTo(eq(0))

        clearInvocations(shadeAnimation)
        statusBarState = StatusBarState.SHADE
        dreamingFlow.value = true
        statusBarStateListener.onStateChanged(statusBarState)
        verify(shadeAnimation, never()).animateTo(anyInt())
    }

    @Test
    fun setQsPanelExpansion_appliesBlur() {
        statusBarState = StatusBarState.KEYGUARD
+13 −1
Original line number Diff line number Diff line
@@ -137,6 +137,8 @@ constructor(
    // Shade expansion offset that happens when pulling down on a HUN.
    var panelPullDownMinFraction = 0f

    var existingStatusBarState: Int? = null

    var shadeAnimation = DepthAnimation()

    @VisibleForTesting var brightnessMirrorSpring = DepthAnimation()
@@ -416,6 +418,16 @@ constructor(
    private val statusBarStateCallback =
        object : StatusBarStateController.StateListener {
            override fun onStateChanged(newState: Int) {
                if (Flags.noShadeBlurOnDreamStart()) {
                    if (existingStatusBarState == StatusBarState.KEYGUARD
                        && newState == StatusBarState.SHADE
                        && keyguardInteractor.isDreaming.value) {
                        return
                    }
                }

                existingStatusBarState = newState

                updateShadeAnimationBlur(
                    shadeExpansion,
                    prevTracking,
@@ -653,7 +665,7 @@ constructor(

        // Do not blur or zoom out the wallpaper if the blurred wallpaper is not supported.
        if (!windowRootViewBlurInteractor.isBlurredWallpaperSupported) {
            return;
            return
        }

        if (Flags.bouncerUiRevamp() || Flags.glanceableHubBlurredBackground()) {