• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2025 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
18 
19 import android.app.Notification
20 import android.content.Context
21 import android.os.Build
22 import android.service.notification.NotificationListenerService
23 import android.service.notification.StatusBarNotification
24 import android.util.Log
25 import com.android.systemui.statusbar.notification.collection.notifcollection.NotifLifetimeExtender
26 import com.android.systemui.statusbar.notification.collection.provider.HighPriorityProvider
27 import com.android.systemui.statusbar.notification.icon.IconPack
28 import com.android.systemui.statusbar.notification.people.PeopleNotificationIdentifier.Companion.TYPE_NON_PERSON
29 import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow
30 import kotlinx.coroutines.flow.StateFlow
31 
32 class BundleEntryAdapter(
33     private val highPriorityProvider: HighPriorityProvider,
34     val entry: BundleEntry,
35 ) : EntryAdapter {
36 
getBackingHashCodenull37     override fun getBackingHashCode(): Int {
38         return entry.hashCode()
39     }
40 
41     /** TODO (b/394483200): convert to PipelineEntry.ROOT_ENTRY when pipeline is migrated? */
getParentnull42     override fun getParent(): GroupEntry {
43         return GroupEntry.ROOT_ENTRY
44     }
45 
isTopLevelEntrynull46     override fun isTopLevelEntry(): Boolean {
47         return true
48     }
49 
getKeynull50     override fun getKey(): String {
51         return entry.key
52     }
53 
getRownull54     override fun getRow(): ExpandableNotificationRow? {
55         return entry.row
56     }
57 
isGroupRootnull58     override fun isGroupRoot(): Boolean {
59         return true
60     }
61 
isSensitivenull62     override fun isSensitive(): StateFlow<Boolean> {
63         return entry.isSensitive
64     }
65 
isClearablenull66     override fun isClearable(): Boolean {
67         // TODO(b/394483200): check whether all of the children are clearable, when implemented
68         return true
69     }
70 
getTargetSdknull71     override fun getTargetSdk(): Int {
72         return Build.VERSION_CODES.CUR_DEVELOPMENT
73     }
74 
getSummarizationnull75     override fun getSummarization(): String? {
76         return null
77     }
78 
getContrastedColornull79     override fun getContrastedColor(
80         context: Context?,
81         isLowPriority: Boolean,
82         backgroundColor: Int,
83     ): Int {
84         return Notification.COLOR_DEFAULT
85     }
86 
canPeeknull87     override fun canPeek(): Boolean {
88         return false
89     }
90 
getWhennull91     override fun getWhen(): Long {
92         return 0
93     }
94 
getIconsnull95     override fun getIcons(): IconPack? {
96         // TODO(b/396446620): implement bundle icons
97         return null
98     }
99 
isColorizednull100     override fun isColorized(): Boolean {
101         return false
102     }
103 
getSbnnull104     override fun getSbn(): StatusBarNotification? {
105         return null
106     }
107 
getRankingnull108     override fun getRanking(): NotificationListenerService.Ranking? {
109         return null
110     }
111 
endLifetimeExtensionnull112     override fun endLifetimeExtension(
113         callback: NotifLifetimeExtender.OnEndLifetimeExtensionCallback?,
114         extender: NotifLifetimeExtender,
115     ) {
116         Log.wtf(TAG, "endLifetimeExtension() called")
117     }
118 
onImportanceChangednull119     override fun onImportanceChanged() {
120         Log.wtf(TAG, "onImportanceChanged() called")
121     }
122 
markForUserTriggeredMovementnull123     override fun markForUserTriggeredMovement() {
124         Log.wtf(TAG, "markForUserTriggeredMovement() called")
125     }
126 
isMarkedForUserTriggeredMovementnull127     override fun isMarkedForUserTriggeredMovement(): Boolean {
128         return false
129     }
130 
isHighPrioritynull131     override fun isHighPriority(): Boolean {
132         return highPriorityProvider.isHighPriority(entry)
133     }
134 
setInlineControlsShownnull135     override fun setInlineControlsShown(currentlyVisible: Boolean) {
136         // nothing to do, yet
137     }
138 
isBlockablenull139     override fun isBlockable(): Boolean {
140         return false
141     }
142 
canDragAndDropnull143     override fun canDragAndDrop(): Boolean {
144         return false
145     }
146 
isBubblenull147     override fun isBubble(): Boolean {
148         return false
149     }
150 
getStylenull151     override fun getStyle(): String? {
152         return null
153     }
154 
getSectionBucketnull155     override fun getSectionBucket(): Int {
156         return entry.bucket
157     }
158 
isAmbientnull159     override fun isAmbient(): Boolean {
160         return false
161     }
162 
getPeopleNotificationTypenull163     override fun getPeopleNotificationType(): Int {
164         return TYPE_NON_PERSON
165     }
166 
isPromotedOngoingnull167     override fun isPromotedOngoing(): Boolean {
168         return false
169     }
170 
isFullScreenCapablenull171     override fun isFullScreenCapable(): Boolean {
172         return false
173     }
174 
onDragSuccessnull175     override fun onDragSuccess() {
176         // do nothing. these should not be draggable
177         Log.wtf(TAG, "onDragSuccess() called")
178     }
179 
onNotificationBubbleIconClickednull180     override fun onNotificationBubbleIconClicked() {
181         // do nothing. these cannot be a bubble
182         Log.wtf(TAG, "onNotificationBubbleIconClicked() called")
183     }
184 
onNotificationActionClickednull185     override fun onNotificationActionClicked() {
186         // do nothing. these have no actions
187         Log.wtf(TAG, "onNotificationActionClicked() called")
188     }
189 
getDismissStatenull190     override fun getDismissState(): NotificationEntry.DismissState {
191         // TODO(b/394483200): setDismissState is only called in NotifCollection so it does not
192         // work on bundles yet
193         return NotificationEntry.DismissState.NOT_DISMISSED
194     }
195 
onEntryClickednull196     override fun onEntryClicked(row: ExpandableNotificationRow) {
197         // TODO(b/396446620): should anything happen when you click on a bundle?
198     }
199 }
200 
201 private const val TAG = "BundleEntryAdapter"
202