Loading packages/SystemUI/multivalentTests/src/com/android/systemui/window/ui/viewmodel/WindowRootViewModelTest.kt +1 −1 Original line number Diff line number Diff line Loading @@ -73,7 +73,7 @@ class WindowRootViewModelTest : SysuiTestCase() { assertThat(blurRadius).isEqualTo(0f) kosmos.windowRootViewBlurRepository.blurRadius.value = 60 kosmos.windowRootViewBlurRepository.blurRequestedByShade.value = 60 runCurrent() assertThat(blurRadius).isEqualTo(0f) Loading packages/SystemUI/src/com/android/systemui/statusbar/NotificationShadeDepthController.kt +23 −4 Original line number Diff line number Diff line Loading @@ -353,7 +353,9 @@ constructor( interpolator = Interpolators.FAST_OUT_SLOW_IN addUpdateListener { animation: ValueAnimator -> wakeAndUnlockBlurData = WakeAndUnlockBlurData(blurUtils.blurRadiusOfRatio(animation.animatedValue as Float)) WakeAndUnlockBlurData( blurUtils.blurRadiusOfRatio(animation.animatedValue as Float) ) } addListener( object : AnimatorListenerAdapter() { Loading Loading @@ -428,8 +430,10 @@ constructor( applicationScope.launch { wallpaperInteractor.wallpaperSupportsAmbientMode.collect { supported -> wallpaperSupportsAmbientMode = supported if (getNewWakeBlurRadius(prevDozeAmount) == wakeAndUnlockBlurData.radius && !wakeAndUnlockBlurData.useZoom) { if ( getNewWakeBlurRadius(prevDozeAmount) == wakeAndUnlockBlurData.radius && !wakeAndUnlockBlurData.useZoom ) { // Update wake and unlock radius only if the previous value comes from wake-up. updateWakeBlurRadius(prevDozeAmount) } Loading @@ -452,6 +456,21 @@ constructor( scheduleUpdate() } } applicationScope.launch { windowRootViewBlurInteractor.isBlurCurrentlySupported.collect { supported -> if (supported) { // when battery saver changes, try scheduling an update. scheduleUpdate() } else { // when blur becomes unsupported, no more updates will be scheduled, // reset updateScheduled state. updateScheduled = false // reset blur and internal state to 0 onBlurApplied(0, 0.0f) } } } } fun addListener(listener: DepthListener) { Loading packages/SystemUI/src/com/android/systemui/window/data/repository/NoopWindowRootViewBlurRepository.kt +1 −2 Original line number Diff line number Diff line Loading @@ -16,13 +16,12 @@ package com.android.systemui.window.data.repository import com.android.systemui.window.data.repository.WindowRootViewBlurRepository import javax.inject.Inject import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.StateFlow class NoopWindowRootViewBlurRepository @Inject constructor() : WindowRootViewBlurRepository { override val blurRadius: MutableStateFlow<Int> = MutableStateFlow(0) override val blurRequestedByShade: MutableStateFlow<Int> = MutableStateFlow(0) override val isBlurOpaque: MutableStateFlow<Boolean> = MutableStateFlow(true) override val isBlurSupported: StateFlow<Boolean> = MutableStateFlow(false) override var blurAppliedListener: BlurAppliedListener? = null Loading packages/SystemUI/src/com/android/systemui/window/data/repository/WindowRootViewBlurRepository.kt +2 −2 Original line number Diff line number Diff line Loading @@ -39,7 +39,7 @@ typealias BlurAppliedListener = Consumer<Int> /** Repository that maintains state for the window blur effect. */ interface WindowRootViewBlurRepository { val blurRadius: MutableStateFlow<Int> val blurRequestedByShade: MutableStateFlow<Int> val isBlurOpaque: MutableStateFlow<Boolean> /** Is blur supported based on settings toggle and battery power saver mode. */ Loading Loading @@ -67,7 +67,7 @@ constructor( @Main private val executor: Executor, @Application private val scope: CoroutineScope, ) : WindowRootViewBlurRepository { override val blurRadius = MutableStateFlow(0) override val blurRequestedByShade = MutableStateFlow(0) override val isBlurOpaque = MutableStateFlow(false) Loading packages/SystemUI/src/com/android/systemui/window/domain/interactor/WindowRootViewBlurInteractor.kt +2 −2 Original line number Diff line number Diff line Loading @@ -87,7 +87,7 @@ constructor( val isBlurCurrentlySupported: StateFlow<Boolean> = repository.isBlurSupported /** Radius of blur to be applied on the window root view. */ val blurRadius: StateFlow<Int> = repository.blurRadius.asStateFlow() val blurRadiusRequestedByShade: StateFlow<Int> = repository.blurRequestedByShade.asStateFlow() /** Whether the blur applied is opaque or transparent. */ val isBlurOpaque: Flow<Boolean> = Loading Loading @@ -128,7 +128,7 @@ constructor( return false } Log.d(TAG, "requestingBlurForShade for $blurRadius $opaque") repository.blurRadius.value = blurRadius repository.blurRequestedByShade.value = blurRadius repository.isBlurOpaque.value = opaque return true } Loading Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/window/ui/viewmodel/WindowRootViewModelTest.kt +1 −1 Original line number Diff line number Diff line Loading @@ -73,7 +73,7 @@ class WindowRootViewModelTest : SysuiTestCase() { assertThat(blurRadius).isEqualTo(0f) kosmos.windowRootViewBlurRepository.blurRadius.value = 60 kosmos.windowRootViewBlurRepository.blurRequestedByShade.value = 60 runCurrent() assertThat(blurRadius).isEqualTo(0f) Loading
packages/SystemUI/src/com/android/systemui/statusbar/NotificationShadeDepthController.kt +23 −4 Original line number Diff line number Diff line Loading @@ -353,7 +353,9 @@ constructor( interpolator = Interpolators.FAST_OUT_SLOW_IN addUpdateListener { animation: ValueAnimator -> wakeAndUnlockBlurData = WakeAndUnlockBlurData(blurUtils.blurRadiusOfRatio(animation.animatedValue as Float)) WakeAndUnlockBlurData( blurUtils.blurRadiusOfRatio(animation.animatedValue as Float) ) } addListener( object : AnimatorListenerAdapter() { Loading Loading @@ -428,8 +430,10 @@ constructor( applicationScope.launch { wallpaperInteractor.wallpaperSupportsAmbientMode.collect { supported -> wallpaperSupportsAmbientMode = supported if (getNewWakeBlurRadius(prevDozeAmount) == wakeAndUnlockBlurData.radius && !wakeAndUnlockBlurData.useZoom) { if ( getNewWakeBlurRadius(prevDozeAmount) == wakeAndUnlockBlurData.radius && !wakeAndUnlockBlurData.useZoom ) { // Update wake and unlock radius only if the previous value comes from wake-up. updateWakeBlurRadius(prevDozeAmount) } Loading @@ -452,6 +456,21 @@ constructor( scheduleUpdate() } } applicationScope.launch { windowRootViewBlurInteractor.isBlurCurrentlySupported.collect { supported -> if (supported) { // when battery saver changes, try scheduling an update. scheduleUpdate() } else { // when blur becomes unsupported, no more updates will be scheduled, // reset updateScheduled state. updateScheduled = false // reset blur and internal state to 0 onBlurApplied(0, 0.0f) } } } } fun addListener(listener: DepthListener) { Loading
packages/SystemUI/src/com/android/systemui/window/data/repository/NoopWindowRootViewBlurRepository.kt +1 −2 Original line number Diff line number Diff line Loading @@ -16,13 +16,12 @@ package com.android.systemui.window.data.repository import com.android.systemui.window.data.repository.WindowRootViewBlurRepository import javax.inject.Inject import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.StateFlow class NoopWindowRootViewBlurRepository @Inject constructor() : WindowRootViewBlurRepository { override val blurRadius: MutableStateFlow<Int> = MutableStateFlow(0) override val blurRequestedByShade: MutableStateFlow<Int> = MutableStateFlow(0) override val isBlurOpaque: MutableStateFlow<Boolean> = MutableStateFlow(true) override val isBlurSupported: StateFlow<Boolean> = MutableStateFlow(false) override var blurAppliedListener: BlurAppliedListener? = null Loading
packages/SystemUI/src/com/android/systemui/window/data/repository/WindowRootViewBlurRepository.kt +2 −2 Original line number Diff line number Diff line Loading @@ -39,7 +39,7 @@ typealias BlurAppliedListener = Consumer<Int> /** Repository that maintains state for the window blur effect. */ interface WindowRootViewBlurRepository { val blurRadius: MutableStateFlow<Int> val blurRequestedByShade: MutableStateFlow<Int> val isBlurOpaque: MutableStateFlow<Boolean> /** Is blur supported based on settings toggle and battery power saver mode. */ Loading Loading @@ -67,7 +67,7 @@ constructor( @Main private val executor: Executor, @Application private val scope: CoroutineScope, ) : WindowRootViewBlurRepository { override val blurRadius = MutableStateFlow(0) override val blurRequestedByShade = MutableStateFlow(0) override val isBlurOpaque = MutableStateFlow(false) Loading
packages/SystemUI/src/com/android/systemui/window/domain/interactor/WindowRootViewBlurInteractor.kt +2 −2 Original line number Diff line number Diff line Loading @@ -87,7 +87,7 @@ constructor( val isBlurCurrentlySupported: StateFlow<Boolean> = repository.isBlurSupported /** Radius of blur to be applied on the window root view. */ val blurRadius: StateFlow<Int> = repository.blurRadius.asStateFlow() val blurRadiusRequestedByShade: StateFlow<Int> = repository.blurRequestedByShade.asStateFlow() /** Whether the blur applied is opaque or transparent. */ val isBlurOpaque: Flow<Boolean> = Loading Loading @@ -128,7 +128,7 @@ constructor( return false } Log.d(TAG, "requestingBlurForShade for $blurRadius $opaque") repository.blurRadius.value = blurRadius repository.blurRequestedByShade.value = blurRadius repository.isBlurOpaque.value = opaque return true } Loading