1 /*
2  * Copyright (C) 2020 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.interruption;
18 
19 import com.android.systemui.statusbar.notification.collection.NotificationEntry;
20 
21 /**
22  * Provides bubble-up and heads-up state for notification entries.
23  *
24  * When a notification is heads-up when dozing, this is also called "pulsing."
25  */
26 public interface NotificationInterruptStateProvider {
27     /**
28      * If the device is awake (not dozing):
29      *  Whether the notification should peek in from the top and alert the user.
30      *
31      * If the device is dozing:
32      *  Whether the notification should show the ambient view of the notification ("pulse").
33      *
34      * @param entry the entry to check
35      * @return true if the entry should heads up, false otherwise
36      */
shouldHeadsUp(NotificationEntry entry)37     boolean shouldHeadsUp(NotificationEntry entry);
38 
39     /**
40      * Whether the notification should appear as a bubble with a fly-out on top of the screen.
41      *
42      * @param entry the entry to check
43      * @return true if the entry should bubble up, false otherwise
44      */
shouldBubbleUp(NotificationEntry entry)45     boolean shouldBubbleUp(NotificationEntry entry);
46 
47     /**
48      * Whether to launch the entry's full screen intent when the entry is added.
49      *
50      * @param entry the entry that was added
51      * @return {@code true} if we should launch the full screen intent
52      */
shouldLaunchFullScreenIntentWhenAdded(NotificationEntry entry)53     boolean shouldLaunchFullScreenIntentWhenAdded(NotificationEntry entry);
54 
55     /**
56      * Add a component that can suppress visual interruptions.
57      */
addSuppressor(NotificationInterruptSuppressor suppressor)58     void addSuppressor(NotificationInterruptSuppressor suppressor);
59 }
60