diff options
| author | 2025-03-20 16:49:10 -0400 | |
|---|---|---|
| committer | 2025-03-20 13:51:46 -0700 | |
| commit | d845208393c889a08b71ada2e210ef727a8a919d (patch) | |
| tree | 150d05830fe4ac2761d57f13b81c03506e66624c | |
| parent | d9dda7a75e0e6d3bcac12e533c10167ad3fd458d (diff) | |
Trigger wallpaper and zoom out even when blur is not supported.
This mimics what NotificationShadeDepthController was doing previously, when blur gets disabled it sets blurRadius to 0 and still schedules a frame callback for applying the zoom out.
New blur implementation does not invoke onBlurApplied when blur is not supported due to battery saver.
Fixes: 403899890
Test: tracking here, b/381263619
Bug: 381263619
Flag: com.android.systemui.bouncer_ui_revamp
Change-Id: I7e1e2c58455055b17fa9fc07250b1d4c8bc765a9
2 files changed, 29 insertions, 6 deletions
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/NotificationShadeDepthControllerTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/NotificationShadeDepthControllerTest.kt index 039a32ba9127..b4c6b33463b0 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/NotificationShadeDepthControllerTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/NotificationShadeDepthControllerTest.kt @@ -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( diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShadeDepthController.kt b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShadeDepthController.kt index f844d1da1a8d..50d634f6ac54 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShadeDepthController.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShadeDepthController.kt @@ -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,12 +349,15 @@ 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. */ private val keyguardStateCallback = object : KeyguardStateController.Callback { @@ -627,8 +638,17 @@ constructor( val (blur, zoomOutFromShadeRadius) = computeBlurAndZoomOut() zoomOutCalculatedFromShadeRadius = zoomOutFromShadeRadius if (Flags.bouncerUiRevamp() || Flags.glanceableHubBlurredBackground()) { - updateScheduled = - windowRootViewBlurInteractor.requestBlurForShade(blur, shouldBlurBeOpaque) + 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) { |