1 /*
2  * Copyright (C) 2023 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
5  * except in compliance with the License. You may obtain a copy of the License at
6  *
7  *      http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software distributed under the
10  * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
11  * KIND, either express or implied. See the License for the specific language governing
12  * permissions and limitations under the License.
13  *
14  */
15 
16 package com.android.systemui.statusbar.notification.shared
17 
18 import android.graphics.drawable.Icon
19 import com.android.systemui.statusbar.notification.stack.PriorityBucket
20 
21 /**
22  * Model for a top-level "entry" in the notification list, either an
23  * [individual notification][ActiveNotificationModel], or a [group][ActiveNotificationGroupModel].
24  */
25 sealed class ActiveNotificationEntryModel
26 
27 /**
28  * Model for an individual notification in the notification list. These can appear as either an
29  * individual top-level notification, or as a child or summary of a [ActiveNotificationGroupModel].
30  */
31 data class ActiveNotificationModel(
32     val key: String,
33     /** Notification group key associated with this entry. */
34     val groupKey: String?,
35     /** Is this entry in the ambient / minimized section (lowest priority)? */
36     val isAmbient: Boolean,
37     /**
38      * Is this entry dismissed? This is `true` when the user has dismissed the notification in the
39      * UI, but `NotificationManager` has not yet signalled to us that it has received the dismissal.
40      */
41     val isRowDismissed: Boolean,
42     /** Is this entry in the silent section? */
43     val isSilent: Boolean,
44     /**
45      * Does this entry represent a conversation, the last message of which was from a remote input
46      * reply?
47      */
48     val isLastMessageFromReply: Boolean,
49     /** Is this entry suppressed from appearing in the status bar as an icon? */
50     val isSuppressedFromStatusBar: Boolean,
51     /** Is this entry actively pulsing on AOD or bypassed-keyguard? */
52     val isPulsing: Boolean,
53     /** Icon to display on AOD. */
54     val aodIcon: Icon?,
55     /** Icon to display in the notification shelf. */
56     val shelfIcon: Icon?,
57     /** Icon to display in the status bar. */
58     val statusBarIcon: Icon?,
59     /** The notifying app's [packageName]'s uid. */
60     val uid: Int,
61     /** The notifying app's packageName. */
62     val packageName: String,
63     /** A small per-notification ID, used for statsd logging. */
64     val instanceId: Int?,
65     /** If this notification is the group summary for a group of notifications. */
66     val isGroupSummary: Boolean,
67     /** Indicates in which section the notification is displayed in. @see [PriorityBucket]. */
68     @PriorityBucket val bucket: Int,
69 ) : ActiveNotificationEntryModel()
70 
71 /** Model for a group of notifications. */
72 data class ActiveNotificationGroupModel(
73     val key: String,
74     val summary: ActiveNotificationModel,
75     val children: List<ActiveNotificationModel>,
76 ) : ActiveNotificationEntryModel()
77