From b26afa3e941dd000a2c5befa0481e9244f152b6e Mon Sep 17 00:00:00 2001 From: Selim Cinek Date: Thu, 29 Jun 2017 10:28:17 +0200 Subject: [PATCH] Be more lenient when processing group headers We are now only looking at the contracted header instead of all sorts of headers and if the current header is null, we don't look any further but consider it to be equal. Bug: 62378776 Test: add notification groups with multiple headers, observe correct icon / text behavior Change-Id: I0b83b91caaace30df3bdcba7225e93bd0e195484 --- .../statusbar/ExpandableNotificationRow.java | 13 +++++++++++++ .../systemui/statusbar/NotificationContentView.java | 8 ++++++++ .../systemui/statusbar/NotificationHeaderUtil.java | 5 +++-- 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java index 6abf35ffc713f..ed4f6855c515d 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java @@ -756,6 +756,19 @@ public class ExpandableNotificationRow extends ActivatableNotificationView return getShowingLayout().getVisibleNotificationHeader(); } + + /** + * @return the contracted notification header. This can be different from + * {@link #getNotificationHeader()} and also {@link #getVisibleNotificationHeader()} and only + * returns the contracted version. + */ + public NotificationHeaderView getContractedNotificationHeader() { + if (mIsSummaryWithChildren) { + return mChildrenContainer.getHeaderView(); + } + return mPrivateLayout.getContractedNotificationHeader(); + } + public void setOnExpandClickListener(OnExpandClickListener onExpandClickListener) { mOnExpandClickListener = onExpandClickListener; } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java index 75704b1612d77..9e059c89ffe18 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java @@ -1308,6 +1308,14 @@ public class NotificationContentView extends FrameLayout { return header; } + + public NotificationHeaderView getContractedNotificationHeader() { + if (mContractedChild != null) { + return mContractedWrapper.getNotificationHeader(); + } + return null; + } + public NotificationHeaderView getVisibleNotificationHeader() { NotificationViewWrapper wrapper = getVisibleWrapper(mVisibleType); return wrapper == null ? null : wrapper.getNotificationHeader(); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationHeaderUtil.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationHeaderUtil.java index 7f95d48f36d46..43018174de442 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationHeaderUtil.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationHeaderUtil.java @@ -267,9 +267,10 @@ public class NotificationHeaderUtil { if (!mApply) { return; } - NotificationHeaderView header = row.getNotificationHeader(); + NotificationHeaderView header = row.getContractedNotificationHeader(); if (header == null) { - mApply = false; + // No header found. We still consider this to be the same to avoid weird flickering + // when for example showing an undo notification return; } Object childData = mExtractor == null ? null : mExtractor.extractData(row);