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

Commit 22482c23 authored by Matt Pietal's avatar Matt Pietal Committed by Android (Google) Code Review
Browse files

Merge "Include DREAMING when changing Notif Shade Window state" into main

parents 2ebdcb45 a8b5e7c6
Loading
Loading
Loading
Loading
+22 −1
Original line number Diff line number Diff line
@@ -43,7 +43,7 @@ class NotificationShadeWindowModelTest : SysuiTestCase() {
    }

    @Test
    fun transitionToOccluded() =
    fun transitionToOccludedByOCCLUDEDTransition() =
        testScope.runTest {
            val isKeyguardOccluded by collectLastValue(underTest.isKeyguardOccluded)
            assertThat(isKeyguardOccluded).isFalse()
@@ -62,4 +62,25 @@ class NotificationShadeWindowModelTest : SysuiTestCase() {
            )
            assertThat(isKeyguardOccluded).isFalse()
        }

    @Test
    fun transitionToOccludedByDREAMINGTransition() =
        testScope.runTest {
            val isKeyguardOccluded by collectLastValue(underTest.isKeyguardOccluded)
            assertThat(isKeyguardOccluded).isFalse()

            keyguardTransitionRepository.sendTransitionSteps(
                from = KeyguardState.LOCKSCREEN,
                to = KeyguardState.DREAMING,
                testScope,
            )
            assertThat(isKeyguardOccluded).isTrue()

            keyguardTransitionRepository.sendTransitionSteps(
                from = KeyguardState.DREAMING,
                to = KeyguardState.AOD,
                testScope,
            )
            assertThat(isKeyguardOccluded).isFalse()
        }
}
+8 −1
Original line number Diff line number Diff line
@@ -17,8 +17,11 @@
package com.android.systemui.shade.ui.viewmodel

import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.keyguard.domain.interactor.KeyguardInteractor
import com.android.systemui.keyguard.domain.interactor.KeyguardTransitionInteractor
import com.android.systemui.keyguard.shared.model.KeyguardState.DREAMING
import com.android.systemui.keyguard.shared.model.KeyguardState.OCCLUDED
import com.android.systemui.util.kotlin.BooleanFlowOperators.anyOf
import javax.inject.Inject
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.map
@@ -29,7 +32,11 @@ class NotificationShadeWindowModel
@Inject
constructor(
    keyguardTransitionInteractor: KeyguardTransitionInteractor,
    keyguardInteractor: KeyguardInteractor,
) {
    val isKeyguardOccluded: Flow<Boolean> =
        keyguardTransitionInteractor.transitionValue(OCCLUDED).map { it == 1f }
        anyOf(
            keyguardTransitionInteractor.transitionValue(OCCLUDED).map { it == 1f },
            keyguardTransitionInteractor.transitionValue(DREAMING).map { it == 1f },
        )
}
+7 −1
Original line number Diff line number Diff line
@@ -16,8 +16,14 @@

package com.android.systemui.shade.ui.viewmodel

import com.android.systemui.keyguard.domain.interactor.keyguardInteractor
import com.android.systemui.keyguard.domain.interactor.keyguardTransitionInteractor
import com.android.systemui.kosmos.Kosmos

val Kosmos.notificationShadeWindowModel: NotificationShadeWindowModel by
    Kosmos.Fixture { NotificationShadeWindowModel(keyguardTransitionInteractor) }
    Kosmos.Fixture {
        NotificationShadeWindowModel(
            keyguardTransitionInteractor,
            keyguardInteractor,
        )
    }