From 684c8817f43c873d92b480118c502c4abb34b546 Mon Sep 17 00:00:00 2001 From: Julia Reynolds Date: Tue, 5 May 2020 11:00:48 -0400 Subject: [PATCH] Change longpress behavior for summaries Rather than showing notification guts, expand or collapse the summary. Test: long pressing on notifications, expanded summaries, collapsed summaries, notifications in groups Fixes: 155498734 Change-Id: I68438ff6e02e213386a257b8ca0d74552ed118ed --- .../notification/row/ExpandableNotificationRow.java | 5 +++++ .../row/ExpandableNotificationRowController.java | 8 +++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java index 2e5af9a7414a4..f7ad50edb2f69 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java @@ -2366,6 +2366,11 @@ public class ExpandableNotificationRow extends ActivatableNotificationView updateChildrenVisibility(); applyChildrenRoundness(); } + + protected void expandNotification() { + mExpandClickListener.onClick(this); + } + /** * Returns the number of channels covered by the notification row (including its children if * it's a summary notification). diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRowController.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRowController.java index f8d9c4648ac9e..7a6109d2ce780 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRowController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRowController.java @@ -130,7 +130,13 @@ public class ExpandableNotificationRowController { mView.setOnDismissRunnable(mOnDismissRunnable); mView.setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS); if (mAllowLongPress) { - mView.setLongPressListener(mNotificationGutsManager::openGuts); + mView.setLongPressListener((v, x, y, item) -> { + if (mView.isSummaryWithChildren()) { + mView.expandNotification(); + return true; + } + return mNotificationGutsManager.openGuts(v, x, y, item); + }); } if (ENABLE_REMOTE_INPUT) { mView.setDescendantFocusability(ViewGroup.FOCUS_BEFORE_DESCENDANTS);