From 53c4d3d23e70496c377139ffa9397aae463d2a5e Mon Sep 17 00:00:00 2001 From: Selim Cinek Date: Mon, 23 May 2016 10:56:34 -0700 Subject: [PATCH] Fixed a crash with the autocancelling Change-Id: If9cb9cc89bafbc9e7e053b4758382239bac97adc Fixes: 28878632 Fixes: 28898623 --- .../statusbar/phone/NotificationGroupManager.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationGroupManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationGroupManager.java index 7a9b2645374b5..70f7c2ccf3df0 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationGroupManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationGroupManager.java @@ -215,17 +215,23 @@ public class NotificationGroupManager implements HeadsUpManager.OnHeadsUpChanged public boolean isOnlyChildInSuppressedGroup(StatusBarNotification sbn) { return isGroupSuppressed(sbn.getGroupKey()) - && isOnlyChildInGroup(sbn); + && isOnlyChild(sbn); } - public boolean isOnlyChildInGroup(StatusBarNotification sbn) { + private boolean isOnlyChild(StatusBarNotification sbn) { return !sbn.getNotification().isGroupSummary() && getTotalNumberOfChildren(sbn) == 1; } + public boolean isOnlyChildInGroup(StatusBarNotification sbn) { + return isOnlyChild(sbn) && getLogicalGroupSummary(sbn) != null; + } + private int getTotalNumberOfChildren(StatusBarNotification sbn) { - return getNumberOfIsolatedChildren(sbn.getGroupKey()) - + mGroupMap.get(sbn.getGroupKey()).children.size(); + int isolatedChildren = getNumberOfIsolatedChildren(sbn.getGroupKey()); + NotificationGroup group = mGroupMap.get(sbn.getGroupKey()); + int realChildren = group != null ? group.children.size() : 0; + return isolatedChildren + realChildren; } private boolean isGroupSuppressed(String groupKey) {