Merge "Prevent double keyguardGoingAway, and finish cancelled animations." into sc-v2-dev am: 13453180ce
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16441222
Change-Id: Ia4cb37f56ecb4dc67b3c7abaf7d99de9bab841bb
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
index 8d07336..89a5d72 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
@@ -2090,6 +2090,15 @@
private final Runnable mKeyguardGoingAwayRunnable = new Runnable() {
@Override
public void run() {
+ // If the keyguard is already going away, or it's about to because we are going to
+ // trigger the going-away remote animation to show the surface behind, don't do it
+ // again. That will cause the current animation to be cancelled unnecessarily.
+ if (mKeyguardStateController.isKeyguardGoingAway()
+ || mSurfaceBehindRemoteAnimationRequested
+ || mSurfaceBehindRemoteAnimationRunning) {
+ return;
+ }
+
Trace.beginSection("KeyguardViewMediator.mKeyGuardGoingAwayRunnable");
if (DEBUG) Log.d(TAG, "keyguardGoingAway");
mKeyguardViewControllerLazy.get().keyguardGoingAway();
@@ -2451,9 +2460,7 @@
if (mSurfaceBehindRemoteAnimationFinishedCallback != null) {
try {
- if (!cancelled) {
- mSurfaceBehindRemoteAnimationFinishedCallback.onAnimationFinished();
- }
+ mSurfaceBehindRemoteAnimationFinishedCallback.onAnimationFinished();
mSurfaceBehindRemoteAnimationFinishedCallback = null;
} catch (RemoteException e) {
e.printStackTrace();