diff options
| author | 2019-09-30 13:34:27 -0700 | |
|---|---|---|
| committer | 2019-09-30 13:34:27 -0700 | |
| commit | 258f5267804db2f00d2de5e33d1d7f64ab7e942b (patch) | |
| tree | e6eef020328d45f3b64f6e96509497132abf3b87 | |
| parent | 4092468b679b5a9b24bc2e8af99748fc4530dbdf (diff) | |
| parent | 29b8d32f0d14edb642e1570c35648e337bc5a28d (diff) | |
Merge "Only calling finishedwhen all the animations have finished" into qt-qpr1-dev
am: 29b8d32f0d
Change-Id: I1bce705678d5f6669aebf8f415fea0fecf4322e4
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java | 18 | ||||
| -rw-r--r-- | packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ScrimControllerTest.java | 1 |
2 files changed, 19 insertions, 0 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 45f3b32d8155..fd3c9526149d 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java @@ -754,6 +754,16 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, OnCo } private void onFinished(Callback callback) { + if (!hasReachedFinalState(mScrimBehind) + || !hasReachedFinalState(mScrimInFront) + || !hasReachedFinalState(mScrimForBubble)) { + if (callback != null && callback != mCallback) { + // Since we only notify the callback that we're finished once everything has + // finished, we need to make sure that any changing callbacks are also invoked + callback.onFinished(); + } + return; + } if (mWakeLockHeld) { mWakeLock.release(TAG); mWakeLockHeld = false; @@ -773,9 +783,17 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, OnCo mInFrontTint = Color.TRANSPARENT; mBehindTint = Color.TRANSPARENT; mBubbleTint = Color.TRANSPARENT; + updateScrimColor(mScrimInFront, mInFrontAlpha, mInFrontTint); + updateScrimColor(mScrimBehind, mBehindAlpha, mBehindTint); + updateScrimColor(mScrimForBubble, mBubbleAlpha, mBubbleTint); } } + private boolean hasReachedFinalState(ScrimView scrim) { + return scrim.getViewAlpha() == getCurrentScrimAlpha(scrim) + && scrim.getTint() == getCurrentScrimTint(scrim); + } + private boolean isAnimating(View scrim) { return scrim.getTag(TAG_KEY_ANIM) != null; } diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ScrimControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ScrimControllerTest.java index e05ad09deebf..d4ad4b6d4f16 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ScrimControllerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ScrimControllerTest.java @@ -431,6 +431,7 @@ public class ScrimControllerTest extends SysuiTestCase { TRANSPARENT /* behind */, TRANSPARENT /* bubble */); + // Make sure at the very end of the animation, we're reset to transparent assertScrimTint(false /* front */, false /* behind */, false /* bubble */); |