diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java index e1d4c8aea83c1..f09eae84df9ec 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java @@ -185,6 +185,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView { } }; private OnClickListener mOnClickListener; + private boolean mHeadsupDisappearRunning; private View mChildAfterViewWhenDismissed; private View mGroupParentWhenDismissed; private boolean mRefocusOnDismiss; @@ -759,15 +760,17 @@ public class ExpandableNotificationRow extends ActivatableNotificationView { mRemoved = true; mPrivateLayout.setRemoved(); - if (mChildrenContainer != null) { - mChildrenContainer.setRemoved(); - } } public NotificationChildrenContainer getChildrenContainer() { return mChildrenContainer; } + public void setHeadsupDisappearRunning(boolean running) { + mHeadsupDisappearRunning = running; + mPrivateLayout.setHeadsupDisappearRunning(running); + } + public View getChildAfterViewWhenDismissed() { return mChildAfterViewWhenDismissed; } @@ -1173,8 +1176,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); @@ -1300,6 +1303,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); 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/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) { 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; 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 71ef1eacfa6c1..7de38797adccd 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java @@ -3689,6 +3689,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);