summaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorSelim Cinek <cinek@google.com>2015-06-25 11:04:20 -0400
committerSelim Cinek <cinek@google.com>2015-06-25 11:05:52 -0400
commiteaee9c01902ecfc253be98d68e5d7b586ed54463 (patch)
tree73fb20a99e6db0a6e8497e049f997e1c8cf6938c /packages
parent245273ec8dd33f10f2682f140057ea0e5b270ef8 (diff)
downloadframeworks_base-eaee9c01902ecfc253be98d68e5d7b586ed54463.zip
frameworks_base-eaee9c01902ecfc253be98d68e5d7b586ed54463.tar.gz
frameworks_base-eaee9c01902ecfc253be98d68e5d7b586ed54463.tar.bz2
Fixed a HUN crash with notification children
Notification children were not properly handled before when added lead to a crash. This will fix this bug finally. Bug: 21868047 Change-Id: I92f2f7e71659de8274711a448e370084d423ca9f
Diffstat (limited to 'packages')
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java27
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/stack/StackStateAnimator.java7
2 files changed, 20 insertions, 14 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 5700732..f98840b 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java
@@ -1898,15 +1898,23 @@ public class NotificationStackScrollLayout extends ViewGroup
boolean pinnedAndClosed = row.isPinned() && !mIsExpanded;
if (!mIsExpanded && !isHeadsUp) {
type = AnimationEvent.ANIMATION_TYPE_HEADS_UP_DISAPPEAR;
- } else if (isHeadsUp && (mAddedHeadsUpChildren.contains(row) || pinnedAndClosed)) {
- if (pinnedAndClosed || shouldHunAppearFromBottom(row)) {
- // Our custom add animation
- type = AnimationEvent.ANIMATION_TYPE_HEADS_UP_APPEAR;
- } else {
- // Normal add animation
- type = AnimationEvent.ANIMATION_TYPE_ADD;
+ } else {
+ StackViewState viewState = mCurrentStackScrollState.getViewStateForView(row);
+ if (viewState == null) {
+ // A view state was never generated for this view, so we don't need to animate
+ // this. This may happen with notification children.
+ continue;
+ }
+ if (isHeadsUp && (mAddedHeadsUpChildren.contains(row) || pinnedAndClosed)) {
+ if (pinnedAndClosed || shouldHunAppearFromBottom(viewState)) {
+ // Our custom add animation
+ type = AnimationEvent.ANIMATION_TYPE_HEADS_UP_APPEAR;
+ } else {
+ // Normal add animation
+ type = AnimationEvent.ANIMATION_TYPE_ADD;
+ }
+ onBottom = !pinnedAndClosed;
}
- onBottom = !pinnedAndClosed;
}
AnimationEvent event = new AnimationEvent(row, type);
event.headsUpFromBottom = onBottom;
@@ -1916,8 +1924,7 @@ public class NotificationStackScrollLayout extends ViewGroup
mAddedHeadsUpChildren.clear();
}
- private boolean shouldHunAppearFromBottom(ExpandableNotificationRow row) {
- StackViewState viewState = mCurrentStackScrollState.getViewStateForView(row);
+ private boolean shouldHunAppearFromBottom(StackViewState viewState) {
if (viewState.yTranslation + viewState.height < mAmbientState.getMaxHeadsUpTranslation()) {
return false;
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackStateAnimator.java b/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackStateAnimator.java
index 17e6e3d..5b8fe89 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackStateAnimator.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackStateAnimator.java
@@ -893,13 +893,12 @@ public class StackStateAnimator {
if (mHostLayout.indexOfChild(changingView) == -1) {
// This notification was actually removed, so we need to add it to the overlay
mHostLayout.getOverlay().add(changingView);
- ViewState viewState = new ViewState();
- viewState.initFrom(changingView);
- viewState.yTranslation = -changingView.getActualHeight();
+ mTmpState.initFrom(changingView);
+ mTmpState.yTranslation = -changingView.getActualHeight();
// We temporarily enable Y animations, the real filter will be combined
// afterwards anyway
mAnimationFilter.animateY = true;
- startViewAnimations(changingView, viewState, 0,
+ startViewAnimations(changingView, mTmpState, 0,
ANIMATION_DURATION_HEADS_UP_DISAPPEAR);
mChildrenToClearFromOverlay.add(changingView);
}