From eb3fc3d5407d6a15343133912fa74d86d322bac0 Mon Sep 17 00:00:00 2001 From: Selim Cinek Date: Fri, 15 Sep 2017 13:37:14 -0700 Subject: [PATCH] Fixes an issue where the guts could disappear Because it was too big to fit on the screen, a notification could be dropped. Change-Id: I73e57ef18ac55ca076e6b76408d9bd9d91a78b9d Fixes: 64735432 Test: manual, longpress last notification, trigger layout. --- .../statusbar/ExpandableNotificationRow.java | 9 +++++---- .../android/systemui/statusbar/ExpandableView.java | 14 +++++++++++++- .../statusbar/phone/NotificationPanelView.java | 3 ++- 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java index 7bc1a39dfff5f..38b7ac13da9c6 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java @@ -1989,14 +1989,15 @@ public class ExpandableNotificationRow extends ActivatableNotificationView } @Override - public int getMinHeight() { - if (mGuts != null && mGuts.isExposed()) { + public int getMinHeight(boolean ignoreTemporaryStates) { + if (!ignoreTemporaryStates && mGuts != null && mGuts.isExposed()) { return mGuts.getIntrinsicHeight(); - } else if (isHeadsUpAllowed() && mIsHeadsUp && mHeadsUpManager.isTrackingHeadsUp()) { + } else if (!ignoreTemporaryStates && isHeadsUpAllowed() && mIsHeadsUp + && mHeadsUpManager.isTrackingHeadsUp()) { return getPinnedHeadsUpHeight(false /* atLeastMinHeight */); } else if (mIsSummaryWithChildren && !isGroupExpanded() && !mShowingPublic) { return mChildrenContainer.getMinHeight(); - } else if (isHeadsUpAllowed() && mIsHeadsUp) { + } else if (!ignoreTemporaryStates && isHeadsUpAllowed() && mIsHeadsUp) { return mHeadsUpHeight; } NotificationContentView showingLayout = getShowingLayout(); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableView.java b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableView.java index efe5e0c2ade48..aac9af8a0234e 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableView.java @@ -151,9 +151,21 @@ public abstract class ExpandableView extends FrameLayout { } /** - * @return The minimum content height of this notification. + * @return The minimum content height of this notification. This also respects the temporary + * states of the view. */ public int getMinHeight() { + return getMinHeight(false /* ignoreTemporaryStates */); + } + + /** + * Get the minimum height of this view. + * + * @param ignoreTemporaryStates should temporary states be ignored like the guts or heads-up. + * + * @return The minimum height that this view needs. + */ + public int getMinHeight(boolean ignoreTemporaryStates) { return getHeight(); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java index 078e8189f5b32..c19161839998e 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java @@ -509,7 +509,8 @@ public class NotificationPanelView extends PanelView implements if (row.isRemoved()) { continue; } - availableSpace -= child.getMinHeight() + notificationPadding; + availableSpace -= child.getMinHeight(true /* ignoreTemporaryStates */) + + notificationPadding; if (availableSpace >= 0 && count < maximum) { count++; } else if (availableSpace > -shelfSize) {