Merge "Populate a new dreaming state to KeyguardInterator for wallpaper dream" into udc-qpr-dev
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user