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

Commit 1608b3ab authored by Lucas Silva's avatar Lucas Silva
Browse files

Fix dreaming to GH transition in v2

We previously kept the dream alpha at 100% during the transition, since
the GH would fade in on top of the dream. However, since GH now has a
transparent background, we must first transition the dream to 0% alpha
before showing GH.

Bug: 394496191
Test: transitioning to/from dream to GH and lockscreen
Flag: com.android.systemui.glanceable_hub_v2
Change-Id: Ic477b53677141c81088d11ce6b85bf3641daca60
parent d6ed8077
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -93,6 +93,10 @@ val sceneTransitionsV2 = transitions {
        spec = tween(durationMillis = TransitionDuration.TO_GLANCEABLE_HUB_DURATION_MS)
        fade(AllElements)
    }
    to(CommunalScenes.Communal, key = CommunalTransitionKeys.FromOccluded) {
        spec = tween(durationMillis = TransitionDuration.TO_GLANCEABLE_HUB_DURATION_MS)
        timestampRange(startMillis = 250) { fade(AllElements) }
    }
    to(CommunalScenes.Communal, key = CommunalTransitionKeys.Swipe) {
        spec = tween(durationMillis = TransitionDuration.TO_GLANCEABLE_HUB_DURATION_MS)
        translate(Communal.Elements.Grid, Edge.End)
+2 −0
Original line number Diff line number Diff line
@@ -33,6 +33,8 @@ object CommunalTransitionKeys {
    val FromEditMode = TransitionKey("FromEditMode")
    /** Swipes the glanceable hub in/out of view */
    val Swipe = TransitionKey("Swipe")
    /** Transition from occluded state to the glanceable hub */
    val FromOccluded = TransitionKey("FromOccluded")
    /** Swipes out of glanceable hub in landscape orientation */
    val SwipeInLandscape = TransitionKey("SwipeInLandscape")
}
+1 −1
Original line number Diff line number Diff line
@@ -175,7 +175,7 @@ constructor(
                            loggingReason = "FromDreamingTransitionInteractor",
                            transitionKey =
                                if (communalSettingsInteractor.isV2FlagEnabled())
                                    CommunalTransitionKeys.SimpleFade
                                    CommunalTransitionKeys.FromOccluded
                                else null,
                        )
                    } else {
+13 −1
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.systemui.keyguard.ui.viewmodel
import android.util.LayoutDirection
import com.android.app.animation.Interpolators.EMPHASIZED
import com.android.systemui.common.ui.domain.interactor.ConfigurationInteractor
import com.android.systemui.communal.domain.interactor.CommunalSettingsInteractor
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.keyguard.dagger.GlanceableHubBlurComponent
import com.android.systemui.keyguard.shared.model.Edge
@@ -44,6 +45,7 @@ constructor(
    animationFlow: KeyguardTransitionAnimationFlow,
    @ShadeDisplayAware configurationInteractor: ConfigurationInteractor,
    private val blurFactory: GlanceableHubBlurComponent.Factory,
    private val communalSettingsInteractor: CommunalSettingsInteractor,
) : DeviceEntryIconTransition, GlanceableHubTransition {
    private val transitionAnimation =
        animationFlow
@@ -70,7 +72,17 @@ constructor(
            }

    // Keep the dream visible while the hub swipes in over the dream.
    val dreamAlpha: Flow<Float> = transitionAnimation.immediatelyTransitionTo(1f)
    val dreamAlpha: Flow<Float> by lazy {
        if (communalSettingsInteractor.isV2FlagEnabled()) {
            transitionAnimation.sharedFlow(
                duration = 250.milliseconds,
                onStep = { 1f - it },
                name = "DREAMING->GLANCEABLE_HUB: dreamAlpha",
            )
        } else {
            transitionAnimation.immediatelyTransitionTo(1f)
        }
    }

    val dreamOverlayAlpha: Flow<Float> =
        transitionAnimation.sharedFlow(
+2 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.systemui.keyguard.ui.viewmodel

import com.android.systemui.common.ui.domain.interactor.configurationInteractor
import com.android.systemui.communal.domain.interactor.communalSettingsInteractor
import com.android.systemui.keyguard.ui.glanceableHubBlurComponentFactory
import com.android.systemui.keyguard.ui.keyguardTransitionAnimationFlow
import com.android.systemui.kosmos.Kosmos
@@ -27,5 +28,6 @@ val Kosmos.dreamingToGlanceableHubTransitionViewModel by
            configurationInteractor = configurationInteractor,
            animationFlow = keyguardTransitionAnimationFlow,
            blurFactory = glanceableHubBlurComponentFactory,
            communalSettingsInteractor = communalSettingsInteractor,
        )
    }