diff options
author | Selim Cinek <cinek@google.com> | 2015-06-17 11:17:08 -0700 |
---|---|---|
committer | Selim Cinek <cinek@google.com> | 2015-06-18 03:17:30 -0700 |
commit | e0890e5cdc4115834e36cd6b93f8c8b498e0e901 (patch) | |
tree | d87da2f0635e414742c4e6b4daabbf0ecbe32709 /packages | |
parent | 9cb6a493f4e8bd9914f2841355b3293f90773802 (diff) | |
download | frameworks_base-e0890e5cdc4115834e36cd6b93f8c8b498e0e901.zip frameworks_base-e0890e5cdc4115834e36cd6b93f8c8b498e0e901.tar.gz frameworks_base-e0890e5cdc4115834e36cd6b93f8c8b498e0e901.tar.bz2 |
Fixed another crash with HUNs
This time for real :)
Bug: 21868047
Change-Id: I0572dce7d7e5abdf806198b194ad2516a021ab0d
Diffstat (limited to 'packages')
-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 1bf4547..24ac507 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; } /** |