blob: bbf2dde80040e6c3c0f307eedeb6f6dd020838ea [file] [log] [blame]
Gus Prevasec9e1f02018-12-18 15:28:12 -05001/*
2 * Copyright (C) 2018 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
Beverly Taibcb49942020-03-09 16:17:53 +000017package com.android.systemui.statusbar.notification;
Gus Prevasec9e1f02018-12-18 15:28:12 -050018
19import static com.android.systemui.statusbar.StatusBarState.SHADE;
20
Gus Prevasec9e1f02018-12-18 15:28:12 -050021import android.app.NotificationManager;
Beverly Taibcb49942020-03-09 16:17:53 +000022import android.content.Context;
Gus Prevasec9e1f02018-12-18 15:28:12 -050023import android.database.ContentObserver;
Lucas Dupin2c3992b2019-03-11 16:34:08 -070024import android.hardware.display.AmbientDisplayConfiguration;
Gus Prevasec9e1f02018-12-18 15:28:12 -050025import android.os.PowerManager;
26import android.os.RemoteException;
Beverly Taibcb49942020-03-09 16:17:53 +000027import android.os.ServiceManager;
Lucas Dupin2c3992b2019-03-11 16:34:08 -070028import android.os.UserHandle;
Gus Prevasec9e1f02018-12-18 15:28:12 -050029import android.provider.Settings;
Beverly Taibcb49942020-03-09 16:17:53 +000030import android.service.dreams.DreamService;
Gus Prevasec9e1f02018-12-18 15:28:12 -050031import android.service.dreams.IDreamManager;
32import android.service.notification.StatusBarNotification;
Gus Prevasec9e1f02018-12-18 15:28:12 -050033import android.util.Log;
34
35import com.android.internal.annotations.VisibleForTesting;
Beverly Taibcb49942020-03-09 16:17:53 +000036import com.android.systemui.Dependency;
Beverly8fdb5332019-02-04 14:29:49 -050037import com.android.systemui.plugins.statusbar.StatusBarStateController;
Beverly Taibcb49942020-03-09 16:17:53 +000038import com.android.systemui.statusbar.NotificationPresenter;
Selim Cinekc3fec682019-06-06 18:11:07 -070039import com.android.systemui.statusbar.StatusBarState;
Ned Burnsf81c4c42019-01-07 14:10:43 -050040import com.android.systemui.statusbar.notification.collection.NotificationEntry;
Lucas Dupinbd7366d2019-09-25 13:39:21 -070041import com.android.systemui.statusbar.policy.BatteryController;
Gus Prevasec9e1f02018-12-18 15:28:12 -050042import com.android.systemui.statusbar.policy.HeadsUpManager;
43
Govinda Wasserman2e86fb62019-08-13 11:35:44 -040044import javax.inject.Inject;
45import javax.inject.Singleton;
46
Gus Prevasec9e1f02018-12-18 15:28:12 -050047/**
48 * Provides heads-up and pulsing state for notification entries.
49 */
Govinda Wasserman2e86fb62019-08-13 11:35:44 -040050@Singleton
Beverly Taibcb49942020-03-09 16:17:53 +000051public class NotificationInterruptionStateProvider {
52
Gus Prevasec9e1f02018-12-18 15:28:12 -050053 private static final String TAG = "InterruptionStateProvider";
Beverly Taibcb49942020-03-09 16:17:53 +000054 private static final boolean DEBUG = false;
Lucas Dupinc0b81112019-07-25 18:56:12 -070055 private static final boolean DEBUG_HEADS_UP = true;
Gus Prevasec9e1f02018-12-18 15:28:12 -050056 private static final boolean ENABLE_HEADS_UP = true;
57 private static final String SETTING_HEADS_UP_TICKER = "ticker_gets_heads_up";
58
Mady Mellorc55b4122019-06-07 18:14:02 -070059 private final StatusBarStateController mStatusBarStateController;
60 private final NotificationFilter mNotificationFilter;
Beverly Taibcb49942020-03-09 16:17:53 +000061 private final AmbientDisplayConfiguration mAmbientDisplayConfiguration;
62
63 private final Context mContext;
Gus Prevasec9e1f02018-12-18 15:28:12 -050064 private final PowerManager mPowerManager;
65 private final IDreamManager mDreamManager;
Lucas Dupinbd7366d2019-09-25 13:39:21 -070066 private final BatteryController mBatteryController;
Gus Prevasec9e1f02018-12-18 15:28:12 -050067
Beverly Taibcb49942020-03-09 16:17:53 +000068 private NotificationPresenter mPresenter;
69 private HeadsUpManager mHeadsUpManager;
70 private HeadsUpSuppressor mHeadsUpSuppressor;
71
72 private ContentObserver mHeadsUpObserver;
Gus Prevasec9e1f02018-12-18 15:28:12 -050073 @VisibleForTesting
74 protected boolean mUseHeadsUp = false;
Beverly Taibcb49942020-03-09 16:17:53 +000075 private boolean mDisableNotificationAlerts;
Gus Prevasec9e1f02018-12-18 15:28:12 -050076
Govinda Wasserman2e86fb62019-08-13 11:35:44 -040077 @Inject
Beverly Taibcb49942020-03-09 16:17:53 +000078 public NotificationInterruptionStateProvider(Context context, NotificationFilter filter,
79 StatusBarStateController stateController, BatteryController batteryController) {
80 this(context,
81 (PowerManager) context.getSystemService(Context.POWER_SERVICE),
82 IDreamManager.Stub.asInterface(
83 ServiceManager.checkService(DreamService.DREAM_SERVICE)),
84 new AmbientDisplayConfiguration(context),
85 filter,
86 batteryController,
87 stateController);
88 }
89
90 @VisibleForTesting
91 protected NotificationInterruptionStateProvider(
92 Context context,
Gus Prevasec9e1f02018-12-18 15:28:12 -050093 PowerManager powerManager,
Lucas Dupin2c3992b2019-03-11 16:34:08 -070094 IDreamManager dreamManager,
Mady Mellorc55b4122019-06-07 18:14:02 -070095 AmbientDisplayConfiguration ambientDisplayConfiguration,
96 NotificationFilter notificationFilter,
Lucas Dupinbd7366d2019-09-25 13:39:21 -070097 BatteryController batteryController,
Beverly Taibcb49942020-03-09 16:17:53 +000098 StatusBarStateController statusBarStateController) {
99 mContext = context;
Gus Prevasec9e1f02018-12-18 15:28:12 -0500100 mPowerManager = powerManager;
101 mDreamManager = dreamManager;
Lucas Dupinbd7366d2019-09-25 13:39:21 -0700102 mBatteryController = batteryController;
Lucas Dupin2c3992b2019-03-11 16:34:08 -0700103 mAmbientDisplayConfiguration = ambientDisplayConfiguration;
Mady Mellorc55b4122019-06-07 18:14:02 -0700104 mNotificationFilter = notificationFilter;
105 mStatusBarStateController = statusBarStateController;
Beverly Taibcb49942020-03-09 16:17:53 +0000106 }
107
108 /** Sets up late-binding dependencies for this component. */
109 public void setUpWithPresenter(
110 NotificationPresenter notificationPresenter,
111 HeadsUpManager headsUpManager,
112 HeadsUpSuppressor headsUpSuppressor) {
113 setUpWithPresenter(notificationPresenter, headsUpManager, headsUpSuppressor,
114 new ContentObserver(Dependency.get(Dependency.MAIN_HANDLER)) {
115 @Override
116 public void onChange(boolean selfChange) {
117 boolean wasUsing = mUseHeadsUp;
118 mUseHeadsUp = ENABLE_HEADS_UP && !mDisableNotificationAlerts
119 && Settings.Global.HEADS_UP_OFF != Settings.Global.getInt(
120 mContext.getContentResolver(),
121 Settings.Global.HEADS_UP_NOTIFICATIONS_ENABLED,
122 Settings.Global.HEADS_UP_OFF);
123 Log.d(TAG, "heads up is " + (mUseHeadsUp ? "enabled" : "disabled"));
124 if (wasUsing != mUseHeadsUp) {
125 if (!mUseHeadsUp) {
126 Log.d(TAG,
127 "dismissing any existing heads up notification on disable"
128 + " event");
129 mHeadsUpManager.releaseAllImmediately();
130 }
131 }
Beverlye73aea22020-03-03 17:55:47 -0500132 }
Beverly Taibcb49942020-03-09 16:17:53 +0000133 });
134 }
135
136 /** Sets up late-binding dependencies for this component. */
137 public void setUpWithPresenter(
138 NotificationPresenter notificationPresenter,
139 HeadsUpManager headsUpManager,
140 HeadsUpSuppressor headsUpSuppressor,
141 ContentObserver observer) {
142 mPresenter = notificationPresenter;
143 mHeadsUpManager = headsUpManager;
144 mHeadsUpSuppressor = headsUpSuppressor;
145 mHeadsUpObserver = observer;
Gus Prevasec9e1f02018-12-18 15:28:12 -0500146
147 if (ENABLE_HEADS_UP) {
Beverly Taibcb49942020-03-09 16:17:53 +0000148 mContext.getContentResolver().registerContentObserver(
Gus Prevasec9e1f02018-12-18 15:28:12 -0500149 Settings.Global.getUriFor(Settings.Global.HEADS_UP_NOTIFICATIONS_ENABLED),
150 true,
151 mHeadsUpObserver);
Beverly Taibcb49942020-03-09 16:17:53 +0000152 mContext.getContentResolver().registerContentObserver(
Gus Prevasec9e1f02018-12-18 15:28:12 -0500153 Settings.Global.getUriFor(SETTING_HEADS_UP_TICKER), true,
154 mHeadsUpObserver);
155 }
156 mHeadsUpObserver.onChange(true); // set up
157 }
158
Beverly Taibcb49942020-03-09 16:17:53 +0000159 /**
160 * Whether the notification should appear as a bubble with a fly-out on top of the screen.
161 *
162 * @param entry the entry to check
163 * @return true if the entry should bubble up, false otherwise
164 */
Mady Mellor3f2efdb2018-11-21 11:30:45 -0800165 public boolean shouldBubbleUp(NotificationEntry entry) {
Ned Burns00b4b2d2019-10-17 22:09:27 -0400166 final StatusBarNotification sbn = entry.getSbn();
Mady Mellorc55b4122019-06-07 18:14:02 -0700167
168 if (!canAlertCommon(entry)) {
169 return false;
170 }
171
172 if (!canAlertAwakeCommon(entry)) {
173 return false;
174 }
175
Ned Burns47c98f12019-09-06 17:12:07 -0400176 if (!entry.canBubble()) {
Mady Melloraa8fef22019-04-11 13:36:40 -0700177 if (DEBUG) {
178 Log.d(TAG, "No bubble up: not allowed to bubble: " + sbn.getKey());
179 }
180 return false;
181 }
182
Mady Mellor3f2efdb2018-11-21 11:30:45 -0800183 if (!entry.isBubble()) {
184 if (DEBUG) {
185 Log.d(TAG, "No bubble up: notification " + sbn.getKey()
186 + " is bubble? " + entry.isBubble());
187 }
188 return false;
189 }
190
Mady Mellor2ac2d3a2020-01-08 17:18:54 -0800191 if (entry.getBubbleMetadata() == null
192 || (entry.getBubbleMetadata().getShortcutId() == null
193 && entry.getBubbleMetadata().getBubbleIntent() == null)) {
Mady Melloraa8fef22019-04-11 13:36:40 -0700194 if (DEBUG) {
195 Log.d(TAG, "No bubble up: notification: " + sbn.getKey()
196 + " doesn't have valid metadata");
197 }
198 return false;
199 }
200
Mady Mellor3f2efdb2018-11-21 11:30:45 -0800201 return true;
202 }
203
Beverly Taibcb49942020-03-09 16:17:53 +0000204 /**
205 * Whether the notification should peek in from the top and alert the user.
206 *
207 * @param entry the entry to check
208 * @return true if the entry should heads up, false otherwise
209 */
Ned Burnsf81c4c42019-01-07 14:10:43 -0500210 public boolean shouldHeadsUp(NotificationEntry entry) {
Selim Cinekc3fec682019-06-06 18:11:07 -0700211 if (mStatusBarStateController.isDozing()) {
212 return shouldHeadsUpWhenDozing(entry);
213 } else {
214 return shouldHeadsUpWhenAwake(entry);
Gus Prevasec9e1f02018-12-18 15:28:12 -0500215 }
Selim Cinekc3fec682019-06-06 18:11:07 -0700216 }
217
218 private boolean shouldHeadsUpWhenAwake(NotificationEntry entry) {
Ned Burns00b4b2d2019-10-17 22:09:27 -0400219 StatusBarNotification sbn = entry.getSbn();
Gus Prevasec9e1f02018-12-18 15:28:12 -0500220
Mady Mellorc55b4122019-06-07 18:14:02 -0700221 if (!mUseHeadsUp) {
Mady Mellor9defe412019-08-02 10:06:47 -0700222 if (DEBUG_HEADS_UP) {
Mady Mellorc55b4122019-06-07 18:14:02 -0700223 Log.d(TAG, "No heads up: no huns");
224 }
225 return false;
226 }
227
228 if (!canAlertCommon(entry)) {
229 return false;
230 }
231
232 if (!canAlertAwakeCommon(entry)) {
233 return false;
234 }
235
Gus Prevasec9e1f02018-12-18 15:28:12 -0500236 boolean inShade = mStatusBarStateController.getState() == SHADE;
Mady Mellor3f2efdb2018-11-21 11:30:45 -0800237 if (entry.isBubble() && inShade) {
Lucas Dupinc0b81112019-07-25 18:56:12 -0700238 if (DEBUG_HEADS_UP) {
Mady Mellor3f2efdb2018-11-21 11:30:45 -0800239 Log.d(TAG, "No heads up: in unlocked shade where notification is shown as a "
240 + "bubble: " + sbn.getKey());
241 }
Gus Prevasec9e1f02018-12-18 15:28:12 -0500242 return false;
243 }
244
Mady Mellorc55b4122019-06-07 18:14:02 -0700245 if (entry.shouldSuppressPeek()) {
Lucas Dupinc0b81112019-07-25 18:56:12 -0700246 if (DEBUG_HEADS_UP) {
Mady Mellorc55b4122019-06-07 18:14:02 -0700247 Log.d(TAG, "No heads up: suppressed by DND: " + sbn.getKey());
Gus Prevasec9e1f02018-12-18 15:28:12 -0500248 }
249 return false;
250 }
251
Ned Burns60e94592019-09-06 14:47:25 -0400252 if (entry.getImportance() < NotificationManager.IMPORTANCE_HIGH) {
Lucas Dupinc0b81112019-07-25 18:56:12 -0700253 if (DEBUG_HEADS_UP) {
Mady Mellor3f2efdb2018-11-21 11:30:45 -0800254 Log.d(TAG, "No heads up: unimportant notification: " + sbn.getKey());
Gus Prevasec9e1f02018-12-18 15:28:12 -0500255 }
256 return false;
257 }
258
259 boolean isDreaming = false;
260 try {
261 isDreaming = mDreamManager.isDreaming();
262 } catch (RemoteException e) {
263 Log.e(TAG, "Failed to query dream manager.", e);
264 }
265 boolean inUse = mPowerManager.isScreenOn() && !isDreaming;
266
267 if (!inUse) {
Lucas Dupinc0b81112019-07-25 18:56:12 -0700268 if (DEBUG_HEADS_UP) {
Gus Prevasec9e1f02018-12-18 15:28:12 -0500269 Log.d(TAG, "No heads up: not in use: " + sbn.getKey());
270 }
271 return false;
272 }
273
Beverly Taibcb49942020-03-09 16:17:53 +0000274 if (!mHeadsUpSuppressor.canHeadsUp(entry, sbn)) {
275 if (DEBUG_HEADS_UP) {
276 Log.d(TAG, "No heads up: aborted by suppressor: " + sbn.getKey());
Lucas Dupinc0b81112019-07-25 18:56:12 -0700277 }
Beverly Taibcb49942020-03-09 16:17:53 +0000278 return false;
Gus Prevasec9e1f02018-12-18 15:28:12 -0500279 }
Beverly Taibcb49942020-03-09 16:17:53 +0000280
Gus Prevasec9e1f02018-12-18 15:28:12 -0500281 return true;
282 }
283
284 /**
285 * Whether or not the notification should "pulse" on the user's display when the phone is
286 * dozing. This displays the ambient view of the notification.
287 *
288 * @param entry the entry to check
289 * @return true if the entry should ambient pulse, false otherwise
290 */
Selim Cinekc3fec682019-06-06 18:11:07 -0700291 private boolean shouldHeadsUpWhenDozing(NotificationEntry entry) {
Ned Burns00b4b2d2019-10-17 22:09:27 -0400292 StatusBarNotification sbn = entry.getSbn();
Gus Prevasec9e1f02018-12-18 15:28:12 -0500293
Lucas Dupin2c3992b2019-03-11 16:34:08 -0700294 if (!mAmbientDisplayConfiguration.pulseOnNotificationEnabled(UserHandle.USER_CURRENT)) {
Lucas Dupinc0b81112019-07-25 18:56:12 -0700295 if (DEBUG_HEADS_UP) {
Lucas Dupin2c3992b2019-03-11 16:34:08 -0700296 Log.d(TAG, "No pulsing: disabled by setting: " + sbn.getKey());
297 }
298 return false;
299 }
300
Lucas Dupinbd7366d2019-09-25 13:39:21 -0700301 if (mBatteryController.isAodPowerSave()) {
302 if (DEBUG_HEADS_UP) {
303 Log.d(TAG, "No pulsing: disabled by battery saver: " + sbn.getKey());
304 }
305 return false;
306 }
307
Gus Prevasec9e1f02018-12-18 15:28:12 -0500308 if (!canAlertCommon(entry)) {
Lucas Dupinc0b81112019-07-25 18:56:12 -0700309 if (DEBUG_HEADS_UP) {
Gus Prevasec9e1f02018-12-18 15:28:12 -0500310 Log.d(TAG, "No pulsing: notification shouldn't alert: " + sbn.getKey());
311 }
312 return false;
313 }
314
315 if (entry.shouldSuppressAmbient()) {
Lucas Dupinc0b81112019-07-25 18:56:12 -0700316 if (DEBUG_HEADS_UP) {
Gus Prevasec9e1f02018-12-18 15:28:12 -0500317 Log.d(TAG, "No pulsing: ambient effect suppressed: " + sbn.getKey());
318 }
319 return false;
320 }
321
Ned Burns60e94592019-09-06 14:47:25 -0400322 if (entry.getImportance() < NotificationManager.IMPORTANCE_DEFAULT) {
Lucas Dupinc0b81112019-07-25 18:56:12 -0700323 if (DEBUG_HEADS_UP) {
Gus Prevasec9e1f02018-12-18 15:28:12 -0500324 Log.d(TAG, "No pulsing: not important enough: " + sbn.getKey());
325 }
326 return false;
327 }
Beverly Taibcb49942020-03-09 16:17:53 +0000328 return true;
Gus Prevasec9e1f02018-12-18 15:28:12 -0500329 }
330
331 /**
Mady Mellorc55b4122019-06-07 18:14:02 -0700332 * Common checks between regular & AOD heads up and bubbles.
Gus Prevasec9e1f02018-12-18 15:28:12 -0500333 *
334 * @param entry the entry to check
335 * @return true if these checks pass, false if the notification should not alert
336 */
Beverly Taibcb49942020-03-09 16:17:53 +0000337 @VisibleForTesting
338 public boolean canAlertCommon(NotificationEntry entry) {
Ned Burns00b4b2d2019-10-17 22:09:27 -0400339 StatusBarNotification sbn = entry.getSbn();
Gus Prevasec9e1f02018-12-18 15:28:12 -0500340
341 if (mNotificationFilter.shouldFilterOut(entry)) {
Lucas Dupinc0b81112019-07-25 18:56:12 -0700342 if (DEBUG || DEBUG_HEADS_UP) {
Gus Prevasec9e1f02018-12-18 15:28:12 -0500343 Log.d(TAG, "No alerting: filtered notification: " + sbn.getKey());
344 }
345 return false;
346 }
347
348 // Don't alert notifications that are suppressed due to group alert behavior
349 if (sbn.isGroup() && sbn.getNotification().suppressAlertingDueToGrouping()) {
Lucas Dupinc0b81112019-07-25 18:56:12 -0700350 if (DEBUG || DEBUG_HEADS_UP) {
Gus Prevasec9e1f02018-12-18 15:28:12 -0500351 Log.d(TAG, "No alerting: suppressed due to group alert behavior");
352 }
353 return false;
354 }
Gus Prevasec9e1f02018-12-18 15:28:12 -0500355 return true;
356 }
357
Mady Mellor3f2efdb2018-11-21 11:30:45 -0800358 /**
Mady Mellorc55b4122019-06-07 18:14:02 -0700359 * Common checks between alerts that occur while the device is awake (heads up & bubbles).
Mady Mellor3f2efdb2018-11-21 11:30:45 -0800360 *
361 * @param entry the entry to check
Mady Mellorc55b4122019-06-07 18:14:02 -0700362 * @return true if these checks pass, false if the notification should not alert
Mady Mellor3f2efdb2018-11-21 11:30:45 -0800363 */
Beverly Taibcb49942020-03-09 16:17:53 +0000364 @VisibleForTesting
365 public boolean canAlertAwakeCommon(NotificationEntry entry) {
Ned Burns00b4b2d2019-10-17 22:09:27 -0400366 StatusBarNotification sbn = entry.getSbn();
Mady Mellor3f2efdb2018-11-21 11:30:45 -0800367
Beverly Taibcb49942020-03-09 16:17:53 +0000368 if (mPresenter.isDeviceInVrMode()) {
369 if (DEBUG_HEADS_UP) {
370 Log.d(TAG, "No alerting: no huns or vr mode");
Mady Mellor3f2efdb2018-11-21 11:30:45 -0800371 }
Beverly Taibcb49942020-03-09 16:17:53 +0000372 return false;
Mady Mellor3f2efdb2018-11-21 11:30:45 -0800373 }
374
375 if (isSnoozedPackage(sbn)) {
Lucas Dupinc0b81112019-07-25 18:56:12 -0700376 if (DEBUG_HEADS_UP) {
Mady Mellorc55b4122019-06-07 18:14:02 -0700377 Log.d(TAG, "No alerting: snoozed package: " + sbn.getKey());
Mady Mellor3f2efdb2018-11-21 11:30:45 -0800378 }
379 return false;
380 }
381
382 if (entry.hasJustLaunchedFullScreenIntent()) {
Lucas Dupinc0b81112019-07-25 18:56:12 -0700383 if (DEBUG_HEADS_UP) {
Mady Mellorc55b4122019-06-07 18:14:02 -0700384 Log.d(TAG, "No alerting: recent fullscreen: " + sbn.getKey());
Mady Mellor3f2efdb2018-11-21 11:30:45 -0800385 }
386 return false;
387 }
388
389 return true;
390 }
391
Gus Prevasec9e1f02018-12-18 15:28:12 -0500392 private boolean isSnoozedPackage(StatusBarNotification sbn) {
393 return mHeadsUpManager.isSnoozed(sbn.getPackageName());
394 }
Beverly Taibcb49942020-03-09 16:17:53 +0000395
396 /** Sets whether to disable all alerts. */
397 public void setDisableNotificationAlerts(boolean disableNotificationAlerts) {
398 mDisableNotificationAlerts = disableNotificationAlerts;
399 mHeadsUpObserver.onChange(true);
400 }
401
402 /** Whether all alerts are disabled. */
403 @VisibleForTesting
404 public boolean areNotificationAlertsDisabled() {
405 return mDisableNotificationAlerts;
406 }
407
408 /** Whether HUNs should be used. */
409 @VisibleForTesting
410 public boolean getUseHeadsUp() {
411 return mUseHeadsUp;
412 }
413
414 protected NotificationPresenter getPresenter() {
415 return mPresenter;
416 }
417
418 /**
419 * When an entry was added, should we launch its fullscreen intent? Examples are Alarms or
420 * incoming calls.
421 *
422 * @param entry the entry that was added
423 * @return {@code true} if we should launch the full screen intent
424 */
425 public boolean shouldLaunchFullScreenIntentWhenAdded(NotificationEntry entry) {
426 return entry.getSbn().getNotification().fullScreenIntent != null
427 && (!shouldHeadsUp(entry)
428 || mStatusBarStateController.getState() == StatusBarState.KEYGUARD);
429 }
430
431 /** A component which can suppress heads-up notifications due to the overall state of the UI. */
432 public interface HeadsUpSuppressor {
433 /**
434 * Returns false if the provided notification is ineligible for heads-up according to this
435 * component.
436 *
437 * @param entry entry of the notification that might be heads upped
438 * @param sbn notification that might be heads upped
439 * @return false if the notification can not be heads upped
440 */
441 boolean canHeadsUp(NotificationEntry entry, StatusBarNotification sbn);
442
443 }
444
Gus Prevasec9e1f02018-12-18 15:28:12 -0500445}