1 /* 2 * Copyright (C) 2020 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.notification.collection.render; 18 19 import android.annotation.Nullable; 20 21 import com.android.systemui.statusbar.notification.collection.ListEntry; 22 import com.android.systemui.statusbar.notification.collection.NotificationEntry; 23 24 import java.util.List; 25 26 /** 27 * Helper that determines the group states (parent, summary, children) of a notification. 28 */ 29 public interface GroupMembershipManager { 30 /** 31 * @return whether a given notification is a top level entry or is the summary in a group which 32 * has children 33 */ isGroupSummary(NotificationEntry entry)34 boolean isGroupSummary(NotificationEntry entry); 35 36 /** 37 * Get the summary of a specified status bar notification. For an isolated notification this 38 * returns itself. 39 */ getGroupSummary(NotificationEntry entry)40 NotificationEntry getGroupSummary(NotificationEntry entry); 41 42 /** 43 * Similar to {@link #getGroupSummary(NotificationEntry)} but doesn't get the visual summary 44 * but the logical summary, i.e when a child is isolated, it still returns the summary as if 45 * it wasn't isolated. 46 * TODO: remove this when migrating to the new pipeline, this is taken care of in the 47 * dismissal logic built into NotifCollection 48 */ getLogicalGroupSummary(NotificationEntry entry)49 default NotificationEntry getLogicalGroupSummary(NotificationEntry entry) { 50 return getGroupSummary(entry); 51 } 52 53 /** 54 * @return whether a given notification is a child in a group 55 */ isChildInGroup(NotificationEntry entry)56 boolean isChildInGroup(NotificationEntry entry); 57 58 /** 59 * Whether this is the only child in a group 60 */ isOnlyChildInGroup(NotificationEntry entry)61 boolean isOnlyChildInGroup(NotificationEntry entry); 62 63 /** 64 * Get the children that are in the summary's group, not including those isolated. 65 * 66 * @param summary summary of a group 67 * @return list of the children 68 */ 69 @Nullable getChildren(ListEntry summary)70 List<NotificationEntry> getChildren(ListEntry summary); 71 } 72