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

Commit e5732c7f authored by Prince's avatar Prince
Browse files

Checking whether the transition originated from either the GLANCEABLE_HUB or the DREAMING state.

Test: atest communalInteractorTest
Flag: NONE small condition check
Fixes: 357926463
Change-Id: I8959edd295c2e375e221c21bc70cc38a5c8a2ddc
parent 0d20e8d9
Loading
Loading
Loading
Loading
+16 −0
Original line number Original line Diff line number Diff line
@@ -1039,6 +1039,22 @@ class CommunalInteractorTest : SysuiTestCase() {
            assertThat(showCommunalFromOccluded).isTrue()
            assertThat(showCommunalFromOccluded).isTrue()
        }
        }


    @Test
    fun showCommunalFromOccluded_enteredOccludedFromDreaming() =
        testScope.runTest {
            kosmos.setCommunalAvailable(true)
            val showCommunalFromOccluded by collectLastValue(underTest.showCommunalFromOccluded)
            assertThat(showCommunalFromOccluded).isFalse()

            kosmos.fakeKeyguardTransitionRepository.sendTransitionSteps(
                from = KeyguardState.DREAMING,
                to = KeyguardState.OCCLUDED,
                testScope
            )

            assertThat(showCommunalFromOccluded).isTrue()
        }

    private fun smartspaceTimer(id: String, timestamp: Long = 0L): CommunalSmartspaceTimer {
    private fun smartspaceTimer(id: String, timestamp: Long = 0L): CommunalSmartspaceTimer {
        return CommunalSmartspaceTimer(
        return CommunalSmartspaceTimer(
            smartspaceTargetId = id,
            smartspaceTargetId = id,
+5 −1
Original line number Original line Diff line number Diff line
@@ -184,7 +184,11 @@ constructor(
        keyguardTransitionInteractor.startedKeyguardTransitionStep
        keyguardTransitionInteractor.startedKeyguardTransitionStep
            .filter { step -> step.to == KeyguardState.OCCLUDED }
            .filter { step -> step.to == KeyguardState.OCCLUDED }
            .combine(isCommunalAvailable, ::Pair)
            .combine(isCommunalAvailable, ::Pair)
            .map { (step, available) -> available && step.from == KeyguardState.GLANCEABLE_HUB }
            .map { (step, available) ->
                available &&
                    (step.from == KeyguardState.GLANCEABLE_HUB ||
                        step.from == KeyguardState.DREAMING)
            }
            .flowOn(bgDispatcher)
            .flowOn(bgDispatcher)
            .stateIn(
            .stateIn(
                scope = applicationScope,
                scope = applicationScope,