From 8cba01348cb0b39ef6f1d0d3206b7506fe2720e0 Mon Sep 17 00:00:00 2001 From: Beverly Date: Tue, 18 May 2021 11:49:18 -0400 Subject: [PATCH] onFinished, update scrim based on lastState When the AOD scrim animation was being cancelled, the new state would already be set to UNLOCKED, so the scrim tint/alpha would be wrong during the AOD => UNLOCKED transition. Instead of using the current scrimState, use the scrim state of the cancelled animation. Test: manual Bug: 185374936 Change-Id: Id75ef5739e0a1f89dfdc062a5c6a8e1a33b4a40f --- .../statusbar/phone/ScrimController.java | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java index bbde3c3e31447..dece324a6b4a6 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java @@ -849,7 +849,7 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump setScrimAlpha(mScrimForBubble, mBubbleAlpha); } // The animation could have all already finished, let's call onFinished just in case - onFinished(); + onFinished(mState); dispatchScrimsVisible(); } @@ -916,7 +916,6 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump Trace.traceCounter(Trace.TRACE_TAG_APP, getScrimName(scrimView) + "_tint", Color.alpha(tint)); - scrimView.setTint(tint); scrimView.setViewAlpha(alpha); } else { @@ -947,12 +946,13 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump anim.setStartDelay(mAnimationDelay); anim.setDuration(mAnimationDuration); anim.addListener(new AnimatorListenerAdapter() { - private Callback lastCallback = mCallback; + private final ScrimState mLastState = mState; + private final Callback mLastCallback = mCallback; @Override public void onAnimationEnd(Animator animation) { scrim.setTag(TAG_KEY_ANIM, null); - onFinished(lastCallback); + onFinished(mLastCallback, mLastState); dispatchScrimsVisible(); } @@ -1006,11 +1006,14 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump return true; } - private void onFinished() { - onFinished(mCallback); + /** + * @param state that finished + */ + private void onFinished(ScrimState state) { + onFinished(mCallback, state); } - private void onFinished(Callback callback) { + private void onFinished(Callback callback, ScrimState state) { if (mPendingFrameCallback != null) { // No animations can finish while we're waiting on the blanking to finish return; @@ -1042,7 +1045,7 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump // When unlocking with fingerprint, we'll fade the scrims from black to transparent. // At the end of the animation we need to remove the tint. - if (mState == ScrimState.UNLOCKED) { + if (state == ScrimState.UNLOCKED) { mInFrontTint = Color.TRANSPARENT; mBehindTint = mState.getBehindTint(); mNotificationsTint = mState.getNotifTint();