diff options
author | Selim Cinek <cinek@google.com> | 2015-06-18 18:41:39 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-06-18 18:41:41 +0000 |
commit | 4c2e9ab911855e9dabfcbb0478f167c734a6dacf (patch) | |
tree | db019fba1ab7bc409c8077e07dfb2e85421dcc65 | |
parent | 49e11f805dcf5c8611e4bfbb115e56a22db4a396 (diff) | |
parent | e0890e5cdc4115834e36cd6b93f8c8b498e0e901 (diff) | |
download | frameworks_base-4c2e9ab911855e9dabfcbb0478f167c734a6dacf.zip frameworks_base-4c2e9ab911855e9dabfcbb0478f167c734a6dacf.tar.gz frameworks_base-4c2e9ab911855e9dabfcbb0478f167c734a6dacf.tar.bz2 |
Merge "Fixed another crash with HUNs" into mnc-dev
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java | 24 |
1 files changed, 18 insertions, 6 deletions
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 1bb07a8..5700732 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java @@ -228,6 +228,7 @@ public class NotificationStackScrollLayout extends ViewGroup private ScrimController mScrimController; private boolean mForceNoOverlappingRendering; private NotificationOverflowContainer mOverflowContainer; + private final ArrayList<Pair<ExpandableNotificationRow, Boolean>> mTmpList = new ArrayList<>(); public NotificationStackScrollLayout(Context context) { this(context, null); @@ -1651,8 +1652,7 @@ public class NotificationStackScrollLayout extends ViewGroup * @return Whether an animation was generated. */ private boolean generateRemoveAnimation(View child) { - if (mAddedHeadsUpChildren.contains(child)) { - removeChildFromHeadsUpChangeAnimations(child); + if (removeRemovedChildFromHeadsUpChangeAnimations(child)) { mAddedHeadsUpChildren.remove(child); return false; } @@ -1671,15 +1671,27 @@ public class NotificationStackScrollLayout extends ViewGroup return false; } - private void removeChildFromHeadsUpChangeAnimations(View child) { - ArrayList<Pair<ExpandableNotificationRow, Boolean> > toRemove = new ArrayList<>(); + /** + * Remove a removed child view from the heads up animations if it was just added there + * + * @return whether any child was removed from the list to animate + */ + private boolean removeRemovedChildFromHeadsUpChangeAnimations(View child) { + boolean hasAddEvent = false; for (Pair<ExpandableNotificationRow, Boolean> eventPair : mHeadsUpChangeAnimations) { ExpandableNotificationRow row = eventPair.first; + boolean isHeadsUp = eventPair.second; if (child == row) { - toRemove.add(eventPair); + mTmpList.add(eventPair); + hasAddEvent |= isHeadsUp; } } - mHeadsUpChangeAnimations.removeAll(toRemove); + if (hasAddEvent) { + // This child was just added lets remove all events. + mHeadsUpChangeAnimations.removeAll(mTmpList); + } + mTmpList.clear(); + return hasAddEvent; } /** |