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.bubbles;
18 
19 import com.android.internal.annotations.VisibleForTesting;
20 import com.android.internal.logging.UiEvent;
21 import com.android.internal.logging.UiEventLogger;
22 
23 /**
24  * Interface for handling bubble-specific logging.
25  */
26 public interface BubbleLogger extends UiEventLogger {
27 
28     /**
29      * Bubble UI event.
30      */
31     @VisibleForTesting
32     enum Event implements UiEventLogger.UiEventEnum {
33 
34         @UiEvent(doc = "User dismissed the bubble via gesture, add bubble to overflow.")
35         BUBBLE_OVERFLOW_ADD_USER_GESTURE(483),
36 
37         @UiEvent(doc = "No more space in top row, add bubble to overflow.")
38         BUBBLE_OVERFLOW_ADD_AGED(484),
39 
40         @UiEvent(doc = "No more space in overflow, remove bubble from overflow")
41         BUBBLE_OVERFLOW_REMOVE_MAX_REACHED(485),
42 
43         @UiEvent(doc = "Notification canceled, remove bubble from overflow.")
44         BUBBLE_OVERFLOW_REMOVE_CANCEL(486),
45 
46         @UiEvent(doc = "Notification group canceled, remove bubble for child notif from overflow.")
47         BUBBLE_OVERFLOW_REMOVE_GROUP_CANCEL(487),
48 
49         @UiEvent(doc = "Notification no longer bubble, remove bubble from overflow.")
50         BUBBLE_OVERFLOW_REMOVE_NO_LONGER_BUBBLE(488),
51 
52         @UiEvent(doc = "User tapped overflow bubble. Promote bubble back to top row.")
53         BUBBLE_OVERFLOW_REMOVE_BACK_TO_STACK(489),
54 
55         @UiEvent(doc = "User blocked notification from bubbling, remove bubble from overflow.")
56         BUBBLE_OVERFLOW_REMOVE_BLOCKED(490);
57 
58         private final int mId;
59 
Event(int id)60         Event(int id) {
61             mId = id;
62         }
63 
64         @Override
getId()65         public int getId() {
66             return mId;
67         }
68     }
69 
70     /**
71      * @param b Bubble involved in this UI event
72      * @param e UI event
73      */
log(Bubble b, UiEventEnum e)74     void log(Bubble b, UiEventEnum e);
75 
76     /**
77      *
78      * @param b Bubble removed from overflow
79      * @param r Reason that bubble was removed from overflow
80      */
logOverflowRemove(Bubble b, @BubbleController.DismissReason int r)81     void logOverflowRemove(Bubble b, @BubbleController.DismissReason int r);
82 
83     /**
84      *
85      * @param b Bubble added to overflow
86      * @param r Reason that bubble was added to overflow
87      */
logOverflowAdd(Bubble b, @BubbleController.DismissReason int r)88     void logOverflowAdd(Bubble b, @BubbleController.DismissReason int r);
89 }
90