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 /** A component which can suppress visual interruptions of notifications such as heads-up and 22 * bubble-up. 23 */ 24 public interface NotificationInterruptSuppressor { 25 /** 26 * A unique name to identify this suppressor. 27 */ getName()28 default String getName() { 29 return this.getClass().getName(); 30 } 31 32 /** 33 * Returns true if the provided notification is, when the device is awake, ineligible for 34 * heads-up according to this component. 35 * 36 * @param entry entry of the notification that might heads-up 37 * @return true if the heads up interruption should be suppressed when the device is awake 38 */ suppressAwakeHeadsUp(NotificationEntry entry)39 default boolean suppressAwakeHeadsUp(NotificationEntry entry) { 40 return false; 41 } 42 43 /** 44 * Returns true if the provided notification is, when the device is awake, ineligible for 45 * heads-up or bubble-up according to this component. 46 * 47 * @param entry entry of the notification that might heads-up or bubble-up 48 * @return true if interruptions should be suppressed when the device is awake 49 */ suppressAwakeInterruptions(NotificationEntry entry)50 default boolean suppressAwakeInterruptions(NotificationEntry entry) { 51 return false; 52 } 53 54 /** 55 * Returns true if the provided notification is, regardless of awake/dozing state, 56 * ineligible for heads-up or bubble-up according to this component. 57 * 58 * @param entry entry of the notification that might heads-up or bubble-up 59 * @return true if interruptions should be suppressed 60 */ suppressInterruptions(NotificationEntry entry)61 default boolean suppressInterruptions(NotificationEntry entry) { 62 return false; 63 } 64 } 65