From 73cf02a0783e3857cae21fece9c292abcc9e1409 Mon Sep 17 00:00:00 2001 From: Selim Cinek Date: Fri, 17 Jun 2016 13:08:00 -0700 Subject: [PATCH 1/4] Fixed a bug where the expanded layout would flash When the heads up disappeared from the shade, it's layout would switch to the expanded state. We're now delaying this until the animation is done. Change-Id: I6c5c970f6b471fb10b197922dfea520b07c84abc Fixes: 29318819 --- .../systemui/statusbar/ExpandableNotificationRow.java | 10 ++++++++-- .../systemui/statusbar/NotificationContentView.java | 11 +++++++++-- .../stack/NotificationStackScrollLayout.java | 3 +++ .../systemui/statusbar/stack/StackStateAnimator.java | 4 ++++ 4 files changed, 24 insertions(+), 4 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java index 89870815ceb25..39fce7b9243d7 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java @@ -186,6 +186,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView { } }; private OnClickListener mOnClickListener; + private boolean mHeadsupDisappearRunning; private View mChildAfterViewWhenDismissed; private View mGroupParentWhenDismissed; private boolean mRefocusOnDismiss; @@ -769,6 +770,11 @@ public class ExpandableNotificationRow extends ActivatableNotificationView { return mChildrenContainer; } + public void setHeadsupDisappearRunning(boolean running) { + mHeadsupDisappearRunning = running; + mPrivateLayout.setHeadsupDisappearRunning(running); + } + public View getChildAfterViewWhenDismissed() { return mChildAfterViewWhenDismissed; } @@ -1174,8 +1180,8 @@ public class ExpandableNotificationRow extends ActivatableNotificationView { return getMinHeight(); } else if (mIsSummaryWithChildren && !mOnKeyguard) { return mChildrenContainer.getIntrinsicHeight(); - } else if (mIsHeadsUp) { - if (isPinned()) { + } else if (mIsHeadsUp || mHeadsupDisappearRunning) { + if (isPinned() || mHeadsupDisappearRunning) { return getPinnedHeadsUpHeight(true /* atLeastMinHeight */); } else if (isExpanded()) { return Math.max(getMaxExpandHeight(), mHeadsUpHeight); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java index 30ac9cad346f8..9fd09d92162cb 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java @@ -119,6 +119,7 @@ public class NotificationContentView extends FrameLayout { private int mContentHeightAtAnimationStart = UNDEFINED; private boolean mFocusOnVisibilityChange; + private boolean mHeadsupDisappearRunning; public NotificationContentView(Context context, AttributeSet attrs) { @@ -446,7 +447,8 @@ public class NotificationContentView extends FrameLayout { boolean transitioningBetweenHunAndExpanded = isTransitioningFromTo(VISIBLE_TYPE_HEADSUP, VISIBLE_TYPE_EXPANDED) || isTransitioningFromTo(VISIBLE_TYPE_EXPANDED, VISIBLE_TYPE_HEADSUP); - boolean pinned = !isVisibleOrTransitioning(VISIBLE_TYPE_CONTRACTED) && mIsHeadsUp; + boolean pinned = !isVisibleOrTransitioning(VISIBLE_TYPE_CONTRACTED) + && (mIsHeadsUp || mHeadsupDisappearRunning); if (transitioningBetweenHunAndExpanded || pinned) { return Math.min(mHeadsUpChild.getHeight(), mExpandedChild.getHeight()); } @@ -830,7 +832,7 @@ public class NotificationContentView extends FrameLayout { return VISIBLE_TYPE_SINGLELINE; } - if (mIsHeadsUp && mHeadsUpChild != null) { + if ((mIsHeadsUp || mHeadsupDisappearRunning) && mHeadsUpChild != null) { if (viewHeight <= mHeadsUpChild.getHeight() || noExpandedChild) { return VISIBLE_TYPE_HEADSUP; } else { @@ -1153,6 +1155,11 @@ public class NotificationContentView extends FrameLayout { } } + public void setHeadsupDisappearRunning(boolean headsupDisappearRunning) { + mHeadsupDisappearRunning = headsupDisappearRunning; + selectLayout(false /* animate */, true /* force */); + } + public void setFocusOnVisibilityChange() { mFocusOnVisibilityChange = true; } 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 43f847c23f813..abf33d03fcde7 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java @@ -3690,6 +3690,9 @@ public class NotificationStackScrollLayout extends ViewGroup if (mAnimationsEnabled) { mHeadsUpChangeAnimations.add(new Pair<>(row, isHeadsUp)); mNeedsAnimation = true; + if (!mIsExpanded && !isHeadsUp) { + row.setHeadsupDisappearRunning(true); + } requestChildrenUpdate(); } } 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 7ac0d803e24e0..5bebbcadb3a32 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackStateAnimator.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackStateAnimator.java @@ -733,6 +733,7 @@ public class StackStateAnimator { animator.setStartDelay(delay); } animator.addListener(getGlobalAnimationFinishedListener()); + final boolean isHeadsUpDisappear = mHeadsUpDisappearChildren.contains(child); // remove the tag when the animation is finished animator.addListener(new AnimatorListenerAdapter() { @Override @@ -741,6 +742,9 @@ public class StackStateAnimator { child.setTag(TAG_ANIMATOR_TRANSLATION_Y, null); child.setTag(TAG_START_TRANSLATION_Y, null); child.setTag(TAG_END_TRANSLATION_Y, null); + if (isHeadsUpDisappear) { + ((ExpandableNotificationRow) child).setHeadsupDisappearRunning(false); + } } }); startAnimator(animator); From a554c707386eb8a6c6fb3a2399f23b79a1c17f74 Mon Sep 17 00:00:00 2001 From: Selim Cinek Date: Fri, 17 Jun 2016 18:02:12 -0700 Subject: [PATCH 2/4] Fixed a potential issue where a notification could be empty Change-Id: Ic4b294092a47d30c469dfbd1eb6ab31208533b1c Fixes: 29158425 --- .../android/systemui/statusbar/ExpandableNotificationRow.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java index 39fce7b9243d7..20881402952e3 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java @@ -1307,6 +1307,10 @@ public class ExpandableNotificationRow extends ActivatableNotificationView { if (!animated) { mPublicLayout.animate().cancel(); mPrivateLayout.animate().cancel(); + if (mChildrenContainer != null) { + mChildrenContainer.animate().cancel(); + mChildrenContainer.setAlpha(1f); + } mPublicLayout.setAlpha(1f); mPrivateLayout.setAlpha(1f); mPublicLayout.setVisibility(mShowingPublic ? View.VISIBLE : View.INVISIBLE); From e5ec413c13fbfeb9eafbaa5340aca6ff6c809cc4 Mon Sep 17 00:00:00 2001 From: Selim Cinek Date: Fri, 17 Jun 2016 20:04:16 -0700 Subject: [PATCH 3/4] Fixed a bug where a notification was incorrectly marked as removed When unauto-bundled, it could lead to serious bugs on the lockscreen and the header not being restored. Change-Id: I2d6310a2bcb2f3a60402db5f1e522954f8bd0389 Fixes: 29463339 --- .../systemui/statusbar/ExpandableNotificationRow.java | 3 --- .../statusbar/stack/NotificationChildrenContainer.java | 8 -------- 2 files changed, 11 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java index 20881402952e3..b864a0e9e5347 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java @@ -761,9 +761,6 @@ public class ExpandableNotificationRow extends ActivatableNotificationView { mRemoved = true; mPrivateLayout.setRemoved(); - if (mChildrenContainer != null) { - mChildrenContainer.setRemoved(); - } } public NotificationChildrenContainer getChildrenContainer() { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationChildrenContainer.java b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationChildrenContainer.java index ba191cd1d31ef..3c9373bd46a27 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationChildrenContainer.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationChildrenContainer.java @@ -856,14 +856,6 @@ public class NotificationChildrenContainer extends ViewGroup { mNotificationParent.getNotificationColor()); } - public void setRemoved() { - int childCount = mChildren.size(); - for (int i = 0; i < childCount; i++) { - ExpandableNotificationRow child = mChildren.get(i); - child.setRemoved(); - } - } - public int getPositionInLinearLayout(View childInGroup) { int position = mNotificationHeaderMargin + mNotificatonTopPadding; From 88086e718340fdb869cea40b20ae1d747074bc43 Mon Sep 17 00:00:00 2001 From: Selim Cinek Date: Fri, 17 Jun 2016 21:01:32 -0700 Subject: [PATCH 4/4] Fixed a stackoverflow in notifications Change-Id: I29ce76593af81ad6e326d2e273fd872a4d9d4a89 Fixes: 29464060 --- .../statusbar/phone/NotificationGroupManager.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationGroupManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationGroupManager.java index 9ecff18d2d111..204ab7e3aa805 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationGroupManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationGroupManager.java @@ -213,18 +213,18 @@ public class NotificationGroupManager implements HeadsUpManager.OnHeadsUpChanged return isGroupSuppressed(getGroupKey(sbn)) && sbn.getNotification().isGroupSummary(); } - public boolean isOnlyChildInSuppressedGroup(StatusBarNotification sbn) { - return isGroupSuppressed(sbn.getGroupKey()) - && isOnlyChild(sbn); - } - private boolean isOnlyChild(StatusBarNotification sbn) { return !sbn.getNotification().isGroupSummary() && getTotalNumberOfChildren(sbn) == 1; } public boolean isOnlyChildInGroup(StatusBarNotification sbn) { - return isOnlyChild(sbn) && getLogicalGroupSummary(sbn) != null; + if (!isOnlyChild(sbn)) { + return false; + } + ExpandableNotificationRow logicalGroupSummary = getLogicalGroupSummary(sbn); + return logicalGroupSummary != null + && !logicalGroupSummary.getStatusBarNotification().equals(sbn); } private int getTotalNumberOfChildren(StatusBarNotification sbn) {