1 /*
2  * Copyright (C) 2019 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;
18 
19 import android.service.notification.NotificationListenerService;
20 
21 /**
22  * Interface for anything that may need to prevent notifications from being removed. This is
23  * similar to a {@link NotificationLifetimeExtender} in the sense that it extends the life of
24  * a notification by preventing the removal, however, unlike the extender, the remove interceptor
25  * gets first pick at intercepting any type of removal -- the life time extender is unable to
26  * extend the life of a user dismissed or force removed notification.
27  */
28 public interface NotificationRemoveInterceptor {
29 
30     /**
31      * Called when a notification has been removed.
32      *
33      * @param key the entry key of the notification being removed.
34      * @param removeReason why the notification is being removed, e.g.
35      * {@link NotificationListenerService#REASON_CANCEL} or 0 if unknown.
36      *
37      * @return true if the removal should be ignored, false otherwise.
38      */
onNotificationRemoveRequested(String key, int removeReason)39     boolean onNotificationRemoveRequested(String key, int removeReason);
40 }
41