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

Commit 31b8de43 authored by Shawn Lee's avatar Shawn Lee Committed by Android (Google) Code Review
Browse files

Merge "[flexiglass] Fix dual shade locked shade notif expansion" into main

parents 03671f89 6bedc65d
Loading
Loading
Loading
Loading
+86 −0
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@ import com.android.systemui.keyguard.shared.model.TransitionState
import com.android.systemui.keyguard.shared.model.TransitionStep
import com.android.systemui.kosmos.testScope
import com.android.systemui.scene.data.repository.sceneContainerRepository
import com.android.systemui.scene.shared.model.Overlays
import com.android.systemui.scene.shared.model.Scenes
import com.android.systemui.testKosmos
import com.google.common.truth.Truth.assertThat
@@ -118,6 +119,50 @@ class LockscreenSceneTransitionInteractorTest : SysuiTestCase() {
            )
        }

    /** STL: Ls -> overlay, then settle with Idle(overlay). */
    @Test
    fun transition_overlay_from_ls_scene_end_in_gone() =
        testScope.runTest {
            sceneTransitions.value =
                ObservableTransitionState.Transition.ShowOrHideOverlay(
                    overlay = Overlays.NotificationsShade,
                    fromContent = Scenes.Lockscreen,
                    toContent = Overlays.NotificationsShade,
                    currentScene = Scenes.Lockscreen,
                    currentOverlays = flowOf(emptySet()),
                    progress,
                    isInitiatedByUserInput = false,
                    isUserInputOngoing = flowOf(false),
                    previewProgress = flowOf(0f),
                    isInPreviewStage = flowOf(false),
                )

            val currentStep by collectLastValue(kosmos.realKeyguardTransitionRepository.transitions)
            assertTransition(
                step = currentStep!!,
                from = KeyguardState.LOCKSCREEN,
                to = KeyguardState.UNDEFINED,
                state = TransitionState.RUNNING,
                progress = 0f,
            )

            progress.value = 0.4f
            assertTransition(step = currentStep!!, state = TransitionState.RUNNING, progress = 0.4f)

            sceneTransitions.value =
                ObservableTransitionState.Idle(
                    Scenes.Lockscreen,
                    setOf(Overlays.NotificationsShade),
                )
            assertTransition(
                step = currentStep!!,
                from = KeyguardState.LOCKSCREEN,
                to = KeyguardState.UNDEFINED,
                state = TransitionState.FINISHED,
                progress = 1f,
            )
        }

    /**
     * STL: Ls -> Gone, then settle with Idle(Ls). KTF in this scenario needs to invert the
     * transition LS -> UNDEFINED to UNDEFINED -> LS as there is no mechanism in KTF to
@@ -259,6 +304,47 @@ class LockscreenSceneTransitionInteractorTest : SysuiTestCase() {
            )
        }

    /** STL: Ls with overlay, then settle with Idle(Ls). */
    @Test
    fun transition_overlay_to_ls_scene_end_in_ls() =
        testScope.runTest {
            val currentStep by collectLastValue(kosmos.realKeyguardTransitionRepository.transitions)
            sceneTransitions.value =
                ObservableTransitionState.Transition.ShowOrHideOverlay(
                    overlay = Overlays.NotificationsShade,
                    fromContent = Overlays.NotificationsShade,
                    toContent = Scenes.Lockscreen,
                    currentScene = Scenes.Lockscreen,
                    currentOverlays = flowOf(setOf(Overlays.NotificationsShade)),
                    progress,
                    isInitiatedByUserInput = false,
                    isUserInputOngoing = flowOf(false),
                    previewProgress = flowOf(0f),
                    isInPreviewStage = flowOf(false),
                )

            assertTransition(
                step = currentStep!!,
                from = KeyguardState.UNDEFINED,
                to = KeyguardState.LOCKSCREEN,
                state = TransitionState.RUNNING,
                progress = 0f,
            )

            progress.value = 0.4f
            assertTransition(step = currentStep!!, state = TransitionState.RUNNING, progress = 0.4f)

            sceneTransitions.value = ObservableTransitionState.Idle(Scenes.Lockscreen)

            assertTransition(
                step = currentStep!!,
                from = KeyguardState.UNDEFINED,
                to = KeyguardState.LOCKSCREEN,
                state = TransitionState.FINISHED,
                progress = 1f,
            )
        }

    /** STL: Gone -> Ls (AOD), will transition to AOD once */
    @Test
    fun transition_to_ls_scene_with_changed_next_scene_is_respected_just_once() =
+5 −2
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.systemui.keyguard.domain.interactor.scenetransition

import com.android.app.tracing.coroutines.launchTraced as launch
import com.android.compose.animation.scene.ObservableTransitionState
import com.android.compose.animation.scene.SceneKey
import com.android.systemui.CoreStartable
@@ -38,7 +39,6 @@ import java.util.UUID
import javax.inject.Inject
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Job
import com.android.app.tracing.coroutines.launchTraced as launch

/**
 * This class listens to scene framework scene transitions and manages keyguard transition framework
@@ -111,7 +111,10 @@ constructor(
        if (currentTransitionId == null) return
        if (prevTransition !is ObservableTransitionState.Transition) return

        if (idle.currentScene == prevTransition.toContent) {
        if (
            idle.currentScene == prevTransition.toContent ||
                idle.currentOverlays.contains(prevTransition.toContent)
        ) {
            finishCurrentTransition()
        } else {
            val targetState =