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.row;
18 
19 import androidx.annotation.NonNull;
20 
21 import com.android.systemui.statusbar.notification.collection.NotifCollection.CancellationReason;
22 import com.android.systemui.statusbar.notification.collection.NotificationEntry;
23 
24 /**
25  * Callbacks for when a user interacts with an {@link ExpandableNotificationRow}.
26  */
27 public interface OnUserInteractionCallback {
28 
29     /**
30      * Triggered after a user has changed the importance of the notification via its
31      * {@link NotificationGuts}.
32      */
onImportanceChanged(NotificationEntry entry)33     void onImportanceChanged(NotificationEntry entry);
34 
35     /**
36      * Called once it is known that a dismissal will take place for the given reason.
37      * This returns a Runnable which MUST be invoked when the dismissal is ready to be completed.
38      *
39      * Registering for future dismissal is typically done before notifying the NMS that a
40      * notification was clicked or dismissed, but the local dismissal may happen later.
41      *
42      * @param entry              the entry being cancelled
43      * @param cancellationReason the reason for the cancellation
44      * @return the runnable to call when the dismissal can happen
45      */
46     @NonNull
registerFutureDismissal(@onNull NotificationEntry entry, @CancellationReason int cancellationReason)47     Runnable registerFutureDismissal(@NonNull NotificationEntry entry,
48             @CancellationReason int cancellationReason);
49 }
50