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.notifcollection; 18 19 import com.android.systemui.statusbar.notification.NotificationEntryManager; 20 import com.android.systemui.statusbar.notification.collection.NotifPipeline; 21 import com.android.systemui.statusbar.notification.collection.NotificationEntry; 22 23 import java.util.Collection; 24 25 /** 26 * A notification collection that manages the list of {@link NotificationEntry}s that will be 27 * rendered. 28 * 29 * TODO: (b/145659174) Once we fully switch off {@link NotificationEntryManager} to 30 * {@link NotifPipeline}, we probably won't need this, but having it for now makes it easy to 31 * switch between the two. 32 */ 33 public interface CommonNotifCollection { 34 /** 35 * Registers a listener to be informed when notifications are created, added, updated, removed, 36 * or deleted. 37 */ addCollectionListener(NotifCollectionListener listener)38 void addCollectionListener(NotifCollectionListener listener); 39 40 /** 41 * Returns the list of all known notifications, i.e. the notifications that are currently posted 42 * to the phone. In general, this tracks closely to the list maintained by NotificationManager, 43 * but it can diverge slightly due to lifetime extenders. 44 * 45 * The returned collection is read-only, unsorted, unfiltered, and ungrouped. 46 */ getAllNotifs()47 Collection<NotificationEntry> getAllNotifs(); 48 } 49