Loading packages/SystemUI/src/com/android/systemui/keyguard/data/repository/KeyguardRepository.kt +12 −0 Original line number Diff line number Diff line Loading @@ -121,6 +121,9 @@ interface KeyguardRepository { /** Observable for whether the device is dreaming with an overlay, see [DreamOverlayService] */ val isDreamingWithOverlay: Flow<Boolean> /** Observable for device dreaming state and the active dream is hosted in lockscreen */ val isActiveDreamLockscreenHosted: StateFlow<Boolean> /** * Observable for the amount of doze we are currently in. * Loading Loading @@ -190,6 +193,8 @@ interface KeyguardRepository { fun setLastDozeTapToWakePosition(position: Point) fun setIsDozing(isDozing: Boolean) fun setIsActiveDreamLockscreenHosted(isLockscreenHosted: Boolean) } /** Encapsulates application state for the keyguard. */ Loading Loading @@ -610,6 +615,9 @@ constructor( private val _isQuickSettingsVisible = MutableStateFlow(false) override val isQuickSettingsVisible: Flow<Boolean> = _isQuickSettingsVisible.asStateFlow() private val _isActiveDreamLockscreenHosted = MutableStateFlow(false) override val isActiveDreamLockscreenHosted = _isActiveDreamLockscreenHosted.asStateFlow() override fun setAnimateDozingTransitions(animate: Boolean) { _animateBottomAreaDozingTransitions.value = animate } Loading @@ -628,6 +636,10 @@ constructor( _isQuickSettingsVisible.value = isVisible } override fun setIsActiveDreamLockscreenHosted(isLockscreenHosted: Boolean) { _isActiveDreamLockscreenHosted.value = isLockscreenHosted } private fun statusBarStateIntToObject(value: Int): StatusBarState { return when (value) { 0 -> StatusBarState.SHADE Loading packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardInteractor.kt +6 −0 Original line number Diff line number Diff line Loading @@ -81,6 +81,8 @@ constructor( val isDreaming: Flow<Boolean> = repository.isDreaming /** Whether the system is dreaming with an overlay active */ val isDreamingWithOverlay: Flow<Boolean> = repository.isDreamingWithOverlay /** Whether the system is dreaming and the active dream is hosted in lockscreen */ val isActiveDreamLockscreenHosted: Flow<Boolean> = repository.isActiveDreamLockscreenHosted /** Event for when the camera gesture is detected */ val onCameraLaunchDetected: Flow<CameraLaunchSourceModel> = conflatedCallbackFlow { val callback = Loading Loading @@ -198,6 +200,10 @@ constructor( } } fun setIsActiveDreamLockscreenHosted(isLockscreenHosted: Boolean) { repository.setIsActiveDreamLockscreenHosted(isLockscreenHosted) } /** Sets whether quick settings or quick-quick settings is visible. */ fun setQuickSettingsVisible(isVisible: Boolean) { repository.setQuickSettingsVisible(isVisible) Loading packages/SystemUI/tests/src/com/android/systemui/keyguard/data/repository/KeyguardRepositoryImplTest.kt +10 −0 Original line number Diff line number Diff line Loading @@ -298,6 +298,16 @@ class KeyguardRepositoryImplTest : SysuiTestCase() { verify(statusBarStateController).removeCallback(captor.value) } @Test fun isActiveDreamLockscreenHosted() = testScope.runTest { underTest.setIsActiveDreamLockscreenHosted(true) assertThat(underTest.isActiveDreamLockscreenHosted.value).isEqualTo(true) underTest.setIsActiveDreamLockscreenHosted(false) assertThat(underTest.isActiveDreamLockscreenHosted.value).isEqualTo(false) } @Test fun wakefulness() = testScope.runTest { Loading packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/data/repository/FakeKeyguardRepository.kt +7 −0 Original line number Diff line number Diff line Loading @@ -68,6 +68,9 @@ class FakeKeyguardRepository : KeyguardRepository { private val _isDreamingWithOverlay = MutableStateFlow(false) override val isDreamingWithOverlay: Flow<Boolean> = _isDreamingWithOverlay private val _isActiveDreamLockscreenHosted = MutableStateFlow(false) override val isActiveDreamLockscreenHosted: StateFlow<Boolean> = _isActiveDreamLockscreenHosted private val _dozeAmount = MutableStateFlow(0f) override val linearDozeAmount: Flow<Float> = _dozeAmount Loading Loading @@ -155,6 +158,10 @@ class FakeKeyguardRepository : KeyguardRepository { _isDreamingWithOverlay.value = isDreaming } override fun setIsActiveDreamLockscreenHosted(isLockscreenHosted: Boolean) { _isActiveDreamLockscreenHosted.value = isLockscreenHosted } fun setDozeAmount(dozeAmount: Float) { _dozeAmount.value = dozeAmount } Loading Loading
packages/SystemUI/src/com/android/systemui/keyguard/data/repository/KeyguardRepository.kt +12 −0 Original line number Diff line number Diff line Loading @@ -121,6 +121,9 @@ interface KeyguardRepository { /** Observable for whether the device is dreaming with an overlay, see [DreamOverlayService] */ val isDreamingWithOverlay: Flow<Boolean> /** Observable for device dreaming state and the active dream is hosted in lockscreen */ val isActiveDreamLockscreenHosted: StateFlow<Boolean> /** * Observable for the amount of doze we are currently in. * Loading Loading @@ -190,6 +193,8 @@ interface KeyguardRepository { fun setLastDozeTapToWakePosition(position: Point) fun setIsDozing(isDozing: Boolean) fun setIsActiveDreamLockscreenHosted(isLockscreenHosted: Boolean) } /** Encapsulates application state for the keyguard. */ Loading Loading @@ -610,6 +615,9 @@ constructor( private val _isQuickSettingsVisible = MutableStateFlow(false) override val isQuickSettingsVisible: Flow<Boolean> = _isQuickSettingsVisible.asStateFlow() private val _isActiveDreamLockscreenHosted = MutableStateFlow(false) override val isActiveDreamLockscreenHosted = _isActiveDreamLockscreenHosted.asStateFlow() override fun setAnimateDozingTransitions(animate: Boolean) { _animateBottomAreaDozingTransitions.value = animate } Loading @@ -628,6 +636,10 @@ constructor( _isQuickSettingsVisible.value = isVisible } override fun setIsActiveDreamLockscreenHosted(isLockscreenHosted: Boolean) { _isActiveDreamLockscreenHosted.value = isLockscreenHosted } private fun statusBarStateIntToObject(value: Int): StatusBarState { return when (value) { 0 -> StatusBarState.SHADE Loading
packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardInteractor.kt +6 −0 Original line number Diff line number Diff line Loading @@ -81,6 +81,8 @@ constructor( val isDreaming: Flow<Boolean> = repository.isDreaming /** Whether the system is dreaming with an overlay active */ val isDreamingWithOverlay: Flow<Boolean> = repository.isDreamingWithOverlay /** Whether the system is dreaming and the active dream is hosted in lockscreen */ val isActiveDreamLockscreenHosted: Flow<Boolean> = repository.isActiveDreamLockscreenHosted /** Event for when the camera gesture is detected */ val onCameraLaunchDetected: Flow<CameraLaunchSourceModel> = conflatedCallbackFlow { val callback = Loading Loading @@ -198,6 +200,10 @@ constructor( } } fun setIsActiveDreamLockscreenHosted(isLockscreenHosted: Boolean) { repository.setIsActiveDreamLockscreenHosted(isLockscreenHosted) } /** Sets whether quick settings or quick-quick settings is visible. */ fun setQuickSettingsVisible(isVisible: Boolean) { repository.setQuickSettingsVisible(isVisible) Loading
packages/SystemUI/tests/src/com/android/systemui/keyguard/data/repository/KeyguardRepositoryImplTest.kt +10 −0 Original line number Diff line number Diff line Loading @@ -298,6 +298,16 @@ class KeyguardRepositoryImplTest : SysuiTestCase() { verify(statusBarStateController).removeCallback(captor.value) } @Test fun isActiveDreamLockscreenHosted() = testScope.runTest { underTest.setIsActiveDreamLockscreenHosted(true) assertThat(underTest.isActiveDreamLockscreenHosted.value).isEqualTo(true) underTest.setIsActiveDreamLockscreenHosted(false) assertThat(underTest.isActiveDreamLockscreenHosted.value).isEqualTo(false) } @Test fun wakefulness() = testScope.runTest { Loading
packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/data/repository/FakeKeyguardRepository.kt +7 −0 Original line number Diff line number Diff line Loading @@ -68,6 +68,9 @@ class FakeKeyguardRepository : KeyguardRepository { private val _isDreamingWithOverlay = MutableStateFlow(false) override val isDreamingWithOverlay: Flow<Boolean> = _isDreamingWithOverlay private val _isActiveDreamLockscreenHosted = MutableStateFlow(false) override val isActiveDreamLockscreenHosted: StateFlow<Boolean> = _isActiveDreamLockscreenHosted private val _dozeAmount = MutableStateFlow(0f) override val linearDozeAmount: Flow<Float> = _dozeAmount Loading Loading @@ -155,6 +158,10 @@ class FakeKeyguardRepository : KeyguardRepository { _isDreamingWithOverlay.value = isDreaming } override fun setIsActiveDreamLockscreenHosted(isLockscreenHosted: Boolean) { _isActiveDreamLockscreenHosted.value = isLockscreenHosted } fun setDozeAmount(dozeAmount: Float) { _dozeAmount.value = dozeAmount } Loading