Ned Burns | 3d6b396 | 2018-12-07 21:26:00 -0500 | [diff] [blame] | 1 | /* |
| 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 | */ |
| 16 | package com.android.systemui.statusbar.notification; |
| 17 | |
Gus Prevas | ca1b6f7 | 2018-12-28 10:53:11 -0500 | [diff] [blame] | 18 | import android.annotation.Nullable; |
Gus Prevas | 26bc59b | 2018-12-19 11:26:39 -0500 | [diff] [blame] | 19 | import android.service.notification.StatusBarNotification; |
| 20 | |
Gus Prevas | ca1b6f7 | 2018-12-28 10:53:11 -0500 | [diff] [blame] | 21 | import com.android.internal.statusbar.NotificationVisibility; |
Ned Burns | f81c4c4 | 2019-01-07 14:10:43 -0500 | [diff] [blame] | 22 | import com.android.systemui.statusbar.notification.collection.NotificationEntry; |
Gus Prevas | b43dc65 | 2018-12-20 13:11:45 -0500 | [diff] [blame] | 23 | import com.android.systemui.statusbar.notification.row.NotificationInflater; |
| 24 | |
Ned Burns | 3d6b396 | 2018-12-07 21:26:00 -0500 | [diff] [blame] | 25 | /** |
Gus Prevas | d65c2db | 2018-12-18 17:13:38 -0500 | [diff] [blame] | 26 | * Listener interface for changes sent by NotificationEntryManager. |
Ned Burns | 3d6b396 | 2018-12-07 21:26:00 -0500 | [diff] [blame] | 27 | */ |
Gus Prevas | d65c2db | 2018-12-18 17:13:38 -0500 | [diff] [blame] | 28 | public interface NotificationEntryListener { |
Ned Burns | 3d6b396 | 2018-12-07 21:26:00 -0500 | [diff] [blame] | 29 | /** |
| 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 Burns | f81c4c4 | 2019-01-07 14:10:43 -0500 | [diff] [blame] | 33 | default void onPendingEntryAdded(NotificationEntry entry) { |
Gus Prevas | d65c2db | 2018-12-18 17:13:38 -0500 | [diff] [blame] | 34 | } |
Ned Burns | 3d6b396 | 2018-12-07 21:26:00 -0500 | [diff] [blame] | 35 | |
| 36 | /** |
Gus Prevas | 26bc59b | 2018-12-19 11:26:39 -0500 | [diff] [blame] | 37 | * Called when a new entry is created. |
| 38 | */ |
Ned Burns | f81c4c4 | 2019-01-07 14:10:43 -0500 | [diff] [blame] | 39 | default void onNotificationAdded(NotificationEntry entry) { |
Gus Prevas | 26bc59b | 2018-12-19 11:26:39 -0500 | [diff] [blame] | 40 | } |
| 41 | |
| 42 | /** |
| 43 | * Called when a notification was updated. |
| 44 | */ |
Ned Burns | f81c4c4 | 2019-01-07 14:10:43 -0500 | [diff] [blame] | 45 | default void onEntryUpdated(NotificationEntry entry) { |
Gus Prevas | b43dc65 | 2018-12-20 13:11:45 -0500 | [diff] [blame] | 46 | } |
| 47 | |
| 48 | /** |
| 49 | * Called when a notification's views are inflated for the first time. |
| 50 | */ |
Ned Burns | f81c4c4 | 2019-01-07 14:10:43 -0500 | [diff] [blame] | 51 | default void onEntryInflated(NotificationEntry entry, |
Gus Prevas | b43dc65 | 2018-12-20 13:11:45 -0500 | [diff] [blame] | 52 | @NotificationInflater.InflationFlag int inflatedFlags) { |
Gus Prevas | 26bc59b | 2018-12-19 11:26:39 -0500 | [diff] [blame] | 53 | } |
| 54 | |
| 55 | /** |
Ned Burns | 3d6b396 | 2018-12-07 21:26:00 -0500 | [diff] [blame] | 56 | * Called when an existing notification's views are reinflated (usually due to an update being |
| 57 | * posted to that notification). |
Gus Prevas | 5b9098dc | 2018-12-21 17:07:15 -0500 | [diff] [blame] | 58 | * |
| 59 | * @param entry notification data entry that was reinflated. |
Ned Burns | 3d6b396 | 2018-12-07 21:26:00 -0500 | [diff] [blame] | 60 | */ |
Ned Burns | f81c4c4 | 2019-01-07 14:10:43 -0500 | [diff] [blame] | 61 | default void onEntryReinflated(NotificationEntry entry) { |
Gus Prevas | d65c2db | 2018-12-18 17:13:38 -0500 | [diff] [blame] | 62 | } |
Ned Burns | 3d6b396 | 2018-12-07 21:26:00 -0500 | [diff] [blame] | 63 | |
| 64 | /** |
Gus Prevas | ca1b6f7 | 2018-12-28 10:53:11 -0500 | [diff] [blame] | 65 | * Called when an error occurred inflating the views for a notification. |
| 66 | */ |
| 67 | default void onInflationError(StatusBarNotification notification, Exception exception) { |
| 68 | } |
| 69 | |
| 70 | /** |
Ned Burns | 3d6b396 | 2018-12-07 21:26:00 -0500 | [diff] [blame] | 71 | * Called when a notification has been removed (either because the user swiped it away or |
| 72 | * because the developer retracted it). |
Gus Prevas | 772e532 | 2018-12-21 16:22:16 -0500 | [diff] [blame] | 73 | * @param entry notification data entry that was removed. Null if no entry existed for the |
| 74 | * removed key at the time of removal. |
Gus Prevas | ca1b6f7 | 2018-12-28 10:53:11 -0500 | [diff] [blame] | 75 | * @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 Prevas | dca2be5 | 2018-12-21 11:25:10 -0500 | [diff] [blame] | 78 | * @param removedByUser true if the notification was removed by a user action |
Gus Prevas | 26bc59b | 2018-12-19 11:26:39 -0500 | [diff] [blame] | 79 | */ |
Gus Prevas | f37435a | 2018-12-20 15:40:01 -0500 | [diff] [blame] | 80 | default void onEntryRemoved( |
Ned Burns | f81c4c4 | 2019-01-07 14:10:43 -0500 | [diff] [blame] | 81 | NotificationEntry entry, |
Gus Prevas | ca1b6f7 | 2018-12-28 10:53:11 -0500 | [diff] [blame] | 82 | @Nullable NotificationVisibility visibility, |
Gus Prevas | dca2be5 | 2018-12-21 11:25:10 -0500 | [diff] [blame] | 83 | boolean removedByUser) { |
Gus Prevas | 26bc59b | 2018-12-19 11:26:39 -0500 | [diff] [blame] | 84 | } |
Ned Burns | 3d6b396 | 2018-12-07 21:26:00 -0500 | [diff] [blame] | 85 | } |