diff --git a/packages/SystemUI/plugin/src/com/android/systemui/plugins/statusbar/NotificationMenuRowProvider.java b/packages/SystemUI/plugin/src/com/android/systemui/plugins/statusbar/NotificationMenuRowProvider.java index bc98c8ec388f8..529c42154098e 100644 --- a/packages/SystemUI/plugin/src/com/android/systemui/plugins/statusbar/NotificationMenuRowProvider.java +++ b/packages/SystemUI/plugin/src/com/android/systemui/plugins/statusbar/NotificationMenuRowProvider.java @@ -43,6 +43,8 @@ public interface NotificationMenuRowProvider extends Plugin { public View getContentView(); public boolean handleCloseControls(boolean save); + + public boolean willBeRemoved(); } public interface SnoozeGutsContent extends GutsContent { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java index cb4306f0d1372..bfe4bb266684c 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java @@ -902,6 +902,9 @@ public class ExpandableNotificationRow extends ActivatableNotificationView { * @return whether the notification is currently showing a view with an icon. */ public boolean isShowingIcon() { + if (areGutsExposed()) { + return false; + } if (mIsSummaryWithChildren) { return true; } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationGuts.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationGuts.java index b36cfdca1a469..fd1317e614367 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationGuts.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationGuts.java @@ -244,6 +244,10 @@ public class NotificationGuts extends FrameLayout } } + public boolean willBeRemoved() { + return mGutsContent != null ? mGutsContent.willBeRemoved() : false; + } + public boolean isExposed() { return mExposed; } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationInfo.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationInfo.java index 5d13e61327ae8..970323523904b 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationInfo.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationInfo.java @@ -273,6 +273,11 @@ public class NotificationInfo extends LinearLayout implements GutsContent { mGutsInteractionListener = listener; } + @Override + public boolean willBeRemoved() { + return !mChannelEnabledSwitch.isChecked(); + } + @Override public View getContentView() { return this; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShelf.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShelf.java index d4ed1dca57812..1cd909eaf4beb 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShelf.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShelf.java @@ -380,11 +380,12 @@ public class NotificationShelf extends ActivatableNotificationView { : 0.0f; row.setContentTransformationAmount(contentTransformationAmount, isLastChild); setIconTransformationAmount(row, transitionAmount, iconTransformDistance, - clampedAmount != transitionAmount); + clampedAmount != transitionAmount, isLastChild); } private void setIconTransformationAmount(ExpandableNotificationRow row, - float transitionAmount, float iconTransformDistance, boolean usingLinearInterpolation) { + float transitionAmount, float iconTransformDistance, boolean usingLinearInterpolation, + boolean isLastChild) { StatusBarIconView icon = row.getEntry().expandedIcon; NotificationIconContainer.IconState iconState = getIconState(icon); @@ -437,7 +438,7 @@ public class NotificationShelf extends ActivatableNotificationView { iconState.scaleY = 1.0f; iconState.hidden = false; } - if (row.isAboveShelf()) { + if (row.isAboveShelf() || (!row.isInShelf() && isLastChild && row.areGutsExposed())) { iconState.hidden = true; } int shelfColor = icon.getStaticDrawableColor(); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationSnooze.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationSnooze.java index 0657dc1e86f73..6b1e62d9ad713 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationSnooze.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationSnooze.java @@ -56,6 +56,7 @@ public class NotificationSnooze extends LinearLayout private TextView mUndoButton; private ViewGroup mSnoozeOptionView; private List mSnoozeOptions; + private boolean mSnoozing; private SnoozeOption mSelectedOption; @@ -174,6 +175,11 @@ public class NotificationSnooze extends LinearLayout mGutsInteractionListener.closeGuts(this); } + @Override + public boolean willBeRemoved() { + return mSnoozing; + } + @Override public View getContentView() { return this; @@ -199,6 +205,7 @@ public class NotificationSnooze extends LinearLayout // When snooze is closed (i.e. there was interaction outside of the notification) // then we commit the snooze action. if (mSnoozeListener != null && mSelectedOption != null) { + mSnoozing = true; mSnoozeListener.snoozeNotification(mSbn, mSelectedOption); return true; } else { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java index 3d6e4b3cd3b58..dd0474165bd5c 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java @@ -5760,7 +5760,7 @@ public class StatusBar extends SystemUI implements DemoMode, row.setTag(sbn.getPackageName()); final NotificationGuts guts = row.getGuts(); guts.setClosedListener((NotificationGuts g) -> { - if (!row.isRemoved()) { + if (!g.willBeRemoved() && !row.isRemoved()) { mStackScroller.onHeightChanged(row, !isPanelFullyCollapsed() /* needsAnimation */); } mNotificationGutsExposed = null;