Selim Cinek | 25fd4e2b | 2015-02-20 17:46:07 +0100 | [diff] [blame] | 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 | |
Selim Cinek | 25fd4e2b | 2015-02-20 17:46:07 +0100 | [diff] [blame] | 19 | import android.service.notification.StatusBarNotification; |
Selim Cinek | 23c8034 | 2016-03-17 18:27:36 -0700 | [diff] [blame^] | 20 | import android.support.annotation.Nullable; |
Selim Cinek | 25fd4e2b | 2015-02-20 17:46:07 +0100 | [diff] [blame] | 21 | |
| 22 | import com.android.systemui.statusbar.ExpandableNotificationRow; |
| 23 | import com.android.systemui.statusbar.NotificationData; |
Selim Cinek | 9c4c414 | 2015-12-04 16:44:56 -0800 | [diff] [blame] | 24 | import com.android.systemui.statusbar.StatusBarState; |
Selim Cinek | ef5127e | 2015-12-21 16:55:58 -0800 | [diff] [blame] | 25 | import com.android.systemui.statusbar.policy.HeadsUpManager; |
Selim Cinek | 25fd4e2b | 2015-02-20 17:46:07 +0100 | [diff] [blame] | 26 | |
| 27 | import java.util.HashMap; |
| 28 | import java.util.HashSet; |
Selim Cinek | 25fd4e2b | 2015-02-20 17:46:07 +0100 | [diff] [blame] | 29 | |
| 30 | /** |
| 31 | * A class to handle notifications and their corresponding groups. |
| 32 | */ |
Selim Cinek | ef5127e | 2015-12-21 16:55:58 -0800 | [diff] [blame] | 33 | public class NotificationGroupManager implements HeadsUpManager.OnHeadsUpChangedListener { |
Selim Cinek | 25fd4e2b | 2015-02-20 17:46:07 +0100 | [diff] [blame] | 34 | |
| 35 | private final HashMap<String, NotificationGroup> mGroupMap = new HashMap<>(); |
| 36 | private OnGroupChangeListener mListener; |
| 37 | private int mBarState = -1; |
Selim Cinek | 23c8034 | 2016-03-17 18:27:36 -0700 | [diff] [blame^] | 38 | private HashMap<String, StatusBarNotification> mHeadsUpedEntries = new HashMap<>(); |
Selim Cinek | 25fd4e2b | 2015-02-20 17:46:07 +0100 | [diff] [blame] | 39 | |
| 40 | public void setOnGroupChangeListener(OnGroupChangeListener listener) { |
| 41 | mListener = listener; |
| 42 | } |
| 43 | |
| 44 | public boolean isGroupExpanded(StatusBarNotification sbn) { |
Selim Cinek | ef5127e | 2015-12-21 16:55:58 -0800 | [diff] [blame] | 45 | NotificationGroup group = mGroupMap.get(getGroupKey(sbn)); |
Selim Cinek | 25fd4e2b | 2015-02-20 17:46:07 +0100 | [diff] [blame] | 46 | if (group == null) { |
| 47 | return false; |
| 48 | } |
| 49 | return group.expanded; |
| 50 | } |
| 51 | |
| 52 | public void setGroupExpanded(StatusBarNotification sbn, boolean expanded) { |
Selim Cinek | ef5127e | 2015-12-21 16:55:58 -0800 | [diff] [blame] | 53 | NotificationGroup group = mGroupMap.get(getGroupKey(sbn)); |
Selim Cinek | 25fd4e2b | 2015-02-20 17:46:07 +0100 | [diff] [blame] | 54 | if (group == null) { |
| 55 | return; |
| 56 | } |
| 57 | setGroupExpanded(group, expanded); |
| 58 | } |
| 59 | |
| 60 | private void setGroupExpanded(NotificationGroup group, boolean expanded) { |
| 61 | group.expanded = expanded; |
| 62 | if (group.summary != null) { |
| 63 | mListener.onGroupExpansionChanged(group.summary.row, expanded); |
| 64 | } |
| 65 | } |
| 66 | |
| 67 | public void onEntryRemoved(NotificationData.Entry removed) { |
| 68 | onEntryRemovedInternal(removed, removed.notification); |
| 69 | } |
| 70 | |
| 71 | /** |
| 72 | * An entry was removed. |
| 73 | * |
| 74 | * @param removed the removed entry |
| 75 | * @param sbn the notification the entry has, which doesn't need to be the same as it's internal |
| 76 | * notification |
| 77 | */ |
| 78 | private void onEntryRemovedInternal(NotificationData.Entry removed, |
| 79 | final StatusBarNotification sbn) { |
Selim Cinek | ef5127e | 2015-12-21 16:55:58 -0800 | [diff] [blame] | 80 | String groupKey = getGroupKey(sbn); |
Selim Cinek | 25fd4e2b | 2015-02-20 17:46:07 +0100 | [diff] [blame] | 81 | final NotificationGroup group = mGroupMap.get(groupKey); |
Selim Cinek | 0b4aeab | 2015-09-01 17:07:38 -0700 | [diff] [blame] | 82 | if (group == null) { |
| 83 | // When an app posts 2 different notifications as summary of the same group, then a |
| 84 | // cancellation of the first notification removes this group. |
| 85 | // This situation is not supported and we will not allow such notifications anymore in |
| 86 | // the close future. See b/23676310 for reference. |
| 87 | return; |
| 88 | } |
Selim Cinek | ef5127e | 2015-12-21 16:55:58 -0800 | [diff] [blame] | 89 | if (isGroupChild(sbn)) { |
Selim Cinek | 25fd4e2b | 2015-02-20 17:46:07 +0100 | [diff] [blame] | 90 | group.children.remove(removed); |
Selim Cinek | e73ad21 | 2015-11-03 19:11:08 -0800 | [diff] [blame] | 91 | } else { |
| 92 | group.summary = null; |
Selim Cinek | 25fd4e2b | 2015-02-20 17:46:07 +0100 | [diff] [blame] | 93 | } |
Selim Cinek | 2a73934 | 2016-03-17 10:28:55 -0700 | [diff] [blame] | 94 | updateSuppression(group); |
Selim Cinek | 25fd4e2b | 2015-02-20 17:46:07 +0100 | [diff] [blame] | 95 | if (group.children.isEmpty()) { |
| 96 | if (group.summary == null) { |
| 97 | mGroupMap.remove(groupKey); |
Selim Cinek | 25fd4e2b | 2015-02-20 17:46:07 +0100 | [diff] [blame] | 98 | } |
| 99 | } |
| 100 | } |
| 101 | |
Selim Cinek | ef5127e | 2015-12-21 16:55:58 -0800 | [diff] [blame] | 102 | public void onEntryAdded(final NotificationData.Entry added) { |
| 103 | final StatusBarNotification sbn = added.notification; |
| 104 | boolean isGroupChild = isGroupChild(sbn); |
| 105 | String groupKey = getGroupKey(sbn); |
Selim Cinek | 25fd4e2b | 2015-02-20 17:46:07 +0100 | [diff] [blame] | 106 | NotificationGroup group = mGroupMap.get(groupKey); |
| 107 | if (group == null) { |
| 108 | group = new NotificationGroup(); |
| 109 | mGroupMap.put(groupKey, group); |
| 110 | } |
Selim Cinek | ef5127e | 2015-12-21 16:55:58 -0800 | [diff] [blame] | 111 | if (isGroupChild) { |
Selim Cinek | e73ad21 | 2015-11-03 19:11:08 -0800 | [diff] [blame] | 112 | group.children.add(added); |
Selim Cinek | 2a73934 | 2016-03-17 10:28:55 -0700 | [diff] [blame] | 113 | updateSuppression(group); |
Selim Cinek | e73ad21 | 2015-11-03 19:11:08 -0800 | [diff] [blame] | 114 | } else { |
Selim Cinek | 25fd4e2b | 2015-02-20 17:46:07 +0100 | [diff] [blame] | 115 | group.summary = added; |
Selim Cinek | b5605e5 | 2015-02-20 18:21:41 +0100 | [diff] [blame] | 116 | group.expanded = added.row.areChildrenExpanded(); |
Selim Cinek | 2a73934 | 2016-03-17 10:28:55 -0700 | [diff] [blame] | 117 | updateSuppression(group); |
Selim Cinek | 25fd4e2b | 2015-02-20 17:46:07 +0100 | [diff] [blame] | 118 | if (!group.children.isEmpty()) { |
| 119 | mListener.onGroupCreatedFromChildren(group); |
| 120 | } |
Selim Cinek | 25fd4e2b | 2015-02-20 17:46:07 +0100 | [diff] [blame] | 121 | } |
| 122 | } |
| 123 | |
Selim Cinek | 2a73934 | 2016-03-17 10:28:55 -0700 | [diff] [blame] | 124 | private void updateSuppression(NotificationGroup group) { |
Selim Cinek | 23c8034 | 2016-03-17 18:27:36 -0700 | [diff] [blame^] | 125 | if (group == null) { |
| 126 | return; |
| 127 | } |
Selim Cinek | 2a73934 | 2016-03-17 10:28:55 -0700 | [diff] [blame] | 128 | boolean prevSuppressed = group.suppressed; |
Selim Cinek | 23c8034 | 2016-03-17 18:27:36 -0700 | [diff] [blame^] | 129 | group.suppressed = group.summary != null && !group.expanded |
| 130 | && (group.children.size() == 1 |
| 131 | || (group.children.size() == 0 |
| 132 | && !group.summary.notification.getNotification().isGroupChild() |
| 133 | && hasIsolatedChildren(group))); |
Selim Cinek | 2a73934 | 2016-03-17 10:28:55 -0700 | [diff] [blame] | 134 | if (prevSuppressed != group.suppressed) { |
| 135 | mListener.onGroupsChanged(); |
| 136 | } |
| 137 | } |
| 138 | |
Selim Cinek | 23c8034 | 2016-03-17 18:27:36 -0700 | [diff] [blame^] | 139 | private boolean hasIsolatedChildren(NotificationGroup group) { |
| 140 | return getNumberOfIsolatedChildren(group.summary.notification.getGroupKey()) != 0; |
| 141 | } |
| 142 | |
| 143 | private int getNumberOfIsolatedChildren(String groupKey) { |
| 144 | int count = 0; |
| 145 | for (StatusBarNotification sbn : mHeadsUpedEntries.values()) { |
| 146 | if (sbn.getGroupKey().equals(groupKey) && isIsolated(sbn)) { |
| 147 | count++; |
| 148 | } |
| 149 | } |
| 150 | return count; |
| 151 | } |
| 152 | |
Selim Cinek | 25fd4e2b | 2015-02-20 17:46:07 +0100 | [diff] [blame] | 153 | public void onEntryUpdated(NotificationData.Entry entry, |
| 154 | StatusBarNotification oldNotification) { |
Selim Cinek | ef5127e | 2015-12-21 16:55:58 -0800 | [diff] [blame] | 155 | if (mGroupMap.get(getGroupKey(oldNotification)) != null) { |
Selim Cinek | 25fd4e2b | 2015-02-20 17:46:07 +0100 | [diff] [blame] | 156 | onEntryRemovedInternal(entry, oldNotification); |
| 157 | } |
| 158 | onEntryAdded(entry); |
Selim Cinek | 23c8034 | 2016-03-17 18:27:36 -0700 | [diff] [blame^] | 159 | if (mHeadsUpedEntries.containsKey(entry.key)) { |
| 160 | mHeadsUpedEntries.put(entry.key, entry.notification); |
| 161 | String oldKey = oldNotification.getGroupKey(); |
| 162 | String newKey = entry.notification.getGroupKey(); |
| 163 | if (!oldKey.equals(newKey)) { |
| 164 | updateSuppression(mGroupMap.get(oldKey)); |
| 165 | updateSuppression(mGroupMap.get(newKey)); |
| 166 | } |
| 167 | } |
Selim Cinek | 25fd4e2b | 2015-02-20 17:46:07 +0100 | [diff] [blame] | 168 | } |
| 169 | |
Selim Cinek | 2a73934 | 2016-03-17 10:28:55 -0700 | [diff] [blame] | 170 | public boolean isSummaryOfSuppressedGroup(StatusBarNotification sbn) { |
Selim Cinek | 23c8034 | 2016-03-17 18:27:36 -0700 | [diff] [blame^] | 171 | return isGroupSuppressed(getGroupKey(sbn)) && sbn.getNotification().isGroupSummary(); |
Selim Cinek | 25fd4e2b | 2015-02-20 17:46:07 +0100 | [diff] [blame] | 172 | } |
| 173 | |
Selim Cinek | 23c8034 | 2016-03-17 18:27:36 -0700 | [diff] [blame^] | 174 | public boolean isOnlyChildInSuppressedGroup(StatusBarNotification sbn) { |
| 175 | return isGroupSuppressed(sbn.getGroupKey()) |
| 176 | && sbn.getNotification().isGroupChild() |
| 177 | && getTotalNumberOfChildren(sbn) == 1; |
Selim Cinek | 2a73934 | 2016-03-17 10:28:55 -0700 | [diff] [blame] | 178 | } |
| 179 | |
Selim Cinek | 23c8034 | 2016-03-17 18:27:36 -0700 | [diff] [blame^] | 180 | private int getTotalNumberOfChildren(StatusBarNotification sbn) { |
| 181 | return getNumberOfIsolatedChildren(sbn.getGroupKey()) |
| 182 | + mGroupMap.get(sbn.getGroupKey()).children.size(); |
| 183 | } |
| 184 | |
| 185 | private boolean isGroupSuppressed(String groupKey) { |
| 186 | NotificationGroup group = mGroupMap.get(groupKey); |
Selim Cinek | 2a73934 | 2016-03-17 10:28:55 -0700 | [diff] [blame] | 187 | return group != null && group.suppressed; |
Selim Cinek | 25fd4e2b | 2015-02-20 17:46:07 +0100 | [diff] [blame] | 188 | } |
| 189 | |
Selim Cinek | 9c4c414 | 2015-12-04 16:44:56 -0800 | [diff] [blame] | 190 | public void setStatusBarState(int newState) { |
| 191 | if (mBarState == newState) { |
| 192 | return; |
| 193 | } |
| 194 | mBarState = newState; |
| 195 | if (mBarState == StatusBarState.KEYGUARD) { |
Selim Cinek | 9184f9c | 2016-02-02 17:36:53 -0800 | [diff] [blame] | 196 | collapseAllGroups(); |
| 197 | } |
| 198 | } |
| 199 | |
| 200 | public void collapseAllGroups() { |
| 201 | for (NotificationGroup group : mGroupMap.values()) { |
| 202 | if (group.expanded) { |
| 203 | setGroupExpanded(group, false); |
Selim Cinek | 9c4c414 | 2015-12-04 16:44:56 -0800 | [diff] [blame] | 204 | } |
Selim Cinek | 2a73934 | 2016-03-17 10:28:55 -0700 | [diff] [blame] | 205 | updateSuppression(group); |
Selim Cinek | 9c4c414 | 2015-12-04 16:44:56 -0800 | [diff] [blame] | 206 | } |
| 207 | } |
| 208 | |
Selim Cinek | 25fd4e2b | 2015-02-20 17:46:07 +0100 | [diff] [blame] | 209 | /** |
| 210 | * @return whether a given notification is a child in a group which has a summary |
| 211 | */ |
| 212 | public boolean isChildInGroupWithSummary(StatusBarNotification sbn) { |
Selim Cinek | ef5127e | 2015-12-21 16:55:58 -0800 | [diff] [blame] | 213 | if (!isGroupChild(sbn)) { |
Selim Cinek | 25fd4e2b | 2015-02-20 17:46:07 +0100 | [diff] [blame] | 214 | return false; |
| 215 | } |
Selim Cinek | ef5127e | 2015-12-21 16:55:58 -0800 | [diff] [blame] | 216 | NotificationGroup group = mGroupMap.get(getGroupKey(sbn)); |
Selim Cinek | 2a73934 | 2016-03-17 10:28:55 -0700 | [diff] [blame] | 217 | if (group == null || group.summary == null || group.suppressed) { |
Selim Cinek | 25fd4e2b | 2015-02-20 17:46:07 +0100 | [diff] [blame] | 218 | return false; |
| 219 | } |
| 220 | return true; |
| 221 | } |
| 222 | |
Selim Cinek | 263398f | 2015-10-21 17:40:23 -0700 | [diff] [blame] | 223 | /** |
| 224 | * @return whether a given notification is a summary in a group which has children |
| 225 | */ |
| 226 | public boolean isSummaryOfGroup(StatusBarNotification sbn) { |
Selim Cinek | ef5127e | 2015-12-21 16:55:58 -0800 | [diff] [blame] | 227 | if (!isGroupSummary(sbn)) { |
Selim Cinek | 263398f | 2015-10-21 17:40:23 -0700 | [diff] [blame] | 228 | return false; |
| 229 | } |
Selim Cinek | ef5127e | 2015-12-21 16:55:58 -0800 | [diff] [blame] | 230 | NotificationGroup group = mGroupMap.get(getGroupKey(sbn)); |
Selim Cinek | 263398f | 2015-10-21 17:40:23 -0700 | [diff] [blame] | 231 | if (group == null) { |
| 232 | return false; |
| 233 | } |
| 234 | return !group.children.isEmpty(); |
| 235 | } |
| 236 | |
Selim Cinek | 23c8034 | 2016-03-17 18:27:36 -0700 | [diff] [blame^] | 237 | /** |
| 238 | * Get the summary of a specified status bar notification. For isolated notification this return |
| 239 | * itself. |
| 240 | */ |
Selim Cinek | 25fd4e2b | 2015-02-20 17:46:07 +0100 | [diff] [blame] | 241 | public ExpandableNotificationRow getGroupSummary(StatusBarNotification sbn) { |
Selim Cinek | 23c8034 | 2016-03-17 18:27:36 -0700 | [diff] [blame^] | 242 | return getGroupSummary(getGroupKey(sbn)); |
| 243 | } |
| 244 | |
| 245 | /** |
| 246 | * Similar to {@link #getGroupSummary(StatusBarNotification)} but doesn't get the visual summary |
| 247 | * but the logical summary, i.e when a child is isolated, it still returns the summary as if |
| 248 | * it wasn't isolated. |
| 249 | */ |
| 250 | public ExpandableNotificationRow getLogicalGroupSummary( |
| 251 | StatusBarNotification sbn) { |
| 252 | return getGroupSummary(sbn.getGroupKey()); |
| 253 | } |
| 254 | |
| 255 | @Nullable |
| 256 | private ExpandableNotificationRow getGroupSummary(String groupKey) { |
| 257 | NotificationGroup group = mGroupMap.get(groupKey); |
Selim Cinek | 25fd4e2b | 2015-02-20 17:46:07 +0100 | [diff] [blame] | 258 | return group == null ? null |
| 259 | : group.summary == null ? null |
Selim Cinek | 23c8034 | 2016-03-17 18:27:36 -0700 | [diff] [blame^] | 260 | : group.summary.row; |
Selim Cinek | 25fd4e2b | 2015-02-20 17:46:07 +0100 | [diff] [blame] | 261 | } |
| 262 | |
Selim Cinek | 83bc783 | 2015-10-22 13:26:54 -0700 | [diff] [blame] | 263 | public void toggleGroupExpansion(StatusBarNotification sbn) { |
Selim Cinek | ef5127e | 2015-12-21 16:55:58 -0800 | [diff] [blame] | 264 | NotificationGroup group = mGroupMap.get(getGroupKey(sbn)); |
Selim Cinek | 83bc783 | 2015-10-22 13:26:54 -0700 | [diff] [blame] | 265 | if (group == null) { |
| 266 | return; |
| 267 | } |
| 268 | setGroupExpanded(group, !group.expanded); |
| 269 | } |
| 270 | |
Selim Cinek | ef5127e | 2015-12-21 16:55:58 -0800 | [diff] [blame] | 271 | private boolean isIsolated(StatusBarNotification sbn) { |
Selim Cinek | 23c8034 | 2016-03-17 18:27:36 -0700 | [diff] [blame^] | 272 | return mHeadsUpedEntries.containsKey(sbn.getKey()) |
| 273 | && sbn.getNotification().isGroupChild(); |
Selim Cinek | ef5127e | 2015-12-21 16:55:58 -0800 | [diff] [blame] | 274 | } |
| 275 | |
| 276 | private boolean isGroupSummary(StatusBarNotification sbn) { |
| 277 | if (isIsolated(sbn)) { |
| 278 | return true; |
| 279 | } |
| 280 | return sbn.getNotification().isGroupSummary(); |
| 281 | } |
| 282 | private boolean isGroupChild(StatusBarNotification sbn) { |
| 283 | if (isIsolated(sbn)) { |
| 284 | return false; |
| 285 | } |
| 286 | return sbn.getNotification().isGroupChild(); |
| 287 | } |
| 288 | |
| 289 | private String getGroupKey(StatusBarNotification sbn) { |
| 290 | if (isIsolated(sbn)) { |
| 291 | return sbn.getKey(); |
| 292 | } |
| 293 | return sbn.getGroupKey(); |
| 294 | } |
| 295 | |
| 296 | @Override |
| 297 | public void onHeadsUpPinnedModeChanged(boolean inPinnedMode) { |
| 298 | } |
| 299 | |
| 300 | @Override |
| 301 | public void onHeadsUpPinned(ExpandableNotificationRow headsUp) { |
| 302 | } |
| 303 | |
| 304 | @Override |
| 305 | public void onHeadsUpUnPinned(ExpandableNotificationRow headsUp) { |
| 306 | } |
| 307 | |
| 308 | @Override |
| 309 | public void onHeadsUpStateChanged(NotificationData.Entry entry, boolean isHeadsUp) { |
| 310 | final StatusBarNotification sbn = entry.notification; |
| 311 | if (entry.row.isHeadsUp()) { |
Selim Cinek | 23c8034 | 2016-03-17 18:27:36 -0700 | [diff] [blame^] | 312 | final boolean groupChild = sbn.getNotification().isGroupChild(); |
| 313 | if (groupChild) { |
| 314 | // We will be isolated now, so lets update the groups |
| 315 | onEntryRemovedInternal(entry, entry.notification); |
| 316 | } |
| 317 | mHeadsUpedEntries.put(sbn.getKey(), sbn); |
| 318 | if (groupChild) { |
| 319 | onEntryAdded(entry); |
| 320 | // We also need to update the suppression of the old group, because this call comes |
| 321 | // even before the groupManager knows about the notification at all. |
| 322 | // When the notification gets added afterwards it is already isolated and therefore |
| 323 | // it doesn't lead to an update. |
| 324 | updateSuppression(mGroupMap.get(entry.notification.getGroupKey())); |
| 325 | mListener.onGroupsChanged(); |
Selim Cinek | ef5127e | 2015-12-21 16:55:58 -0800 | [diff] [blame] | 326 | } |
| 327 | } else { |
Selim Cinek | 23c8034 | 2016-03-17 18:27:36 -0700 | [diff] [blame^] | 328 | if (mHeadsUpedEntries.containsKey(sbn.getKey())) { |
Selim Cinek | ef5127e | 2015-12-21 16:55:58 -0800 | [diff] [blame] | 329 | boolean isolatedBefore = isIsolated(sbn); |
| 330 | if (isolatedBefore) { |
| 331 | // not isolated anymore, we need to update the groups |
| 332 | onEntryRemovedInternal(entry, entry.notification); |
| 333 | } |
| 334 | mHeadsUpedEntries.remove(sbn.getKey()); |
| 335 | if (isolatedBefore) { |
| 336 | onEntryAdded(entry); |
Selim Cinek | 2a73934 | 2016-03-17 10:28:55 -0700 | [diff] [blame] | 337 | mListener.onGroupsChanged(); |
Selim Cinek | ef5127e | 2015-12-21 16:55:58 -0800 | [diff] [blame] | 338 | } |
| 339 | } |
| 340 | } |
| 341 | } |
| 342 | |
Selim Cinek | 25fd4e2b | 2015-02-20 17:46:07 +0100 | [diff] [blame] | 343 | public static class NotificationGroup { |
| 344 | public final HashSet<NotificationData.Entry> children = new HashSet<>(); |
| 345 | public NotificationData.Entry summary; |
| 346 | public boolean expanded; |
Selim Cinek | 2a73934 | 2016-03-17 10:28:55 -0700 | [diff] [blame] | 347 | /** |
| 348 | * Is this notification group suppressed, i.e its summary is hidden |
| 349 | */ |
| 350 | public boolean suppressed; |
Selim Cinek | 25fd4e2b | 2015-02-20 17:46:07 +0100 | [diff] [blame] | 351 | } |
| 352 | |
| 353 | public interface OnGroupChangeListener { |
| 354 | /** |
| 355 | * The expansion of a group has changed. |
| 356 | * |
| 357 | * @param changedRow the row for which the expansion has changed, which is also the summary |
| 358 | * @param expanded a boolean indicating the new expanded state |
| 359 | */ |
| 360 | void onGroupExpansionChanged(ExpandableNotificationRow changedRow, boolean expanded); |
| 361 | |
| 362 | /** |
Selim Cinek | 25fd4e2b | 2015-02-20 17:46:07 +0100 | [diff] [blame] | 363 | * A group of children just received a summary notification and should therefore become |
| 364 | * children of it. |
| 365 | * |
| 366 | * @param group the group created |
| 367 | */ |
| 368 | void onGroupCreatedFromChildren(NotificationGroup group); |
Selim Cinek | ef5127e | 2015-12-21 16:55:58 -0800 | [diff] [blame] | 369 | |
| 370 | /** |
Selim Cinek | 2a73934 | 2016-03-17 10:28:55 -0700 | [diff] [blame] | 371 | * The groups have changed. This can happen if the isolation of a child has changes or if a |
| 372 | * group became suppressed / unsuppressed |
Selim Cinek | ef5127e | 2015-12-21 16:55:58 -0800 | [diff] [blame] | 373 | */ |
Selim Cinek | 2a73934 | 2016-03-17 10:28:55 -0700 | [diff] [blame] | 374 | void onGroupsChanged(); |
Selim Cinek | 25fd4e2b | 2015-02-20 17:46:07 +0100 | [diff] [blame] | 375 | } |
| 376 | } |