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

Commit 99a00cb1 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Trigger wallpaper and zoom out even when blur is not supported." into main

parents 22847604 d8452083
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -48,6 +48,7 @@ import com.android.wm.shell.appzoomout.AppZoomOut
import com.google.common.truth.Truth.assertThat
import java.util.Optional
import java.util.function.Consumer
import kotlinx.coroutines.flow.MutableStateFlow
import org.junit.Before
import org.junit.Rule
import org.junit.Test
@@ -120,6 +121,8 @@ class NotificationShadeDepthControllerTest : SysuiTestCase() {
        `when`(blurUtils.supportsBlursOnWindows()).thenReturn(true)
        `when`(blurUtils.maxBlurRadius).thenReturn(maxBlur.toFloat())
        `when`(blurUtils.maxBlurRadius).thenReturn(maxBlur.toFloat())
        `when`(windowRootViewBlurInteractor.isBlurCurrentlySupported)
            .thenReturn(MutableStateFlow(true))

        notificationShadeDepthController =
            NotificationShadeDepthController(
+26 −6
Original line number Diff line number Diff line
@@ -334,6 +334,14 @@ constructor(

    private fun onBlurApplied(appliedBlurRadius: Int, zoomOutFromShadeRadius: Float) {
        lastAppliedBlur = appliedBlurRadius
        onZoomOutChanged(zoomOutFromShadeRadius)
        listeners.forEach { it.onBlurRadiusChanged(appliedBlurRadius) }
        notificationShadeWindowController.setBackgroundBlurRadius(appliedBlurRadius)
    }

    private fun onZoomOutChanged(zoomOutFromShadeRadius: Float) {
        TrackTracer.instantForGroup("shade", "zoom_out", zoomOutFromShadeRadius)
        Log.v(TAG, "onZoomOutChanged $zoomOutFromShadeRadius")
        wallpaperController.setNotificationShadeZoom(zoomOutFromShadeRadius)
        if (spatialModelAppPushback()) {
            appZoomOutOptional.ifPresent { appZoomOut ->
@@ -341,10 +349,13 @@ constructor(
            }
            keyguardInteractor.setZoomOut(zoomOutFromShadeRadius)
        }
        listeners.forEach {
            it.onBlurRadiusChanged(appliedBlurRadius)
    }
        notificationShadeWindowController.setBackgroundBlurRadius(appliedBlurRadius)

    private val applyZoomOutForFrame =
        Choreographer.FrameCallback {
            updateScheduled = false
            val (_, zoomOutFromShadeRadius) = computeBlurAndZoomOut()
            onZoomOutChanged(zoomOutFromShadeRadius)
        }

    /** Animate blurs when unlocking. */
@@ -627,10 +638,19 @@ constructor(
        val (blur, zoomOutFromShadeRadius) = computeBlurAndZoomOut()
        zoomOutCalculatedFromShadeRadius = zoomOutFromShadeRadius
        if (Flags.bouncerUiRevamp() || Flags.glanceableHubBlurredBackground()) {
            if (windowRootViewBlurInteractor.isBlurCurrentlySupported.value) {
                updateScheduled =
                    windowRootViewBlurInteractor.requestBlurForShade(blur, shouldBlurBeOpaque)
                return
            }
            // When blur is not supported, zoom out still needs to happen when scheduleUpdate
            // is invoked and a separate frame callback has to be wired-up to support that.
            if (!updateScheduled) {
                updateScheduled = true
                choreographer.postFrameCallback(applyZoomOutForFrame)
            }
            return
        }
        if (updateScheduled) {
            return
        }