• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2024 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.promoted
18 
19 import com.android.systemui.statusbar.notification.collection.NotifPipeline
20 import com.android.systemui.statusbar.notification.collection.coordinator.Coordinator
21 import com.android.systemui.statusbar.notification.collection.coordinator.dagger.CoordinatorScope
22 import javax.inject.Inject
23 
24 /** A coordinator that may automatically promote certain notifications. */
25 interface AutomaticPromotionCoordinator : Coordinator {
26     companion object {
27         /**
28          * An extra that should be set on notifications that were automatically promoted. Used in
29          * case we want to disable certain features for only automatically promoted notifications
30          * (but not normally promoted notifications).
31          */
32         const val EXTRA_WAS_AUTOMATICALLY_PROMOTED = "android.wasAutomaticallyPromoted"
33 
34         /**
35          * An extra set only on automatically promoted notifications that contains text that could
36          * reasonably be the short critical text. For now, we're only extracting arrival times. Will
37          * be set as a String.
38          */
39         const val EXTRA_AUTOMATICALLY_EXTRACTED_SHORT_CRITICAL_TEXT =
40             "android.automaticallyExtractedShortCriticalText"
41     }
42 }
43 
44 /** A default implementation of [AutomaticPromotionCoordinator] that doesn't promote anything. */
45 @CoordinatorScope
46 class EmptyAutomaticPromotionCoordinator @Inject constructor() : AutomaticPromotionCoordinator {
attachnull47     override fun attach(pipeline: NotifPipeline) {}
48 }
49