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

Commit 16bb8044 authored by Tracy Zhou's avatar Tracy Zhou
Browse files

Pipe depth signal to keyguard for spatial model zoom out

Lockscreen should be pushed back when the shade is pulled down. The pushback level is 5%, the same as the homescreen.

For the most part of the spatial model work, the implementation is done in WMShell. It scales down the entire display area while filtering out a few specific windows (e.g. nav bar, status bar, shade). Since the lockscreen and the shade share the same window, pushing back the lockscreen has to be done at the view level (we are scaling the root view of the lockscreen here).

Bug: 391901376
Test: video in the bug
Flag: com.android.systemui.spatial_model_app_pushback
Change-Id: I6aad1bf074a43949644f03ef738b392a7865b504
parent 6c1a7411
Loading
Loading
Loading
Loading
+3 −0
Original line number Original line Diff line number Diff line
@@ -29,6 +29,7 @@ import com.android.systemui.Flags
import com.android.systemui.SysuiTestCase
import com.android.systemui.SysuiTestCase
import com.android.systemui.animation.ShadeInterpolation
import com.android.systemui.animation.ShadeInterpolation
import com.android.systemui.dump.DumpManager
import com.android.systemui.dump.DumpManager
import com.android.systemui.keyguard.domain.interactor.KeyguardInteractor
import com.android.systemui.kosmos.testScope
import com.android.systemui.kosmos.testScope
import com.android.systemui.plugins.statusbar.StatusBarStateController
import com.android.systemui.plugins.statusbar.StatusBarStateController
import com.android.systemui.res.R
import com.android.systemui.res.R
@@ -80,6 +81,7 @@ class NotificationShadeDepthControllerTest : SysuiTestCase() {
    @Mock private lateinit var blurUtils: BlurUtils
    @Mock private lateinit var blurUtils: BlurUtils
    @Mock private lateinit var biometricUnlockController: BiometricUnlockController
    @Mock private lateinit var biometricUnlockController: BiometricUnlockController
    @Mock private lateinit var keyguardStateController: KeyguardStateController
    @Mock private lateinit var keyguardStateController: KeyguardStateController
    @Mock private lateinit var keyguardInteractor: KeyguardInteractor
    @Mock private lateinit var choreographer: Choreographer
    @Mock private lateinit var choreographer: Choreographer
    @Mock private lateinit var wallpaperController: WallpaperController
    @Mock private lateinit var wallpaperController: WallpaperController
    @Mock private lateinit var notificationShadeWindowController: NotificationShadeWindowController
    @Mock private lateinit var notificationShadeWindowController: NotificationShadeWindowController
@@ -123,6 +125,7 @@ class NotificationShadeDepthControllerTest : SysuiTestCase() {
                blurUtils,
                blurUtils,
                biometricUnlockController,
                biometricUnlockController,
                keyguardStateController,
                keyguardStateController,
                keyguardInteractor,
                choreographer,
                choreographer,
                wallpaperController,
                wallpaperController,
                notificationShadeWindowController,
                notificationShadeWindowController,
+10 −0
Original line number Original line Diff line number Diff line
@@ -79,6 +79,8 @@ interface KeyguardRepository {


    val panelAlpha: MutableStateFlow<Float>
    val panelAlpha: MutableStateFlow<Float>


    val zoomOut: StateFlow<Float>

    /**
    /**
     * Observable for whether the keyguard is showing.
     * 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 */
    /** Temporary shim for fading out content when the brightness slider is used */
    fun setPanelAlpha(alpha: Float)
    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 */
    /** Whether the device is actively dreaming */
    fun setDreaming(isDreaming: Boolean)
    fun setDreaming(isDreaming: Boolean)


@@ -384,6 +389,7 @@ constructor(
    override val onCameraLaunchDetected = MutableStateFlow(CameraLaunchSourceModel())
    override val onCameraLaunchDetected = MutableStateFlow(CameraLaunchSourceModel())


    override val panelAlpha: MutableStateFlow<Float> = MutableStateFlow(1f)
    override val panelAlpha: MutableStateFlow<Float> = MutableStateFlow(1f)
    override val zoomOut: MutableStateFlow<Float> = MutableStateFlow(0f)
    override val topClippingBounds = MutableStateFlow<Int?>(null)
    override val topClippingBounds = MutableStateFlow<Int?>(null)


    override val isKeyguardShowing: MutableStateFlow<Boolean> =
    override val isKeyguardShowing: MutableStateFlow<Boolean> =
@@ -665,6 +671,10 @@ constructor(
        panelAlpha.value = alpha
        panelAlpha.value = alpha
    }
    }


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

    override fun setDreaming(isDreaming: Boolean) {
    override fun setDreaming(isDreaming: Boolean) {
        this.isDreaming.value = isDreaming
        this.isDreaming.value = isDreaming
    }
    }
+7 −0
Original line number Original line Diff line number Diff line
@@ -334,6 +334,9 @@ constructor(
    @Deprecated("SceneContainer uses NotificationStackAppearanceInteractor")
    @Deprecated("SceneContainer uses NotificationStackAppearanceInteractor")
    val panelAlpha: StateFlow<Float> = repository.panelAlpha.asStateFlow()
    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
     * 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.
     * useful just before the code commits to moving to GONE.
@@ -472,6 +475,10 @@ constructor(
        repository.setPanelAlpha(alpha)
        repository.setPanelAlpha(alpha)
    }
    }


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

    fun setAnimateDozingTransitions(animate: Boolean) {
    fun setAnimateDozingTransitions(animate: Boolean) {
        repository.setAnimateDozingTransitions(animate)
        repository.setAnimateDozingTransitions(animate)
    }
    }
+7 −0
Original line number Original line Diff line number Diff line
@@ -177,6 +177,13 @@ object KeyguardRootViewBinder {
                        }
                        }
                    }
                    }


                    launch("$TAG#zoomOut") {
                        viewModel.scaleFromZoomOut.collect { scaleFromZoomOut ->
                            view.scaleX = scaleFromZoomOut
                            view.scaleY = scaleFromZoomOut
                        }
                    }

                    launch("$TAG#translationY") {
                    launch("$TAG#translationY") {
                        // When translation happens in burnInLayer, it won't be weather clock large
                        // 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
                        // clock isn't added to burnInLayer due to its scale transition so we also
+4 −0
Original line number Original line Diff line number Diff line
@@ -287,6 +287,9 @@ constructor(
            .distinctUntilChanged()
            .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 translationY: Flow<Float> = aodBurnInViewModel.movement.map { it.translationY.toFloat() }


    val translationX: Flow<StateToValue> =
    val translationX: Flow<StateToValue> =
@@ -408,5 +411,6 @@ constructor(


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