OSDN Git Service

Fixed a grey flash when swiping away the last notification
authorSelim Cinek <cinek@google.com>
Wed, 19 Oct 2016 23:49:44 +0000 (16:49 -0700)
committerSelim Cinek <cinek@google.com>
Thu, 20 Oct 2016 00:07:26 +0000 (00:07 +0000)
Change-Id: I12edf673f29abad66fa6704004886124eee9978b
Fixes: 32289359
Test: have 1 notification, swipe it a way, observe no flashing in statusbar

packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java

index f3e5c94..a6fe438 100644 (file)
@@ -1853,24 +1853,34 @@ public class NotificationStackScrollLayout extends ViewGroup
         }
         updateBackgroundBounds();
         if (!mCurrentBounds.equals(mBackgroundBounds)) {
-            if (mAnimateNextBackgroundTop || mAnimateNextBackgroundBottom || areBoundsAnimating()) {
+            boolean animate = mAnimateNextBackgroundTop || mAnimateNextBackgroundBottom
+                    || areBoundsAnimating();
+            if (!isExpanded()) {
+                abortBackgroundAnimators();
+                animate = false;
+            }
+            if (animate) {
                 startBackgroundAnimation();
             } else {
                 mCurrentBounds.set(mBackgroundBounds);
                 applyCurrentBackgroundBounds();
             }
         } else {
-            if (mBottomAnimator != null) {
-                mBottomAnimator.cancel();
-            }
-            if (mTopAnimator != null) {
-                mTopAnimator.cancel();
-            }
+            abortBackgroundAnimators();
         }
         mAnimateNextBackgroundBottom = false;
         mAnimateNextBackgroundTop = false;
     }
 
+    private void abortBackgroundAnimators() {
+        if (mBottomAnimator != null) {
+            mBottomAnimator.cancel();
+        }
+        if (mTopAnimator != null) {
+            mTopAnimator.cancel();
+        }
+    }
+
     private boolean areBoundsAnimating() {
         return mBottomAnimator != null || mTopAnimator != null;
     }