Fixed pulsing notifications and flickers with the scrim

When the scrim required blanking, the behavior wasn't working
as expected anymore since we would now call onFinished immediately
instead of when the animation has actually finished. Additionally
was the onDisplayBlanked() then dropped since we already finished
before.

Fixes: 143185828
Fixes: 143195895
Test: atest SystemUITests
Change-Id: Iccc303065b4cf4ff2601b10b528b82b9a90a8d3e
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 35039a0..f21a9a2 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java
@@ -750,6 +750,11 @@
     }
 
     private void onFinished(Callback callback) {
+        if (mPendingFrameCallback != null) {
+            // No animations can finish while we're waiting on the blanking to finish
+            return;
+
+        }
         if (isAnimating(mScrimBehind)
             || isAnimating(mScrimInFront)
             || isAnimating(mScrimForBubble)) {