Merge "Fix setSurfaceBehindVisibility(false) being ignored" into main
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/binder/WindowManagerLockscreenVisibilityManagerTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/binder/WindowManagerLockscreenVisibilityManagerTest.kt
index 9c58e2b..92764ae 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/binder/WindowManagerLockscreenVisibilityManagerTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/binder/WindowManagerLockscreenVisibilityManagerTest.kt
@@ -29,11 +29,13 @@
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
+import org.mockito.ArgumentMatchers.eq
import org.mockito.Mock
import org.mockito.Mockito.anyInt
import org.mockito.Mockito.verify
import org.mockito.Mockito.verifyNoMoreInteractions
import org.mockito.MockitoAnnotations
+import org.mockito.kotlin.any
@SmallTest
@RunWith(AndroidJUnit4::class)
@@ -112,4 +114,20 @@
verify(activityTaskManagerService).setLockScreenShown(true, false)
verifyNoMoreInteractions(activityTaskManagerService)
}
+
+ @Test
+ fun setSurfaceBehindVisibility_goesAwayFirst_andIgnoresSecondCall() {
+ underTest.setLockscreenShown(true)
+ underTest.setSurfaceBehindVisibility(true)
+ verify(activityTaskManagerService).keyguardGoingAway(0)
+
+ underTest.setSurfaceBehindVisibility(true)
+ verifyNoMoreInteractions(keyguardTransitions)
+ }
+
+ @Test
+ fun setSurfaceBehindVisibility_falseSetsLockscreenVisibility() {
+ underTest.setSurfaceBehindVisibility(false)
+ verify(activityTaskManagerService).setLockScreenShown(eq(true), any())
+ }
}
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/WindowManagerLockscreenVisibilityManager.kt b/packages/SystemUI/src/com/android/systemui/keyguard/WindowManagerLockscreenVisibilityManager.kt
index 032af94..2914cb9 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/WindowManagerLockscreenVisibilityManager.kt
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/WindowManagerLockscreenVisibilityManager.kt
@@ -44,7 +44,7 @@
private val keyguardStateController: KeyguardStateController,
private val keyguardSurfaceBehindAnimator: KeyguardSurfaceBehindParamsApplier,
private val keyguardDismissTransitionInteractor: KeyguardDismissTransitionInteractor,
- private val keyguardTransitions: KeyguardTransitions
+ private val keyguardTransitions: KeyguardTransitions,
) {
/**
@@ -108,27 +108,28 @@
* Manager to effect the change.
*/
fun setSurfaceBehindVisibility(visible: Boolean) {
- if (isKeyguardGoingAway == visible) {
- Log.d(TAG, "WmLockscreenVisibilityManager#setVisibility -> already visible=$visible")
+ if (isKeyguardGoingAway && visible) {
+ Log.d(TAG, "#setSurfaceBehindVisibility: already visible, ignoring")
return
}
// The surface behind is always visible if the lockscreen is not showing, so we're already
// visible.
if (visible && isLockscreenShowing != true) {
- Log.d(TAG, "#setVisibility -> already visible since the lockscreen isn't showing")
+ Log.d(TAG, "#setSurfaceBehindVisibility: ignoring since the lockscreen isn't showing")
return
}
-
-
if (visible) {
if (enableNewKeyguardShellTransitions) {
- keyguardTransitions.startKeyguardTransition(false /* keyguardShowing */, false /* aodShowing */)
+ keyguardTransitions.startKeyguardTransition(
+ false /* keyguardShowing */,
+ false, /* aodShowing */
+ )
isKeyguardGoingAway = true
return
}
- // Make the surface visible behind the keyguard by calling keyguardGoingAway. The
+ // Make the surface behind the keyguard visible by calling keyguardGoingAway. The
// lockscreen is still showing as well, allowing us to animate unlocked.
Log.d(TAG, "ActivityTaskManagerService#keyguardGoingAway()")
activityTaskManagerService.keyguardGoingAway(0)
@@ -153,7 +154,7 @@
apps: Array<RemoteAnimationTarget>,
wallpapers: Array<RemoteAnimationTarget>,
nonApps: Array<RemoteAnimationTarget>,
- finishedCallback: IRemoteAnimationFinishedCallback
+ finishedCallback: IRemoteAnimationFinishedCallback,
) {
// 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
@@ -203,27 +204,25 @@
*/
private fun setWmLockscreenState(
lockscreenShowing: Boolean? = this.isLockscreenShowing,
- aodVisible: Boolean = this.isAodVisible
+ aodVisible: Boolean = this.isAodVisible,
) {
- Log.d(
- TAG,
- "#setWmLockscreenState(" +
- "isLockscreenShowing=$lockscreenShowing, " +
- "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."
+ "will happen once KeyguardTransitionBootInteractor starts the boot transition.",
)
this.isAodVisible = aodVisible
return
}
if (this.isLockscreenShowing == lockscreenShowing && this.isAodVisible == aodVisible) {
+ Log.d(
+ TAG,
+ "#setWmLockscreenState: lockscreenShowing=$lockscreenShowing and " +
+ "isAodVisible=$aodVisible were both unchanged, not forwarding to ATMS.",
+ )
return
}
@@ -231,7 +230,7 @@
TAG,
"ATMS#setLockScreenShown(" +
"isLockscreenShowing=$lockscreenShowing, " +
- "aodVisible=$aodVisible)."
+ "aodVisible=$aodVisible).",
)
if (enableNewKeyguardShellTransitions) {
keyguardTransitions.startKeyguardTransition(lockscreenShowing, aodVisible)
@@ -247,7 +246,7 @@
Log.d(
TAG,
"#endKeyguardGoingAwayAnimation() called when isKeyguardGoingAway=false. " +
- "Short-circuiting."
+ "Short-circuiting.",
)
return
}