Skip to content
Snippets Groups Projects
Commit a3c08e42 authored by Josh Tsuji's avatar Josh Tsuji Committed by Android (Google) Code Review
Browse files

Merge changes I50b3bd44,Ie538dbc4,Ieeb71ec9 into main

* changes:
  Don't call setLockScreenShown until we know if it's showing.
  Always start dismiss transition when the going away animation starts.
  Check both isDozing and isAodAvailable for aodVisibility.
parents 27ff767b c492897f
No related branches found
No related tags found
No related merge requests found
......@@ -142,15 +142,17 @@ constructor(
nonApps: Array<RemoteAnimationTarget>,
finishedCallback: IRemoteAnimationFinishedCallback
) {
if (apps.isNotEmpty()) {
// Ensure that we've started a dismiss keyguard transition. WindowManager can start the
// going away animation on its own, if an activity launches and then requests dismissing
// the keyguard. In this case, this is the first and only signal we'll receive to start
// a transition to GONE.
keyguardTransitionInteractor.startDismissKeyguardTransition(
reason = "Going away remote animation started"
)
// Ensure that we've started a dismiss keyguard transition. WindowManager can start the
// going away animation on its own, if an activity launches and then requests dismissing the
// keyguard. In this case, this is the first and only signal we'll receive to start
// a transition to GONE. This transition needs to start even if we're not provided an app
// animation target - it's possible the app is destroyed on creation, etc. but we'll still
// be unlocking.
keyguardTransitionInteractor.startDismissKeyguardTransition(
reason = "Going away remote animation started"
)
if (apps.isNotEmpty()) {
goingAwayRemoteAnimationFinishedCallback = finishedCallback
keyguardSurfaceBehindAnimator.applyParamsToSurface(apps[0])
} else {
......@@ -183,25 +185,11 @@ constructor(
/**
* Sets the lockscreen state WM-side by calling ATMS#setLockScreenShown.
*
* [lockscreenShowing] defaults to true, since it's only ever null during the boot sequence,
* when we haven't yet called ATMS#setLockScreenShown. Typically,
* setWmLockscreenState(lockscreenShowing = true) is called early in the boot sequence, before
* setWmLockscreenState(aodVisible = true), so we don't expect to need to use this default, but
* if so, true should be the right choice.
* If [lockscreenShowing] is null, it means we don't know if the lockscreen is showing yet. This
* will be decided by the [KeyguardTransitionBootInteractor] shortly.
*/
private fun setWmLockscreenState(
lockscreenShowing: Boolean =
this.isLockscreenShowing
?: true.also {
Log.d(
TAG,
"Using isLockscreenShowing=true default in setWmLockscreenState, " +
"because setAodVisible was called before the first " +
"setLockscreenShown call during boot. This is not typical, but is " +
"theoretically possible. If you're investigating the lockscreen " +
"showing unexpectedly, start here."
)
},
lockscreenShowing: Boolean? = this.isLockscreenShowing,
aodVisible: Boolean = this.isAodVisible
) {
Log.d(
......@@ -211,10 +199,27 @@ constructor(
"aodVisible=$aodVisible)."
)
if (lockscreenShowing == null) {
Log.d(
TAG,
"isAodVisible=$aodVisible, but lockscreenShowing=null. Waiting for" +
"non-null lockscreenShowing before calling ATMS#setLockScreenShown, which" +
"will happen once KeyguardTransitionBootInteractor starts the boot transition."
)
this.isAodVisible = aodVisible
return
}
if (this.isLockscreenShowing == lockscreenShowing && this.isAodVisible == aodVisible) {
return
}
Log.d(
TAG,
"ATMS#setLockScreenShown(" +
"isLockscreenShowing=$lockscreenShowing, " +
"aodVisible=$aodVisible)."
)
activityTaskManagerService.setLockScreenShown(lockscreenShowing, aodVisible)
this.isLockscreenShowing = lockscreenShowing
this.isAodVisible = aodVisible
......
......@@ -229,11 +229,14 @@ constructor(
val aodVisibility: Flow<Boolean> =
combine(
keyguardInteractor.isDozing,
keyguardInteractor.isAodAvailable,
keyguardInteractor.biometricUnlockState,
) { isDozing, biometricUnlockState ->
) { isDozing, isAodAvailable, biometricUnlockState ->
// AOD is visible if we're dozing, unless we are wake and unlocking (where we go
// directly from AOD to unlocked while dozing).
isDozing && !BiometricUnlockMode.isWakeAndUnlock(biometricUnlockState.mode)
isDozing &&
isAodAvailable &&
!BiometricUnlockMode.isWakeAndUnlock(biometricUnlockState.mode)
}
.distinctUntilChanged()
......
......@@ -100,9 +100,11 @@ class WindowManagerLockscreenVisibilityManagerTest : SysuiTestCase() {
}
@Test
fun testAodVisible_noLockscreenShownCallYet_defaultsToShowLockscreen() {
fun testAodVisible_noLockscreenShownCallYet_doesNotShowLockscreenUntilLater() {
underTest.setAodVisible(false)
verifyNoMoreInteractions(activityTaskManagerService)
underTest.setLockscreenShown(true)
verify(activityTaskManagerService).setLockScreenShown(true, false)
verifyNoMoreInteractions(activityTaskManagerService)
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment