Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit eca834dd authored by Selim Cinek's avatar Selim Cinek Committed by android-build-merger
Browse files

Merge "Fixed a crash with the autocancelling" into nyc-dev am: 4a4b76f6

am: 45df2229

* commit '45df2229':
  Fixed a crash with the autocancelling

Change-Id: Ia1d1f6fac5e056878037b706122d99a491f5b5c1
parents a11bd4cd 45df2229
Loading
Loading
Loading
Loading
+10 −4
Original line number Diff line number Diff line
@@ -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) {