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

Commit 0d605bbb authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Speed up lockscreen alpha on AOD->OCCLUDED" into main

parents 5104717e d1b7ff2f
Loading
Loading
Loading
Loading
+15 −6
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.systemui.keyguard.ui.viewmodel

import android.util.MathUtils
import com.android.systemui.Flags.lightRevealMigration
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.keyguard.domain.interactor.FromAodTransitionInteractor
import com.android.systemui.keyguard.shared.model.Edge
@@ -32,9 +33,7 @@ import kotlinx.coroutines.flow.Flow
@SysUISingleton
class AodToOccludedTransitionViewModel
@Inject
constructor(
    animationFlow: KeyguardTransitionAnimationFlow,
) : DeviceEntryIconTransition {
constructor(animationFlow: KeyguardTransitionAnimationFlow) : DeviceEntryIconTransition {
    private val transitionAnimation =
        animationFlow.setup(
            duration = FromAodTransitionInteractor.TO_OCCLUDED_DURATION,
@@ -52,10 +51,20 @@ constructor(
        var currentAlpha = 0f
        return transitionAnimation.sharedFlow(
            duration = 250.milliseconds,
            startTime = 100.milliseconds, // Wait for the light reveal to "hit" the LS elements.
            onStart = { currentAlpha = viewState.alpha() },
            startTime =
                if (lightRevealMigration()) {
                    100.milliseconds // Wait for the light reveal to "hit" the LS elements.
                } else {
                    0.milliseconds
                },
            onStart = {
                if (lightRevealMigration()) {
                    currentAlpha = viewState.alpha()
                } else {
                    currentAlpha = 0f
                }
            },
            onStep = { MathUtils.lerp(currentAlpha, 0f, it) },
            onCancel = { 0f },
        )
    }