blob: c6407604290fdb5bc869e06aeb32c3cd2691130b [file] [log] [blame]
Ned Burns3d6b3962018-12-07 21:26:00 -05001/*
2 * Copyright (C) 2018 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 */
16package com.android.systemui.statusbar.notification;
17
Gus Prevasca1b6f72018-12-28 10:53:11 -050018import android.annotation.Nullable;
Gus Prevas26bc59b2018-12-19 11:26:39 -050019import android.service.notification.StatusBarNotification;
20
Gus Prevasca1b6f72018-12-28 10:53:11 -050021import com.android.internal.statusbar.NotificationVisibility;
Ned Burnsf81c4c42019-01-07 14:10:43 -050022import com.android.systemui.statusbar.notification.collection.NotificationEntry;
Gus Prevasb43dc652018-12-20 13:11:45 -050023import com.android.systemui.statusbar.notification.row.NotificationInflater;
24
Ned Burns3d6b3962018-12-07 21:26:00 -050025/**
Gus Prevasd65c2db2018-12-18 17:13:38 -050026 * Listener interface for changes sent by NotificationEntryManager.
Ned Burns3d6b3962018-12-07 21:26:00 -050027 */
Gus Prevasd65c2db2018-12-18 17:13:38 -050028public interface NotificationEntryListener {
Ned Burns3d6b3962018-12-07 21:26:00 -050029 /**
30 * Called when a new notification is posted. At this point, the notification is "pending": its
31 * views haven't been inflated yet and most of the system pretends like it doesn't exist yet.
32 */
Ned Burnsf81c4c42019-01-07 14:10:43 -050033 default void onPendingEntryAdded(NotificationEntry entry) {
Gus Prevasd65c2db2018-12-18 17:13:38 -050034 }
Ned Burns3d6b3962018-12-07 21:26:00 -050035
36 /**
Gus Prevas26bc59b2018-12-19 11:26:39 -050037 * Called when a new entry is created.
38 */
Ned Burnsf81c4c42019-01-07 14:10:43 -050039 default void onNotificationAdded(NotificationEntry entry) {
Gus Prevas26bc59b2018-12-19 11:26:39 -050040 }
41
42 /**
43 * Called when a notification was updated.
44 */
Ned Burnsf81c4c42019-01-07 14:10:43 -050045 default void onEntryUpdated(NotificationEntry entry) {
Gus Prevasb43dc652018-12-20 13:11:45 -050046 }
47
48 /**
49 * Called when a notification's views are inflated for the first time.
50 */
Ned Burnsf81c4c42019-01-07 14:10:43 -050051 default void onEntryInflated(NotificationEntry entry,
Gus Prevasb43dc652018-12-20 13:11:45 -050052 @NotificationInflater.InflationFlag int inflatedFlags) {
Gus Prevas26bc59b2018-12-19 11:26:39 -050053 }
54
55 /**
Ned Burns3d6b3962018-12-07 21:26:00 -050056 * Called when an existing notification's views are reinflated (usually due to an update being
57 * posted to that notification).
Gus Prevas5b9098dc2018-12-21 17:07:15 -050058 *
59 * @param entry notification data entry that was reinflated.
Ned Burns3d6b3962018-12-07 21:26:00 -050060 */
Ned Burnsf81c4c42019-01-07 14:10:43 -050061 default void onEntryReinflated(NotificationEntry entry) {
Gus Prevasd65c2db2018-12-18 17:13:38 -050062 }
Ned Burns3d6b3962018-12-07 21:26:00 -050063
64 /**
Gus Prevasca1b6f72018-12-28 10:53:11 -050065 * Called when an error occurred inflating the views for a notification.
66 */
67 default void onInflationError(StatusBarNotification notification, Exception exception) {
68 }
69
70 /**
Ned Burns3d6b3962018-12-07 21:26:00 -050071 * Called when a notification has been removed (either because the user swiped it away or
72 * because the developer retracted it).
Gus Prevas772e5322018-12-21 16:22:16 -050073 * @param entry notification data entry that was removed. Null if no entry existed for the
74 * removed key at the time of removal.
Gus Prevasca1b6f72018-12-28 10:53:11 -050075 * @param visibility logging data related to the visibility of the notification at the time of
76 * removal, if it was removed by a user action. Null if it was not removed by
77 * a user action.
Gus Prevasdca2be52018-12-21 11:25:10 -050078 * @param removedByUser true if the notification was removed by a user action
Gus Prevas26bc59b2018-12-19 11:26:39 -050079 */
Gus Prevasf37435a2018-12-20 15:40:01 -050080 default void onEntryRemoved(
Ned Burnsf81c4c42019-01-07 14:10:43 -050081 NotificationEntry entry,
Gus Prevasca1b6f72018-12-28 10:53:11 -050082 @Nullable NotificationVisibility visibility,
Gus Prevasdca2be52018-12-21 11:25:10 -050083 boolean removedByUser) {
Gus Prevas26bc59b2018-12-19 11:26:39 -050084 }
Ned Burns3d6b3962018-12-07 21:26:00 -050085}