Merge changes Ifd7bc217,I337d0189 into tm-qpr-dev am: 27df631c6f
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/21299267 Change-Id: Iefb9cf6518bcf6fd462a326bbfdbfe8b0a526ceb Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -900,7 +900,7 @@
|
|||||||
android:showWhenLocked="true"
|
android:showWhenLocked="true"
|
||||||
android:showForAllUsers="true"
|
android:showForAllUsers="true"
|
||||||
android:finishOnTaskLaunch="true"
|
android:finishOnTaskLaunch="true"
|
||||||
android:launchMode="singleInstance"
|
android:lockTaskMode="if_whitelisted"
|
||||||
android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation|keyboard|keyboardHidden"
|
android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation|keyboard|keyboardHidden"
|
||||||
android:visibleToInstantApps="true">
|
android:visibleToInstantApps="true">
|
||||||
</activity>
|
</activity>
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ import kotlinx.coroutines.CoroutineScope
|
|||||||
import kotlinx.coroutines.delay
|
import kotlinx.coroutines.delay
|
||||||
import kotlinx.coroutines.flow.collect
|
import kotlinx.coroutines.flow.collect
|
||||||
import kotlinx.coroutines.flow.combine
|
import kotlinx.coroutines.flow.combine
|
||||||
|
import kotlinx.coroutines.flow.distinctUntilChanged
|
||||||
import kotlinx.coroutines.flow.onEach
|
import kotlinx.coroutines.flow.onEach
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
|
|
||||||
@@ -56,9 +57,14 @@ constructor(
|
|||||||
|
|
||||||
private fun listenForDreamingToLockscreen() {
|
private fun listenForDreamingToLockscreen() {
|
||||||
scope.launch {
|
scope.launch {
|
||||||
// Using isDreamingWithOverlay provides an optimized path to LOCKSCREEN state, which
|
// Dependending on the dream, either dream state or occluded change will change first,
|
||||||
// otherwise would have gone through OCCLUDED first
|
// so listen for both
|
||||||
keyguardInteractor.isAbleToDream
|
combine(keyguardInteractor.isAbleToDream, keyguardInteractor.isKeyguardOccluded) {
|
||||||
|
isAbleToDream,
|
||||||
|
isKeyguardOccluded ->
|
||||||
|
isAbleToDream && isKeyguardOccluded
|
||||||
|
}
|
||||||
|
.distinctUntilChanged()
|
||||||
.sample(
|
.sample(
|
||||||
combine(
|
combine(
|
||||||
keyguardInteractor.dozeTransitionModel,
|
keyguardInteractor.dozeTransitionModel,
|
||||||
|
|||||||
@@ -158,7 +158,7 @@ class KeyguardTransitionScenariosTest : SysuiTestCase() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `DREAMING to LOCKSCREEN`() =
|
fun `DREAMING to LOCKSCREEN - dreaming state changes first`() =
|
||||||
testScope.runTest {
|
testScope.runTest {
|
||||||
// GIVEN a device is dreaming and occluded
|
// GIVEN a device is dreaming and occluded
|
||||||
keyguardRepository.setDreamingWithOverlay(true)
|
keyguardRepository.setDreamingWithOverlay(true)
|
||||||
@@ -188,9 +188,59 @@ class KeyguardTransitionScenariosTest : SysuiTestCase() {
|
|||||||
)
|
)
|
||||||
// AND dreaming has stopped
|
// AND dreaming has stopped
|
||||||
keyguardRepository.setDreamingWithOverlay(false)
|
keyguardRepository.setDreamingWithOverlay(false)
|
||||||
|
advanceUntilIdle()
|
||||||
|
// AND then occluded has stopped
|
||||||
|
keyguardRepository.setKeyguardOccluded(false)
|
||||||
|
advanceUntilIdle()
|
||||||
|
|
||||||
|
val info =
|
||||||
|
withArgCaptor<TransitionInfo> {
|
||||||
|
verify(mockTransitionRepository).startTransition(capture())
|
||||||
|
}
|
||||||
|
// THEN a transition to BOUNCER should occur
|
||||||
|
assertThat(info.ownerName).isEqualTo("FromDreamingTransitionInteractor")
|
||||||
|
assertThat(info.from).isEqualTo(KeyguardState.DREAMING)
|
||||||
|
assertThat(info.to).isEqualTo(KeyguardState.LOCKSCREEN)
|
||||||
|
assertThat(info.animator).isNotNull()
|
||||||
|
|
||||||
|
coroutineContext.cancelChildren()
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `DREAMING to LOCKSCREEN - occluded state changes first`() =
|
||||||
|
testScope.runTest {
|
||||||
|
// GIVEN a device is dreaming and occluded
|
||||||
|
keyguardRepository.setDreamingWithOverlay(true)
|
||||||
|
keyguardRepository.setKeyguardOccluded(true)
|
||||||
|
runCurrent()
|
||||||
|
|
||||||
|
// GIVEN a prior transition has run to DREAMING
|
||||||
|
runner.startTransition(
|
||||||
|
testScope,
|
||||||
|
TransitionInfo(
|
||||||
|
ownerName = "",
|
||||||
|
from = KeyguardState.LOCKSCREEN,
|
||||||
|
to = KeyguardState.DREAMING,
|
||||||
|
animator =
|
||||||
|
ValueAnimator().apply {
|
||||||
|
duration = 10
|
||||||
|
interpolator = Interpolators.LINEAR
|
||||||
|
},
|
||||||
|
)
|
||||||
|
)
|
||||||
|
runCurrent()
|
||||||
|
reset(mockTransitionRepository)
|
||||||
|
|
||||||
|
// WHEN doze is complete
|
||||||
|
keyguardRepository.setDozeTransitionModel(
|
||||||
|
DozeTransitionModel(from = DozeStateModel.DOZE, to = DozeStateModel.FINISH)
|
||||||
|
)
|
||||||
// AND occluded has stopped
|
// AND occluded has stopped
|
||||||
keyguardRepository.setKeyguardOccluded(false)
|
keyguardRepository.setKeyguardOccluded(false)
|
||||||
advanceUntilIdle()
|
advanceUntilIdle()
|
||||||
|
// AND then dreaming has stopped
|
||||||
|
keyguardRepository.setDreamingWithOverlay(false)
|
||||||
|
advanceUntilIdle()
|
||||||
|
|
||||||
val info =
|
val info =
|
||||||
withArgCaptor<TransitionInfo> {
|
withArgCaptor<TransitionInfo> {
|
||||||
|
|||||||
Reference in New Issue
Block a user