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

Commit 27be2bb7 authored by Leon Masopust's avatar Leon Masopust
Browse files

[flexiglass] Fix SecureCamera disappearing on Gone

On Flexiglass the secure camera was only checking for the Keyguard
state GONE which got deprecated to evaluate whether it should be
deactivated. This change is adding a check for Scenes.Gone for
Flexiglass and adding a test for that.

Test: KeyguardInteractorTest (with Flexiglass on and off)
Bug: 416717144
Flag: com.android.systemui.scene_container
Change-Id: I2c60d9f4b93fdb848553e8ffd91c0c180bff198f
parent 3e3d5cd3
Loading
Loading
Loading
Loading
+28 −1
Original line number Diff line number Diff line
@@ -167,7 +167,7 @@ class KeyguardInteractorTest : SysuiTestCase() {
        }

    @Test
    @DisableFlags(FLAG_KEYGUARD_WM_STATE_REFACTOR)
    @DisableSceneContainer
    fun testGoneStateResetsCameraActive() =
        testScope.runTest {
            val secureCameraActive = collectLastValue(underTest.isSecureCameraActive)
@@ -183,6 +183,33 @@ class KeyguardInteractorTest : SysuiTestCase() {
            assertThat(secureCameraActive()).isFalse()
        }

    @Test
    @EnableSceneContainer
    fun testScenesGoneStateResetsCameraActive() =
        testScope.runTest {
            val secureCameraActive = collectLastValue(underTest.isSecureCameraActive)
            runCurrent()

            underTest.onCameraLaunchDetected(
                StatusBarManager.CAMERA_LAUNCH_SOURCE_POWER_DOUBLE_TAP,
                isSecureCamera = true,
            )
            assertThat(secureCameraActive()).isTrue()

            transitionState.value =
                ObservableTransitionState.Transition(
                    fromScene = Scenes.Lockscreen,
                    toScene = Scenes.Gone,
                    currentScene = flowOf(Scenes.Gone),
                    progress = flowOf(1f),
                    isInitiatedByUserInput = false,
                    isUserInputOngoing = flowOf(false),
                )
            runCurrent()

            assertThat(secureCameraActive()).isFalse()
        }

    /** Regression test for b/373700726. */
    @Test
    @DisableFlags(FLAG_KEYGUARD_WM_STATE_REFACTOR)
+1 −1
Original line number Diff line number Diff line
@@ -305,7 +305,7 @@ constructor(
                    .filter { it }
                    .map { SecureCameraRelatedEventType.PrimaryBouncerBecameVisible },
                keyguardTransitionInteractor
                    .transitionValue(GONE)
                    .transitionValue(content = Scenes.Gone, stateWithoutSceneContainer = GONE)
                    .filter { it == 1f }
                    .map { SecureCameraRelatedEventType.InGoneState },
            )