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

Commit a8b5e7c6 authored by Matt Pietal's avatar Matt Pietal
Browse files

Include DREAMING when changing Notif Shade Window state

Both OCCLUDED and DREAMING need to update notification
shade window state.

Bug: 344716537
Test: atest NotificationShadeWindowModelTest
Flag: com.android.systemui.use_transitions_for_keyguard_occluded
Change-Id: If91be9799ecaf092c7e5d4f1f4f1870deb95e286
parent 86dd6eb6
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,
        )
    }