From ea66ca02251e35c719822639cb2baf9ab4ba76e4 Mon Sep 17 00:00:00 2001 From: Selim Cinek Date: Tue, 24 May 2016 13:33:47 -0700 Subject: [PATCH] Fixed a few battery issues in SystemUI Fixed a bug where animators could run forever because of a negative start delay. Also fixed a bug where the shadow would continuously update when it shouldn't. Change-Id: Id115d179d99fecf72c5f2b3be1a4c8590361469e Fixes: 28930837 --- .../statusbar/stack/NotificationStackScrollLayout.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java index 439a6308a761e..5a593d4004aca 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java @@ -2494,9 +2494,9 @@ public class NotificationStackScrollLayout extends ViewGroup mNeedsAnimation = false; } if (!mAnimationEvents.isEmpty() || isCurrentlyAnimating()) { + setAnimationRunning(true); mStateAnimator.startAnimationForEvents(mAnimationEvents, mCurrentStackScrollState, mGoToFullShadeDelay); - setAnimationRunning(true); mAnimationEvents.clear(); updateBackground(); updateViewShadows(); @@ -3124,6 +3124,7 @@ public class NotificationStackScrollLayout extends ViewGroup mListener.onChildLocationsChanged(this); } runAnimationFinishedRunnables(); + setAnimationRunning(false); updateBackground(); updateViewShadows(); } @@ -3239,6 +3240,7 @@ public class NotificationStackScrollLayout extends ViewGroup maxLength = Math.max(mDarkAnimationOriginIndex, getNotGoneChildCount() - mDarkAnimationOriginIndex - 1); } + maxLength = Math.max(0, maxLength); long delay = maxLength * StackStateAnimator.ANIMATION_DELAY_PER_ELEMENT_DARK; fadeAnimator.setStartDelay(delay); fadeAnimator.setDuration(StackStateAnimator.ANIMATION_DURATION_STANDARD);