• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2015 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License
15  */
16 
17 package com.android.systemui.statusbar.phone;
18 
19 import android.annotation.Nullable;
20 import android.service.notification.StatusBarNotification;
21 import android.util.ArraySet;
22 import android.util.Log;
23 
24 import com.android.systemui.Dependency;
25 import com.android.systemui.plugins.statusbar.StatusBarStateController;
26 import com.android.systemui.plugins.statusbar.StatusBarStateController.StateListener;
27 import com.android.systemui.statusbar.AmbientPulseManager;
28 import com.android.systemui.statusbar.AmbientPulseManager.OnAmbientChangedListener;
29 import com.android.systemui.statusbar.StatusBarState;
30 import com.android.systemui.statusbar.notification.collection.NotificationEntry;
31 import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow;
32 import com.android.systemui.statusbar.policy.HeadsUpManager;
33 import com.android.systemui.statusbar.policy.OnHeadsUpChangedListener;
34 
35 import java.io.FileDescriptor;
36 import java.io.PrintWriter;
37 import java.util.ArrayList;
38 import java.util.HashMap;
39 import java.util.Map;
40 import java.util.Objects;
41 
42 import javax.inject.Inject;
43 import javax.inject.Singleton;
44 
45 /**
46  * A class to handle notifications and their corresponding groups.
47  */
48 @Singleton
49 public class NotificationGroupManager implements OnHeadsUpChangedListener,
50         OnAmbientChangedListener, StateListener {
51 
52     private static final String TAG = "NotificationGroupManager";
53     private final HashMap<String, NotificationGroup> mGroupMap = new HashMap<>();
54     private final ArraySet<OnGroupChangeListener> mListeners = new ArraySet<>();
55     private int mBarState = -1;
56     private HashMap<String, StatusBarNotification> mIsolatedEntries = new HashMap<>();
57     private HeadsUpManager mHeadsUpManager;
58     private AmbientPulseManager mAmbientPulseManager = Dependency.get(AmbientPulseManager.class);
59     private boolean mIsUpdatingUnchangedGroup;
60 
61     @Inject
NotificationGroupManager()62     public NotificationGroupManager() {
63         Dependency.get(StatusBarStateController.class).addCallback(this);
64     }
65 
66     /**
67      * Add a listener for changes to groups.
68      *
69      * @param listener listener to add
70      */
addOnGroupChangeListener(OnGroupChangeListener listener)71     public void addOnGroupChangeListener(OnGroupChangeListener listener) {
72         mListeners.add(listener);
73     }
74 
isGroupExpanded(StatusBarNotification sbn)75     public boolean isGroupExpanded(StatusBarNotification sbn) {
76         NotificationGroup group = mGroupMap.get(getGroupKey(sbn));
77         if (group == null) {
78             return false;
79         }
80         return group.expanded;
81     }
82 
setGroupExpanded(StatusBarNotification sbn, boolean expanded)83     public void setGroupExpanded(StatusBarNotification sbn, boolean expanded) {
84         NotificationGroup group = mGroupMap.get(getGroupKey(sbn));
85         if (group == null) {
86             return;
87         }
88         setGroupExpanded(group, expanded);
89     }
90 
setGroupExpanded(NotificationGroup group, boolean expanded)91     private void setGroupExpanded(NotificationGroup group, boolean expanded) {
92         group.expanded = expanded;
93         if (group.summary != null) {
94             for (OnGroupChangeListener listener : mListeners) {
95                 listener.onGroupExpansionChanged(group.summary.getRow(), expanded);
96             }
97         }
98     }
99 
onEntryRemoved(NotificationEntry removed)100     public void onEntryRemoved(NotificationEntry removed) {
101         onEntryRemovedInternal(removed, removed.notification);
102         mIsolatedEntries.remove(removed.key);
103     }
104 
105     /**
106      * An entry was removed.
107      *
108      * @param removed the removed entry
109      * @param sbn the notification the entry has, which doesn't need to be the same as it's internal
110      *            notification
111      */
onEntryRemovedInternal(NotificationEntry removed, final StatusBarNotification sbn)112     private void onEntryRemovedInternal(NotificationEntry removed,
113             final StatusBarNotification sbn) {
114         String groupKey = getGroupKey(sbn);
115         final NotificationGroup group = mGroupMap.get(groupKey);
116         if (group == null) {
117             // When an app posts 2 different notifications as summary of the same group, then a
118             // cancellation of the first notification removes this group.
119             // This situation is not supported and we will not allow such notifications anymore in
120             // the close future. See b/23676310 for reference.
121             return;
122         }
123         if (isGroupChild(sbn)) {
124             group.children.remove(removed.key);
125         } else {
126             group.summary = null;
127         }
128         updateSuppression(group);
129         if (group.children.isEmpty()) {
130             if (group.summary == null) {
131                 mGroupMap.remove(groupKey);
132                 for (OnGroupChangeListener listener : mListeners) {
133                     listener.onGroupRemoved(group, groupKey);
134                 }
135             }
136         }
137     }
138 
onEntryAdded(final NotificationEntry added)139     public void onEntryAdded(final NotificationEntry added) {
140         if (added.isRowRemoved()) {
141             added.setDebugThrowable(new Throwable());
142         }
143         final StatusBarNotification sbn = added.notification;
144         boolean isGroupChild = isGroupChild(sbn);
145         String groupKey = getGroupKey(sbn);
146         NotificationGroup group = mGroupMap.get(groupKey);
147         if (group == null) {
148             group = new NotificationGroup();
149             mGroupMap.put(groupKey, group);
150             for (OnGroupChangeListener listener : mListeners) {
151                 listener.onGroupCreated(group, groupKey);
152             }
153         }
154         if (isGroupChild) {
155             NotificationEntry existing = group.children.get(added.key);
156             if (existing != null && existing != added) {
157                 Throwable existingThrowable = existing.getDebugThrowable();
158                 Log.wtf(TAG, "Inconsistent entries found with the same key " + added.key
159                         + "existing removed: " + existing.isRowRemoved()
160                         + (existingThrowable != null
161                                 ? Log.getStackTraceString(existingThrowable) + "\n": "")
162                         + " added removed" + added.isRowRemoved()
163                         , new Throwable());
164             }
165             group.children.put(added.key, added);
166             updateSuppression(group);
167         } else {
168             group.summary = added;
169             group.expanded = added.areChildrenExpanded();
170             updateSuppression(group);
171             if (!group.children.isEmpty()) {
172                 ArrayList<NotificationEntry> childrenCopy
173                         = new ArrayList<>(group.children.values());
174                 for (NotificationEntry child : childrenCopy) {
175                     onEntryBecomingChild(child);
176                 }
177                 for (OnGroupChangeListener listener : mListeners) {
178                     listener.onGroupCreatedFromChildren(group);
179                 }
180             }
181         }
182     }
183 
onEntryBecomingChild(NotificationEntry entry)184     private void onEntryBecomingChild(NotificationEntry entry) {
185         if (shouldIsolate(entry)) {
186             isolateNotification(entry);
187         }
188     }
189 
updateSuppression(NotificationGroup group)190     private void updateSuppression(NotificationGroup group) {
191         if (group == null) {
192             return;
193         }
194         boolean prevSuppressed = group.suppressed;
195         group.suppressed = group.summary != null && !group.expanded
196                 && (group.children.size() == 1
197                 || (group.children.size() == 0
198                         && group.summary.notification.getNotification().isGroupSummary()
199                         && hasIsolatedChildren(group)));
200         if (prevSuppressed != group.suppressed) {
201             for (OnGroupChangeListener listener : mListeners) {
202                 if (!mIsUpdatingUnchangedGroup) {
203                     listener.onGroupSuppressionChanged(group, group.suppressed);
204                     listener.onGroupsChanged();
205                 }
206             }
207         }
208     }
209 
hasIsolatedChildren(NotificationGroup group)210     private boolean hasIsolatedChildren(NotificationGroup group) {
211         return getNumberOfIsolatedChildren(group.summary.notification.getGroupKey()) != 0;
212     }
213 
getNumberOfIsolatedChildren(String groupKey)214     private int getNumberOfIsolatedChildren(String groupKey) {
215         int count = 0;
216         for (StatusBarNotification sbn : mIsolatedEntries.values()) {
217             if (sbn.getGroupKey().equals(groupKey) && isIsolated(sbn)) {
218                 count++;
219             }
220         }
221         return count;
222     }
223 
getIsolatedChild(String groupKey)224     private NotificationEntry getIsolatedChild(String groupKey) {
225         for (StatusBarNotification sbn : mIsolatedEntries.values()) {
226             if (sbn.getGroupKey().equals(groupKey) && isIsolated(sbn)) {
227                 return mGroupMap.get(sbn.getKey()).summary;
228             }
229         }
230         return null;
231     }
232 
onEntryUpdated(NotificationEntry entry, StatusBarNotification oldNotification)233     public void onEntryUpdated(NotificationEntry entry,
234             StatusBarNotification oldNotification) {
235         String oldKey = oldNotification.getGroupKey();
236         String newKey = entry.notification.getGroupKey();
237         boolean groupKeysChanged = !oldKey.equals(newKey);
238         boolean wasGroupChild = isGroupChild(oldNotification);
239         boolean isGroupChild = isGroupChild(entry.notification);
240         mIsUpdatingUnchangedGroup = !groupKeysChanged && wasGroupChild == isGroupChild;
241         if (mGroupMap.get(getGroupKey(oldNotification)) != null) {
242             onEntryRemovedInternal(entry, oldNotification);
243         }
244         onEntryAdded(entry);
245         mIsUpdatingUnchangedGroup = false;
246         if (isIsolated(entry.notification)) {
247             mIsolatedEntries.put(entry.key, entry.notification);
248             if (groupKeysChanged) {
249                 updateSuppression(mGroupMap.get(oldKey));
250                 updateSuppression(mGroupMap.get(newKey));
251             }
252         } else if (!wasGroupChild && isGroupChild) {
253             onEntryBecomingChild(entry);
254         }
255     }
256 
isSummaryOfSuppressedGroup(StatusBarNotification sbn)257     public boolean isSummaryOfSuppressedGroup(StatusBarNotification sbn) {
258         return isGroupSuppressed(getGroupKey(sbn)) && sbn.getNotification().isGroupSummary();
259     }
260 
isOnlyChild(StatusBarNotification sbn)261     private boolean isOnlyChild(StatusBarNotification sbn) {
262         return !sbn.getNotification().isGroupSummary()
263                 && getTotalNumberOfChildren(sbn) == 1;
264     }
265 
isOnlyChildInGroup(StatusBarNotification sbn)266     public boolean isOnlyChildInGroup(StatusBarNotification sbn) {
267         if (!isOnlyChild(sbn)) {
268             return false;
269         }
270         NotificationEntry logicalGroupSummary = getLogicalGroupSummary(sbn);
271         return logicalGroupSummary != null
272                 && !logicalGroupSummary.notification.equals(sbn);
273     }
274 
getTotalNumberOfChildren(StatusBarNotification sbn)275     private int getTotalNumberOfChildren(StatusBarNotification sbn) {
276         int isolatedChildren = getNumberOfIsolatedChildren(sbn.getGroupKey());
277         NotificationGroup group = mGroupMap.get(sbn.getGroupKey());
278         int realChildren = group != null ? group.children.size() : 0;
279         return isolatedChildren + realChildren;
280     }
281 
isGroupSuppressed(String groupKey)282     private boolean isGroupSuppressed(String groupKey) {
283         NotificationGroup group = mGroupMap.get(groupKey);
284         return group != null && group.suppressed;
285     }
286 
setStatusBarState(int newState)287     private void setStatusBarState(int newState) {
288         mBarState = newState;
289         if (mBarState == StatusBarState.KEYGUARD) {
290             collapseAllGroups();
291         }
292     }
293 
collapseAllGroups()294     public void collapseAllGroups() {
295         // Because notifications can become isolated when the group becomes suppressed it can
296         // lead to concurrent modifications while looping. We need to make a copy.
297         ArrayList<NotificationGroup> groupCopy = new ArrayList<>(mGroupMap.values());
298         int size = groupCopy.size();
299         for (int i = 0; i < size; i++) {
300             NotificationGroup group =  groupCopy.get(i);
301             if (group.expanded) {
302                 setGroupExpanded(group, false);
303             }
304             updateSuppression(group);
305         }
306     }
307 
308     /**
309      * @return whether a given notification is a child in a group which has a summary
310      */
isChildInGroupWithSummary(StatusBarNotification sbn)311     public boolean isChildInGroupWithSummary(StatusBarNotification sbn) {
312         if (!isGroupChild(sbn)) {
313             return false;
314         }
315         NotificationGroup group = mGroupMap.get(getGroupKey(sbn));
316         if (group == null || group.summary == null || group.suppressed) {
317             return false;
318         }
319         if (group.children.isEmpty()) {
320             // If the suppression of a group changes because the last child was removed, this can
321             // still be called temporarily because the child hasn't been fully removed yet. Let's
322             // make sure we still return false in that case.
323             return false;
324         }
325         return true;
326     }
327 
328     /**
329      * @return whether a given notification is a summary in a group which has children
330      */
isSummaryOfGroup(StatusBarNotification sbn)331     public boolean isSummaryOfGroup(StatusBarNotification sbn) {
332         if (!isGroupSummary(sbn)) {
333             return false;
334         }
335         NotificationGroup group = mGroupMap.get(getGroupKey(sbn));
336         if (group == null || group.summary == null) {
337             return false;
338         }
339         return !group.children.isEmpty() && Objects.equals(group.summary.notification, sbn);
340     }
341 
342     /**
343      * Get the summary of a specified status bar notification. For isolated notification this return
344      * itself.
345      */
getGroupSummary(StatusBarNotification sbn)346     public NotificationEntry getGroupSummary(StatusBarNotification sbn) {
347         return getGroupSummary(getGroupKey(sbn));
348     }
349 
350     /**
351      * Similar to {@link #getGroupSummary(StatusBarNotification)} but doesn't get the visual summary
352      * but the logical summary, i.e when a child is isolated, it still returns the summary as if
353      * it wasn't isolated.
354      */
getLogicalGroupSummary(StatusBarNotification sbn)355     public NotificationEntry getLogicalGroupSummary(StatusBarNotification sbn) {
356         return getGroupSummary(sbn.getGroupKey());
357     }
358 
359     @Nullable
getGroupSummary(String groupKey)360     private NotificationEntry getGroupSummary(String groupKey) {
361         NotificationGroup group = mGroupMap.get(groupKey);
362         //TODO: see if this can become an Entry
363         return group == null ? null
364                 : group.summary == null ? null
365                         : group.summary;
366     }
367 
368     /**
369      * Get the children that are logically in the summary's group, whether or not they are isolated.
370      *
371      * @param summary summary of a group
372      * @return list of the children
373      */
getLogicalChildren(StatusBarNotification summary)374     public ArrayList<NotificationEntry> getLogicalChildren(StatusBarNotification summary) {
375         NotificationGroup group = mGroupMap.get(summary.getGroupKey());
376         if (group == null) {
377             return null;
378         }
379         ArrayList<NotificationEntry> children = new ArrayList<>(group.children.values());
380         NotificationEntry isolatedChild = getIsolatedChild(summary.getGroupKey());
381         if (isolatedChild != null) {
382             children.add(isolatedChild);
383         }
384         return children;
385     }
386 
387     /**
388      * Get the group key. May differ from the one in the notification due to the notification
389      * being temporarily isolated.
390      *
391      * @param sbn notification to check
392      * @return the key of the notification
393      */
getGroupKey(StatusBarNotification sbn)394     public String getGroupKey(StatusBarNotification sbn) {
395         if (isIsolated(sbn)) {
396             return sbn.getKey();
397         }
398         return sbn.getGroupKey();
399     }
400 
401     /** @return group expansion state after toggling. */
toggleGroupExpansion(StatusBarNotification sbn)402     public boolean toggleGroupExpansion(StatusBarNotification sbn) {
403         NotificationGroup group = mGroupMap.get(getGroupKey(sbn));
404         if (group == null) {
405             return false;
406         }
407         setGroupExpanded(group, !group.expanded);
408         return group.expanded;
409     }
410 
isIsolated(StatusBarNotification sbn)411     private boolean isIsolated(StatusBarNotification sbn) {
412         return mIsolatedEntries.containsKey(sbn.getKey());
413     }
414 
415     /**
416      * Whether a notification is visually a group summary.
417      *
418      * @param sbn notification to check
419      * @return true if it is visually a group summary
420      */
isGroupSummary(StatusBarNotification sbn)421     public boolean isGroupSummary(StatusBarNotification sbn) {
422         if (isIsolated(sbn)) {
423             return true;
424         }
425         return sbn.getNotification().isGroupSummary();
426     }
427 
428     /**
429      * Whether a notification is visually a group child.
430      *
431      * @param sbn notification to check
432      * @return true if it is visually a group child
433      */
isGroupChild(StatusBarNotification sbn)434     public boolean isGroupChild(StatusBarNotification sbn) {
435         if (isIsolated(sbn)) {
436             return false;
437         }
438         return sbn.isGroup() && !sbn.getNotification().isGroupSummary();
439     }
440 
441     @Override
onHeadsUpPinnedModeChanged(boolean inPinnedMode)442     public void onHeadsUpPinnedModeChanged(boolean inPinnedMode) {
443     }
444 
445     @Override
onHeadsUpPinned(NotificationEntry entry)446     public void onHeadsUpPinned(NotificationEntry entry) {
447     }
448 
449     @Override
onHeadsUpUnPinned(NotificationEntry entry)450     public void onHeadsUpUnPinned(NotificationEntry entry) {
451     }
452 
453     @Override
onAmbientStateChanged(NotificationEntry entry, boolean isAmbient)454     public void onAmbientStateChanged(NotificationEntry entry, boolean isAmbient) {
455         onAlertStateChanged(entry, isAmbient);
456     }
457 
458     @Override
onHeadsUpStateChanged(NotificationEntry entry, boolean isHeadsUp)459     public void onHeadsUpStateChanged(NotificationEntry entry, boolean isHeadsUp) {
460         onAlertStateChanged(entry, isHeadsUp);
461     }
462 
onAlertStateChanged(NotificationEntry entry, boolean isAlerting)463     private void onAlertStateChanged(NotificationEntry entry, boolean isAlerting) {
464         if (isAlerting) {
465             if (shouldIsolate(entry)) {
466                 isolateNotification(entry);
467             }
468         } else {
469             stopIsolatingNotification(entry);
470         }
471     }
472 
473     /**
474      * Whether a notification that is normally part of a group should be temporarily isolated from
475      * the group and put in their own group visually.  This generally happens when the notification
476      * is alerting.
477      *
478      * @param entry the notification to check
479      * @return true if the entry should be isolated
480      */
481 
shouldIsolate(NotificationEntry entry)482     private boolean shouldIsolate(NotificationEntry entry) {
483         StatusBarNotification sbn = entry.notification;
484         NotificationGroup notificationGroup = mGroupMap.get(sbn.getGroupKey());
485         if (!sbn.isGroup() || sbn.getNotification().isGroupSummary()) {
486             return false;
487         }
488         if (!mHeadsUpManager.isAlerting(entry.key) && !mAmbientPulseManager.isAlerting(entry.key)) {
489             return false;
490         }
491         return (sbn.getNotification().fullScreenIntent != null
492                     || notificationGroup == null
493                     || !notificationGroup.expanded
494                     || isGroupNotFullyVisible(notificationGroup));
495     }
496 
497     /**
498      * Isolate a notification from its group so that it visually shows as its own group.
499      *
500      * @param entry the notification to isolate
501      */
isolateNotification(NotificationEntry entry)502     private void isolateNotification(NotificationEntry entry) {
503         StatusBarNotification sbn = entry.notification;
504 
505         // We will be isolated now, so lets update the groups
506         onEntryRemovedInternal(entry, entry.notification);
507 
508         mIsolatedEntries.put(sbn.getKey(), sbn);
509 
510         onEntryAdded(entry);
511         // We also need to update the suppression of the old group, because this call comes
512         // even before the groupManager knows about the notification at all.
513         // When the notification gets added afterwards it is already isolated and therefore
514         // it doesn't lead to an update.
515         updateSuppression(mGroupMap.get(entry.notification.getGroupKey()));
516         for (OnGroupChangeListener listener : mListeners) {
517             listener.onGroupsChanged();
518         }
519     }
520 
521     /**
522      * Stop isolating a notification and re-group it with its original logical group.
523      *
524      * @param entry the notification to un-isolate
525      */
stopIsolatingNotification(NotificationEntry entry)526     private void stopIsolatingNotification(NotificationEntry entry) {
527         StatusBarNotification sbn = entry.notification;
528         if (mIsolatedEntries.containsKey(sbn.getKey())) {
529             // not isolated anymore, we need to update the groups
530             onEntryRemovedInternal(entry, entry.notification);
531             mIsolatedEntries.remove(sbn.getKey());
532             onEntryAdded(entry);
533             for (OnGroupChangeListener listener : mListeners) {
534                 listener.onGroupsChanged();
535             }
536         }
537     }
538 
isGroupNotFullyVisible(NotificationGroup notificationGroup)539     private boolean isGroupNotFullyVisible(NotificationGroup notificationGroup) {
540         return notificationGroup.summary == null
541                 || notificationGroup.summary.isGroupNotFullyVisible();
542     }
543 
setHeadsUpManager(HeadsUpManager headsUpManager)544     public void setHeadsUpManager(HeadsUpManager headsUpManager) {
545         mHeadsUpManager = headsUpManager;
546     }
547 
dump(FileDescriptor fd, PrintWriter pw, String[] args)548     public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
549         pw.println("GroupManager state:");
550         pw.println("  number of groups: " +  mGroupMap.size());
551         for (Map.Entry<String, NotificationGroup>  entry : mGroupMap.entrySet()) {
552             pw.println("\n    key: " + entry.getKey()); pw.println(entry.getValue());
553         }
554         pw.println("\n    isolated entries: " +  mIsolatedEntries.size());
555         for (Map.Entry<String, StatusBarNotification> entry : mIsolatedEntries.entrySet()) {
556             pw.print("      "); pw.print(entry.getKey());
557             pw.print(", "); pw.println(entry.getValue());
558         }
559     }
560 
561     @Override
onStateChanged(int newState)562     public void onStateChanged(int newState) {
563         setStatusBarState(newState);
564     }
565 
566     public static class NotificationGroup {
567         public final HashMap<String, NotificationEntry> children = new HashMap<>();
568         public NotificationEntry summary;
569         public boolean expanded;
570         /**
571          * Is this notification group suppressed, i.e its summary is hidden
572          */
573         public boolean suppressed;
574 
575         @Override
toString()576         public String toString() {
577             String result = "    summary:\n      "
578                     + (summary != null ? summary.notification : "null")
579                     + (summary != null && summary.getDebugThrowable() != null
580                             ? Log.getStackTraceString(summary.getDebugThrowable())
581                             : "");
582             result += "\n    children size: " + children.size();
583             for (NotificationEntry child : children.values()) {
584                 result += "\n      " + child.notification
585                 + (child.getDebugThrowable() != null
586                         ? Log.getStackTraceString(child.getDebugThrowable())
587                         : "");
588             }
589             return result;
590         }
591     }
592 
593     public interface OnGroupChangeListener {
594 
595         /**
596          * A new group has been created.
597          *
598          * @param group the group that was created
599          * @param groupKey the group's key
600          */
onGroupCreated(NotificationGroup group, String groupKey)601         default void onGroupCreated(NotificationGroup group, String groupKey) {}
602 
603         /**
604          * A group has been removed.
605          *
606          * @param group the group that was removed
607          * @param groupKey the group's key
608          */
onGroupRemoved(NotificationGroup group, String groupKey)609         default void onGroupRemoved(NotificationGroup group, String groupKey) {}
610 
611         /**
612          * The suppression of a group has changed.
613          *
614          * @param group the group that has changed
615          * @param suppressed true if the group is now suppressed, false o/w
616          */
onGroupSuppressionChanged(NotificationGroup group, boolean suppressed)617         default void onGroupSuppressionChanged(NotificationGroup group, boolean suppressed) {}
618 
619         /**
620          * The expansion of a group has changed.
621          *
622          * @param changedRow the row for which the expansion has changed, which is also the summary
623          * @param expanded a boolean indicating the new expanded state
624          */
onGroupExpansionChanged(ExpandableNotificationRow changedRow, boolean expanded)625         default void onGroupExpansionChanged(ExpandableNotificationRow changedRow,
626                 boolean expanded) {}
627 
628         /**
629          * A group of children just received a summary notification and should therefore become
630          * children of it.
631          *
632          * @param group the group created
633          */
onGroupCreatedFromChildren(NotificationGroup group)634         default void onGroupCreatedFromChildren(NotificationGroup group) {}
635 
636         /**
637          * The groups have changed. This can happen if the isolation of a child has changes or if a
638          * group became suppressed / unsuppressed
639          */
onGroupsChanged()640         default void onGroupsChanged() {}
641     }
642 }
643