summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Coco Duan <cocod@google.com> 2023-07-07 16:38:14 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2023-07-07 16:38:14 +0000
commitabeaa64df5b0e0889c85820c67a54d476217565e (patch)
tree5b07a5c1bf820ee6c3277c98944a5e7512d85ed9
parentd6cdafe3ccf0a41d184f7b7c5df1259a44a7f2e6 (diff)
parentad1ad796037ed4684fcb31ac5cf324e885e11f71 (diff)
Merge "Populate a new dreaming state to KeyguardInterator for wallpaper dream" into udc-qpr-dev
-rw-r--r--packages/SystemUI/src/com/android/systemui/keyguard/data/repository/KeyguardRepository.kt12
-rw-r--r--packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardInteractor.kt6
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/keyguard/data/repository/KeyguardRepositoryImplTest.kt10
-rw-r--r--packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/data/repository/FakeKeyguardRepository.kt7
4 files changed, 35 insertions, 0 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/data/repository/KeyguardRepository.kt b/packages/SystemUI/src/com/android/systemui/keyguard/data/repository/KeyguardRepository.kt
index edc0b45d27f2..e7704d625168 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/data/repository/KeyguardRepository.kt
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/data/repository/KeyguardRepository.kt
@@ -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.
*
@@ -190,6 +193,8 @@ interface KeyguardRepository {
fun setLastDozeTapToWakePosition(position: Point)
fun setIsDozing(isDozing: Boolean)
+
+ fun setIsActiveDreamLockscreenHosted(isLockscreenHosted: Boolean)
}
/** Encapsulates application state for the keyguard. */
@@ -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
}
@@ -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
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardInteractor.kt b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardInteractor.kt
index 228290a3203f..7fae7522d981 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardInteractor.kt
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardInteractor.kt
@@ -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 =
@@ -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)
diff --git a/packages/SystemUI/tests/src/com/android/systemui/keyguard/data/repository/KeyguardRepositoryImplTest.kt b/packages/SystemUI/tests/src/com/android/systemui/keyguard/data/repository/KeyguardRepositoryImplTest.kt
index 25573de1b12b..e9f0d561371c 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/keyguard/data/repository/KeyguardRepositoryImplTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/keyguard/data/repository/KeyguardRepositoryImplTest.kt
@@ -299,6 +299,16 @@ class KeyguardRepositoryImplTest : SysuiTestCase() {
}
@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 {
val values = mutableListOf<WakefulnessModel>()
diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/data/repository/FakeKeyguardRepository.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/data/repository/FakeKeyguardRepository.kt
index f6cbb072495f..eb2f71a9b951 100644
--- a/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/data/repository/FakeKeyguardRepository.kt
+++ b/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/data/repository/FakeKeyguardRepository.kt
@@ -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
@@ -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
}