[ShellTrans] Fix SystemUI crash when finish keyguard animation.

The animation leashes will be release after calls
KVM#finishSurfaceBehindRemoteAnimation, so if there are playing
animation with setSurfaceBehindAppearAmount, the released leash could
cause SystemUI crash.
There are two scenario may cause that crash:
1. Hovering between Keyguard <=> Launcher, which could trigger
fadeOutSurfaceBehind and finish the remote animation, so the
surfaceBehindRemoteAnimationTargets could remained in KUAC. Then when
next transition animation start, KUAC could attemp to play animation
with those released leash.
2. Unlock keyguard directly, notifyFinishedKeyguardExitAnimation will
cancel the surfaceBehindAlphaAnimator, which could finish the remote
animation immediately before setSurfaceBehindAppearAmount. To ensure
the opening app must be visible, calls setSurfaceBehindAppearAmount
before cancel animatiors.

Fixes: 262444073
Test: enable shell transition, then scroll up to unlock device,
a. verify the launcher won't stay in a fully/semi transparent.
b. verify the launcher won't reshow when scrolling on keyguard.
Also verify above cases via fingerprint unlock.

Change-Id: Ib8c0211c35e76ec46337c1e8807e381081755ad1
This commit is contained in:
wilsonshih
2022-12-15 09:34:39 +00:00
committed by Wei Sheng Shih
parent e068bb37e4
commit 3306e7bb7c

View File

@@ -321,6 +321,7 @@ class KeyguardUnlockAnimationController @Inject constructor(
// and unlock the device as well as hiding the surface.
if (surfaceBehindAlpha == 0f) {
Log.d(TAG, "surfaceBehindAlphaAnimator#onAnimationEnd")
surfaceBehindRemoteAnimationTargets = null
keyguardViewMediator.get().finishSurfaceBehindRemoteAnimation(
false /* cancelled */)
} else {
@@ -825,13 +826,13 @@ class KeyguardUnlockAnimationController @Inject constructor(
// Make sure we made the surface behind fully visible, just in case. It should already be
// fully visible. The exit animation is finished, and we should not hold the leash anymore,
// so forcing it to 1f.
surfaceBehindAlphaAnimator.cancel()
surfaceBehindEntryAnimator.cancel()
surfaceBehindAlpha = 1f
setSurfaceBehindAppearAmount(1f)
surfaceBehindAlphaAnimator.cancel()
surfaceBehindEntryAnimator.cancel()
try {
launcherUnlockController?.setUnlockAmount(1f, false /* forceIfAnimating */)
} catch (e: RemoteException) {
} catch (e: RemoteException) {
Log.e(TAG, "Remote exception in notifyFinishedKeyguardExitAnimation", e)
}