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

Commit 70b8d380 authored by Tracy Zhou's avatar Tracy Zhou Committed by Android (Google) Code Review
Browse files

Merge "Pipe depth signal to keyguard for spatial model zoom out" into main

parents 1f0bb979 16bb8044
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -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,
+10 −0
Original line number Diff line number Diff line
@@ -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)

@@ -381,6 +386,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> =
@@ -662,6 +668,10 @@ constructor(
        panelAlpha.value = alpha
    }

    override fun setZoomOut(zoomOutFromShadeRadius: Float) {
        zoomOut.value = zoomOutFromShadeRadius
    }

    override fun setDreaming(isDreaming: Boolean) {
        this.isDreaming.value = isDreaming
    }
+7 −0
Original line number Diff line number Diff line
@@ -337,6 +337,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.
@@ -475,6 +478,10 @@ constructor(
        repository.setPanelAlpha(alpha)
    }

    fun setZoomOut(zoomOutFromShadeRadius: Float) {
        repository.setZoomOut(zoomOutFromShadeRadius)
    }

    fun setAnimateDozingTransitions(animate: Boolean) {
        repository.setAnimateDozingTransitions(animate)
    }
+7 −0
Original line number Diff line number Diff line
@@ -172,6 +172,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
+4 −0
Original line number Diff line number Diff line
@@ -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> =
@@ -418,5 +421,6 @@ constructor(

    companion object {
        private const val TAG = "KeyguardRootViewModel"
        private const val PUSHBACK_SCALE_FOR_LOCKSCREEN = 0.05f
    }
}
Loading