diff options
7 files changed, 39 insertions, 0 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 0a0564994e69..19c20f5e7b22 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/NotificationShadeDepthControllerTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/NotificationShadeDepthControllerTest.kt @@ -29,6 +29,7 @@ import com.android.systemui.Flags import com.android.systemui.SysuiTestCase import com.android.systemui.animation.ShadeInterpolation import com.android.systemui.dump.DumpManager +import com.android.systemui.keyguard.domain.interactor.KeyguardInteractor import com.android.systemui.kosmos.testScope import com.android.systemui.plugins.statusbar.StatusBarStateController import com.android.systemui.res.R @@ -80,6 +81,7 @@ class NotificationShadeDepthControllerTest : SysuiTestCase() { @Mock private lateinit var blurUtils: BlurUtils @Mock private lateinit var biometricUnlockController: BiometricUnlockController @Mock private lateinit var keyguardStateController: KeyguardStateController + @Mock private lateinit var keyguardInteractor: KeyguardInteractor @Mock private lateinit var choreographer: Choreographer @Mock private lateinit var wallpaperController: WallpaperController @Mock private lateinit var notificationShadeWindowController: NotificationShadeWindowController @@ -123,6 +125,7 @@ class NotificationShadeDepthControllerTest : SysuiTestCase() { blurUtils, biometricUnlockController, keyguardStateController, + keyguardInteractor, choreographer, wallpaperController, notificationShadeWindowController, diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/data/repository/KeyguardRepository.kt b/packages/SystemUI/src/com/android/systemui/keyguard/data/repository/KeyguardRepository.kt index 621cc4666d31..da682c6036ee 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/data/repository/KeyguardRepository.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/data/repository/KeyguardRepository.kt @@ -79,6 +79,8 @@ interface KeyguardRepository { val panelAlpha: MutableStateFlow<Float> + val zoomOut: StateFlow<Float> + /** * Observable for whether the keyguard is showing. * @@ -278,6 +280,9 @@ interface KeyguardRepository { /** Temporary shim for fading out content when the brightness slider is used */ fun setPanelAlpha(alpha: Float) + /** Sets the zoom out scale of spatial model pushback from e.g. pulling down the shade. */ + fun setZoomOut(zoomOutFromShadeRadius: Float) + /** Whether the device is actively dreaming */ fun setDreaming(isDreaming: Boolean) @@ -384,6 +389,7 @@ constructor( override val onCameraLaunchDetected = MutableStateFlow(CameraLaunchSourceModel()) override val panelAlpha: MutableStateFlow<Float> = MutableStateFlow(1f) + override val zoomOut: MutableStateFlow<Float> = MutableStateFlow(0f) override val topClippingBounds = MutableStateFlow<Int?>(null) override val isKeyguardShowing: MutableStateFlow<Boolean> = @@ -665,6 +671,10 @@ constructor( panelAlpha.value = alpha } + override fun setZoomOut(zoomOutFromShadeRadius: Float) { + zoomOut.value = zoomOutFromShadeRadius + } + override fun setDreaming(isDreaming: Boolean) { this.isDreaming.value = isDreaming } diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardInteractor.kt b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardInteractor.kt index 75178f0ffef0..82e150bf8a02 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardInteractor.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardInteractor.kt @@ -334,6 +334,9 @@ constructor( @Deprecated("SceneContainer uses NotificationStackAppearanceInteractor") val panelAlpha: StateFlow<Float> = repository.panelAlpha.asStateFlow() + /** Sets the zoom out scale of spatial model pushback from e.g. pulling down the shade. */ + val zoomOut: StateFlow<Float> = repository.zoomOut + /** * When the lockscreen can be dismissed, emit an alpha value as the user swipes up. This is * useful just before the code commits to moving to GONE. @@ -472,6 +475,10 @@ constructor( repository.setPanelAlpha(alpha) } + fun setZoomOut(zoomOutFromShadeRadius: Float) { + repository.setZoomOut(zoomOutFromShadeRadius) + } + fun setAnimateDozingTransitions(animate: Boolean) { repository.setAnimateDozingTransitions(animate) } diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardRootViewBinder.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardRootViewBinder.kt index 70a52afeb8c2..ec2c9ab47225 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardRootViewBinder.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardRootViewBinder.kt @@ -177,6 +177,13 @@ object KeyguardRootViewBinder { } } + launch("$TAG#zoomOut") { + viewModel.scaleFromZoomOut.collect { scaleFromZoomOut -> + view.scaleX = scaleFromZoomOut + view.scaleY = scaleFromZoomOut + } + } + launch("$TAG#translationY") { // When translation happens in burnInLayer, it won't be weather clock large // clock isn't added to burnInLayer due to its scale transition so we also diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardRootViewModel.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardRootViewModel.kt index f0c924f99033..deb43f1ac9c8 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardRootViewModel.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardRootViewModel.kt @@ -287,6 +287,9 @@ constructor( .distinctUntilChanged() } + val scaleFromZoomOut: Flow<Float> = + keyguardInteractor.zoomOut.map { 1 - it * PUSHBACK_SCALE_FOR_LOCKSCREEN } + val translationY: Flow<Float> = aodBurnInViewModel.movement.map { it.translationY.toFloat() } val translationX: Flow<StateToValue> = @@ -408,5 +411,6 @@ constructor( companion object { private const val TAG = "KeyguardRootViewModel" + private const val PUSHBACK_SCALE_FOR_LOCKSCREEN = 0.05f } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShadeDepthController.kt b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShadeDepthController.kt index a2a840942f3c..e3b36df9aed7 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShadeDepthController.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShadeDepthController.kt @@ -40,6 +40,7 @@ import com.android.systemui.animation.ShadeInterpolation import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.qualifiers.Application import com.android.systemui.dump.DumpManager +import com.android.systemui.keyguard.domain.interactor.KeyguardInteractor import com.android.systemui.plugins.statusbar.StatusBarStateController import com.android.systemui.shade.ShadeExpansionChangeEvent import com.android.systemui.shade.ShadeExpansionListener @@ -74,6 +75,7 @@ constructor( private val blurUtils: BlurUtils, private val biometricUnlockController: BiometricUnlockController, private val keyguardStateController: KeyguardStateController, + private val keyguardInteractor: KeyguardInteractor, private val choreographer: Choreographer, private val wallpaperController: WallpaperController, private val notificationShadeWindowController: NotificationShadeWindowController, @@ -281,6 +283,7 @@ constructor( appZoomOutOptional.ifPresent { appZoomOut -> appZoomOut.setProgress(zoomOutFromShadeRadius) } + keyguardInteractor.setZoomOut(zoomOutFromShadeRadius) } listeners.forEach { it.onWallpaperZoomOutChanged(zoomOutFromShadeRadius) diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/data/repository/FakeKeyguardRepository.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/data/repository/FakeKeyguardRepository.kt index 8ea80081a871..1952f26b4e6a 100644 --- a/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/data/repository/FakeKeyguardRepository.kt +++ b/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/data/repository/FakeKeyguardRepository.kt @@ -114,6 +114,7 @@ class FakeKeyguardRepository @Inject constructor() : KeyguardRepository { override val keyguardAlpha: StateFlow<Float> = _keyguardAlpha override val panelAlpha: MutableStateFlow<Float> = MutableStateFlow(1f) + override val zoomOut: MutableStateFlow<Float> = MutableStateFlow(0f) override val lastRootViewTapPosition: MutableStateFlow<Point?> = MutableStateFlow(null) @@ -272,6 +273,10 @@ class FakeKeyguardRepository @Inject constructor() : KeyguardRepository { panelAlpha.value = alpha } + override fun setZoomOut(zoomOutFromShadeRadius: Float) { + zoomOut.value = zoomOutFromShadeRadius + } + fun setIsEncryptedOrLockdown(value: Boolean) { _isEncryptedOrLockdown.value = value } |