Merge "Revert "Transitions - Support OCCLUDED -> GONE"" into tm-qpr-dev am: f5c58b6765
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/21742020 Change-Id: I8ec2ee945032a5df6467073d43a9514c0d5bdc86 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -45,7 +45,6 @@ constructor(
|
|||||||
|
|
||||||
override fun start() {
|
override fun start() {
|
||||||
listenForOccludedToLockscreen()
|
listenForOccludedToLockscreen()
|
||||||
listenForOccludedToGone()
|
|
||||||
listenForOccludedToDreaming()
|
listenForOccludedToDreaming()
|
||||||
listenForOccludedToAodOrDozing()
|
listenForOccludedToAodOrDozing()
|
||||||
}
|
}
|
||||||
@@ -73,22 +72,11 @@ constructor(
|
|||||||
private fun listenForOccludedToLockscreen() {
|
private fun listenForOccludedToLockscreen() {
|
||||||
scope.launch {
|
scope.launch {
|
||||||
keyguardInteractor.isKeyguardOccluded
|
keyguardInteractor.isKeyguardOccluded
|
||||||
.sample(
|
.sample(keyguardTransitionInteractor.startedKeyguardTransitionStep, ::Pair)
|
||||||
combine(
|
.collect { (isOccluded, lastStartedKeyguardState) ->
|
||||||
keyguardInteractor.isKeyguardShowing,
|
|
||||||
keyguardTransitionInteractor.startedKeyguardTransitionStep,
|
|
||||||
::Pair
|
|
||||||
),
|
|
||||||
::toTriple
|
|
||||||
)
|
|
||||||
.collect { (isOccluded, isShowing, lastStartedKeyguardState) ->
|
|
||||||
// Occlusion signals come from the framework, and should interrupt any
|
// Occlusion signals come from the framework, and should interrupt any
|
||||||
// existing transition
|
// existing transition
|
||||||
if (
|
if (!isOccluded && lastStartedKeyguardState.to == KeyguardState.OCCLUDED) {
|
||||||
!isOccluded &&
|
|
||||||
isShowing &&
|
|
||||||
lastStartedKeyguardState.to == KeyguardState.OCCLUDED
|
|
||||||
) {
|
|
||||||
keyguardTransitionRepository.startTransition(
|
keyguardTransitionRepository.startTransition(
|
||||||
TransitionInfo(
|
TransitionInfo(
|
||||||
name,
|
name,
|
||||||
@@ -102,38 +90,6 @@ constructor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun listenForOccludedToGone() {
|
|
||||||
scope.launch {
|
|
||||||
keyguardInteractor.isKeyguardOccluded
|
|
||||||
.sample(
|
|
||||||
combine(
|
|
||||||
keyguardInteractor.isKeyguardShowing,
|
|
||||||
keyguardTransitionInteractor.startedKeyguardTransitionStep,
|
|
||||||
::Pair
|
|
||||||
),
|
|
||||||
::toTriple
|
|
||||||
)
|
|
||||||
.collect { (isOccluded, isShowing, lastStartedKeyguardState) ->
|
|
||||||
// Occlusion signals come from the framework, and should interrupt any
|
|
||||||
// existing transition
|
|
||||||
if (
|
|
||||||
!isOccluded &&
|
|
||||||
!isShowing &&
|
|
||||||
lastStartedKeyguardState.to == KeyguardState.OCCLUDED
|
|
||||||
) {
|
|
||||||
keyguardTransitionRepository.startTransition(
|
|
||||||
TransitionInfo(
|
|
||||||
name,
|
|
||||||
KeyguardState.OCCLUDED,
|
|
||||||
KeyguardState.GONE,
|
|
||||||
getAnimator(),
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun listenForOccludedToAodOrDozing() {
|
private fun listenForOccludedToAodOrDozing() {
|
||||||
scope.launch {
|
scope.launch {
|
||||||
keyguardInteractor.wakefulnessModel
|
keyguardInteractor.wakefulnessModel
|
||||||
|
|||||||
@@ -397,92 +397,6 @@ class KeyguardTransitionScenariosTest : SysuiTestCase() {
|
|||||||
coroutineContext.cancelChildren()
|
coroutineContext.cancelChildren()
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
fun `OCCLUDED to GONE`() =
|
|
||||||
testScope.runTest {
|
|
||||||
// GIVEN a device on lockscreen
|
|
||||||
keyguardRepository.setKeyguardShowing(true)
|
|
||||||
runCurrent()
|
|
||||||
|
|
||||||
// GIVEN a prior transition has run to OCCLUDED
|
|
||||||
runner.startTransition(
|
|
||||||
testScope,
|
|
||||||
TransitionInfo(
|
|
||||||
ownerName = "",
|
|
||||||
from = KeyguardState.LOCKSCREEN,
|
|
||||||
to = KeyguardState.OCCLUDED,
|
|
||||||
animator =
|
|
||||||
ValueAnimator().apply {
|
|
||||||
duration = 10
|
|
||||||
interpolator = Interpolators.LINEAR
|
|
||||||
},
|
|
||||||
)
|
|
||||||
)
|
|
||||||
keyguardRepository.setKeyguardOccluded(true)
|
|
||||||
runCurrent()
|
|
||||||
reset(mockTransitionRepository)
|
|
||||||
|
|
||||||
// WHEN keyguard goes away
|
|
||||||
keyguardRepository.setKeyguardShowing(false)
|
|
||||||
// AND occlusion ends
|
|
||||||
keyguardRepository.setKeyguardOccluded(false)
|
|
||||||
runCurrent()
|
|
||||||
|
|
||||||
val info =
|
|
||||||
withArgCaptor<TransitionInfo> {
|
|
||||||
verify(mockTransitionRepository).startTransition(capture(), anyBoolean())
|
|
||||||
}
|
|
||||||
// THEN a transition to GONE should occur
|
|
||||||
assertThat(info.ownerName).isEqualTo("FromOccludedTransitionInteractor")
|
|
||||||
assertThat(info.from).isEqualTo(KeyguardState.OCCLUDED)
|
|
||||||
assertThat(info.to).isEqualTo(KeyguardState.GONE)
|
|
||||||
assertThat(info.animator).isNotNull()
|
|
||||||
|
|
||||||
coroutineContext.cancelChildren()
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
fun `OCCLUDED to LOCKSCREEN`() =
|
|
||||||
testScope.runTest {
|
|
||||||
// GIVEN a device on lockscreen
|
|
||||||
keyguardRepository.setKeyguardShowing(true)
|
|
||||||
runCurrent()
|
|
||||||
|
|
||||||
// GIVEN a prior transition has run to OCCLUDED
|
|
||||||
runner.startTransition(
|
|
||||||
testScope,
|
|
||||||
TransitionInfo(
|
|
||||||
ownerName = "",
|
|
||||||
from = KeyguardState.LOCKSCREEN,
|
|
||||||
to = KeyguardState.OCCLUDED,
|
|
||||||
animator =
|
|
||||||
ValueAnimator().apply {
|
|
||||||
duration = 10
|
|
||||||
interpolator = Interpolators.LINEAR
|
|
||||||
},
|
|
||||||
)
|
|
||||||
)
|
|
||||||
keyguardRepository.setKeyguardOccluded(true)
|
|
||||||
runCurrent()
|
|
||||||
reset(mockTransitionRepository)
|
|
||||||
|
|
||||||
// WHEN occlusion ends
|
|
||||||
keyguardRepository.setKeyguardOccluded(false)
|
|
||||||
runCurrent()
|
|
||||||
|
|
||||||
val info =
|
|
||||||
withArgCaptor<TransitionInfo> {
|
|
||||||
verify(mockTransitionRepository).startTransition(capture(), anyBoolean())
|
|
||||||
}
|
|
||||||
// THEN a transition to LOCKSCREEN should occur
|
|
||||||
assertThat(info.ownerName).isEqualTo("FromOccludedTransitionInteractor")
|
|
||||||
assertThat(info.from).isEqualTo(KeyguardState.OCCLUDED)
|
|
||||||
assertThat(info.to).isEqualTo(KeyguardState.LOCKSCREEN)
|
|
||||||
assertThat(info.animator).isNotNull()
|
|
||||||
|
|
||||||
coroutineContext.cancelChildren()
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `LOCKSCREEN to DOZING`() =
|
fun `LOCKSCREEN to DOZING`() =
|
||||||
testScope.runTest {
|
testScope.runTest {
|
||||||
|
|||||||
Reference in New Issue
Block a user