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

Commit bb7846c1 authored by Danny Burakov's avatar Danny Burakov Committed by Android (Google) Code Review
Browse files

Merge "[flexiglass] Animate the lock screen up when swiping to enter the device" into main

parents ef4b7530 29983fdc
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -830,7 +830,11 @@ private fun TransitionState.isOnLockscreen(): Boolean {
}

private fun shouldUseLockscreenStackBounds(state: TransitionState): Boolean {
    return state is TransitionState.Idle && state.isOnLockscreen()
    return when (state) {
        is TransitionState.Idle -> state.isOnLockscreen()
        is TransitionState.Transition ->
            state.isTransitioning(from = Scenes.Lockscreen, to = Scenes.Gone)
    }
}

private fun shouldUseLockscreenHunBounds(
+14 −2
Original line number Diff line number Diff line
package com.android.systemui.scene.ui.composable.transitions

import androidx.compose.animation.core.tween
import androidx.compose.ui.unit.dp
import com.android.compose.animation.Easings
import com.android.compose.animation.scene.TransitionBuilder
import com.android.systemui.plugins.keyguard.ui.composable.elements.LockscreenElementKeys
import com.android.systemui.scene.shared.model.Scenes
@@ -8,6 +10,16 @@ import com.android.systemui.scene.shared.model.Scenes
fun TransitionBuilder.lockscreenToGoneTransition() {
    spec = tween(durationMillis = 500)

    fade(Scenes.Lockscreen.rootElementKey)
    fractionRange(end = 0.3f, easing = Easings.PredictiveBack) {
        // Fade out all lock screen elements, except the status bar.
        fade(LockscreenElementKeys.Region.Upper)
        fade(LockscreenElementKeys.LockIcon)
        fade(LockscreenElementKeys.AmbientIndicationArea)
        fade(LockscreenElementKeys.Region.Lower)
        fade(LockscreenElementKeys.SettingsMenu)

        fade(LockscreenElementKeys.BehindScrim)
        translate(LockscreenElementKeys.Region.Upper, y = (-48).dp)
        translate(LockscreenElementKeys.Notifications.Stack, y = (-72).dp)
    }
}
+18 −2
Original line number Diff line number Diff line
@@ -53,16 +53,32 @@ class LockscreenToGoneTransitionViewModelTest : SysuiTestCase() {
    @Test
    fun deviceEntryParentViewHides() =
        testScope.runTest {
            val deviceEntryParentViewAlpha by collectValues(underTest.deviceEntryParentViewAlpha)
            val deviceEntryParentViewAlpha by collectLastValue(underTest.deviceEntryParentViewAlpha)
            val tolerance = 0.05f

            repository.sendTransitionStep(step(0f, TransitionState.STARTED))
            assertThat(deviceEntryParentViewAlpha).isEqualTo(1f)

            repository.sendTransitionStep(step(0.1f))
            assertThat(deviceEntryParentViewAlpha).isWithin(tolerance).of(0.9f)

            repository.sendTransitionStep(step(0.3f))
            assertThat(deviceEntryParentViewAlpha).isWithin(tolerance).of(0.7f)

            repository.sendTransitionStep(step(0.4f))
            assertThat(deviceEntryParentViewAlpha).isWithin(tolerance).of(0.6f)

            repository.sendTransitionStep(step(0.5f))
            assertThat(deviceEntryParentViewAlpha).isWithin(tolerance).of(0.5f)

            repository.sendTransitionStep(step(0.6f))
            assertThat(deviceEntryParentViewAlpha).isWithin(tolerance).of(0.4f)

            repository.sendTransitionStep(step(0.8f))
            assertThat(deviceEntryParentViewAlpha).isWithin(tolerance).of(0.2f)

            repository.sendTransitionStep(step(1f))
            deviceEntryParentViewAlpha.forEach { assertThat(it).isEqualTo(0f) }
            assertThat(deviceEntryParentViewAlpha).isEqualTo(0f)
        }

    @Test
+5 −1
Original line number Diff line number Diff line
@@ -119,5 +119,9 @@ constructor(
    }

    override val deviceEntryParentViewAlpha: Flow<Float> =
        transitionAnimation.immediatelyTransitionTo(0f)
        transitionAnimation.sharedFlowWithShade(
            duration = 600.milliseconds,
            onStep = { step, isShadeExpanded -> if (isShadeExpanded) 0f else 1f - step },
            onFinish = { 0f },
        )
}