Fix lockscreen anim not running on unlock with FPS

For side FPS devices, it is possible for the device to be waking up
and also dreaming. If this happens a
BiometricUnlockController.MODE_WAKE_AND_UNLOCK_FROM_DREAM is
sent. This will then take path that assumes the lockscreen content
will be hidden immediately, as if from AOD. This isn't the case for
side FPS devices, where the animation still needs to run.

Test: atest KeyguardUnlockAnimationControllerTest
Test: manual - This is a timing issue. Unlock with side FPS over and
over again to ensure the animation runs
Fixes: 283672908

Change-Id: Ia5c426596977a4e98ad4abdb65ce9b72d8154045
This commit is contained in:
Matt Pietal
2023-05-31 17:37:37 +00:00
parent f4f331d65a
commit 51341e5c27
3 changed files with 53 additions and 6 deletions

View File

@@ -50,6 +50,7 @@ import com.android.systemui.shared.system.smartspace.SmartspaceState
import com.android.systemui.statusbar.NotificationShadeWindowController
import com.android.systemui.statusbar.SysuiStatusBarStateController
import com.android.systemui.statusbar.phone.BiometricUnlockController
import com.android.systemui.statusbar.phone.BiometricUnlockController.MODE_WAKE_AND_UNLOCK_FROM_DREAM
import com.android.systemui.statusbar.policy.KeyguardStateController
import dagger.Lazy
import javax.inject.Inject
@@ -171,7 +172,7 @@ class KeyguardUnlockAnimationController @Inject constructor(
@JvmDefault
fun onUnlockAnimationStarted(
playingCannedAnimation: Boolean,
fromWakeAndUnlock: Boolean,
isWakeAndUnlockNotFromDream: Boolean,
unlockAnimationStartDelay: Long,
unlockAnimationDuration: Long
) {}
@@ -575,10 +576,13 @@ class KeyguardUnlockAnimationController @Inject constructor(
playCannedUnlockAnimation()
}
// Notify if waking from AOD only
val isWakeAndUnlockNotFromDream = biometricUnlockControllerLazy.get().isWakeAndUnlock &&
biometricUnlockControllerLazy.get().mode != MODE_WAKE_AND_UNLOCK_FROM_DREAM
listeners.forEach {
it.onUnlockAnimationStarted(
playingCannedUnlockAnimation /* playingCannedAnimation */,
biometricUnlockControllerLazy.get().isWakeAndUnlock /* isWakeAndUnlock */,
isWakeAndUnlockNotFromDream /* isWakeAndUnlockNotFromDream */,
CANNED_UNLOCK_START_DELAY /* unlockStartDelay */,
LAUNCHER_ICONS_ANIMATION_DURATION_MS /* unlockAnimationDuration */) }

View File

@@ -934,10 +934,11 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump
@Override
public void onUnlockAnimationStarted(
boolean playingCannedAnimation,
boolean isWakeAndUnlock,
boolean isWakeAndUnlockNotFromDream,
long startDelay,
long unlockAnimationDuration) {
unlockAnimationStarted(playingCannedAnimation, isWakeAndUnlock, startDelay);
unlockAnimationStarted(playingCannedAnimation, isWakeAndUnlockNotFromDream,
startDelay);
}
});
mAlternateBouncerInteractor = alternateBouncerInteractor;
@@ -952,7 +953,7 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump
private void unlockAnimationStarted(
boolean playingCannedAnimation,
boolean isWakeAndUnlock,
boolean isWakeAndUnlockNotFromDream,
long unlockAnimationStartDelay) {
// Disable blurs while we're unlocking so that panel expansion does not
// cause blurring. This will eventually be re-enabled by the panel view on
@@ -960,7 +961,7 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump
// unlock gesture, and we don't want that to cause blurring either.
mDepthController.setBlursDisabledForUnlock(mTracking);
if (playingCannedAnimation && !isWakeAndUnlock) {
if (playingCannedAnimation && !isWakeAndUnlockNotFromDream) {
// Hide the panel so it's not in the way or the surface behind the
// keyguard, which will be appearing. If we're wake and unlocking, the
// lock screen is hidden instantly so should not be flung away.

View File

@@ -21,6 +21,7 @@ import com.android.systemui.statusbar.NotificationShadeWindowController
import com.android.systemui.statusbar.SysuiStatusBarStateController
import com.android.systemui.statusbar.phone.BiometricUnlockController
import com.android.systemui.statusbar.policy.KeyguardStateController
import com.android.systemui.util.mockito.any
import com.android.systemui.util.mockito.argThat
import com.android.systemui.util.mockito.whenever
import junit.framework.Assert.assertEquals
@@ -32,6 +33,7 @@ import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.Mock
import org.mockito.Mockito.atLeastOnce
import org.mockito.Mockito.eq
import org.mockito.Mockito.mock
import org.mockito.Mockito.never
import org.mockito.Mockito.times
@@ -173,6 +175,46 @@ class KeyguardUnlockAnimationControllerTest : SysuiTestCase() {
false /* cancelled */)
}
@Test
fun onWakeAndUnlock_notifiesListenerWithTrue() {
whenever(biometricUnlockController.isWakeAndUnlock).thenReturn(true)
whenever(biometricUnlockController.mode).thenReturn(
BiometricUnlockController.MODE_WAKE_AND_UNLOCK)
val listener = mock(
KeyguardUnlockAnimationController.KeyguardUnlockAnimationListener::class.java)
keyguardUnlockAnimationController.addKeyguardUnlockAnimationListener(listener)
keyguardUnlockAnimationController.notifyStartSurfaceBehindRemoteAnimation(
remoteAnimationTargets,
wallpaperTargets,
0 /* startTime */,
false /* requestedShowSurfaceBehindKeyguard */
)
verify(listener).onUnlockAnimationStarted(any(), eq(true), any(), any())
}
@Test
fun onWakeAndUnlockFromDream_notifiesListenerWithFalse() {
whenever(biometricUnlockController.isWakeAndUnlock).thenReturn(true)
whenever(biometricUnlockController.mode).thenReturn(
BiometricUnlockController.MODE_WAKE_AND_UNLOCK_FROM_DREAM)
val listener = mock(
KeyguardUnlockAnimationController.KeyguardUnlockAnimationListener::class.java)
keyguardUnlockAnimationController.addKeyguardUnlockAnimationListener(listener)
keyguardUnlockAnimationController.notifyStartSurfaceBehindRemoteAnimation(
remoteAnimationTargets,
wallpaperTargets,
0 /* startTime */,
false /* requestedShowSurfaceBehindKeyguard */
)
verify(listener).onUnlockAnimationStarted(any(), eq(false), any(), any())
}
/**
* If we requested that the surface behind be made visible, and we're not flinging away the
* keyguard, it means that we're swiping to unlock and want the surface visible so it can follow