From bc34215021c536e596515fa5da7d0d23af5282bd Mon Sep 17 00:00:00 2001 From: Selim Cinek Date: Wed, 5 Dec 2018 18:45:42 -0800 Subject: [PATCH] Clicks on the notification group header now collapse Previously clicks would open the app and have a very weird transition. We're now collapsing the notification instead and never allowing expanded groups to be launched Change-Id: I4ba4e5f695a8b210dd76a38db2783484b90a4f33 Fixes: 110093221 Test: add group, click on header after expanded, observe collapsing --- .../statusbar/notification/NotificationEntryManager.java | 4 ++++ .../notification/stack/NotificationChildrenContainer.java | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationEntryManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationEntryManager.java index 1616b6dc53de6..645024d0688ba 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationEntryManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationEntryManager.java @@ -182,6 +182,10 @@ public class NotificationEntryManager implements Dumpable, NotificationInflater. } else if (row.isChildInGroup() && isMenuVisible(row.getNotificationParent())) { row.getNotificationParent().animateTranslateNotification(0); return; + } else if (row.isSummaryWithChildren() && row.areChildrenExpanded()) { + // We never want to open the app directly if the user clicks in between + // the notifications. + return; } // Mark notification for one frame. diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationChildrenContainer.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationChildrenContainer.java index 0f38bd9804a9c..51180361806bd 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationChildrenContainer.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationChildrenContainer.java @@ -875,6 +875,7 @@ public class NotificationChildrenContainer extends ViewGroup { ExpandableNotificationRow child = mChildren.get(childIdx); child.setChildrenExpanded(childrenExpanded, false); } + updateHeaderTouchability(); } public void setContainingNotification(ExpandableNotificationRow parent) { @@ -1215,6 +1216,13 @@ public class NotificationChildrenContainer extends ViewGroup { ExpandableNotificationRow child = mChildren.get(i); child.setUserLocked(userLocked && !showingAsLowPriority()); } + updateHeaderTouchability(); + } + + private void updateHeaderTouchability() { + if (mNotificationHeader != null) { + mNotificationHeader.setAcceptAllTouches(mChildrenExpanded || mUserLocked); + } } public void onNotificationUpdated() {