1 /*
2  * Copyright (C) 2023 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 android.tools.traces.events
18 
19 /**
20  * From com.android.internal.jank.InteractionJankMonitor.
21  *
22  * NOTE: Make sure order is the same as in {@see com.android.internal.jank.InteractionJankMonitor}.
23  */
24 // TODO: Can we re-use to enum generated from the proto stats/enums/jank/enums.proto?
25 enum class CujType(val id: Int) {
26     CUJ_NOTIFICATION_SHADE_EXPAND_COLLAPSE(0),
27     CUJ_NOTIFICATION_SHADE_SCROLL_FLING(2),
28     CUJ_NOTIFICATION_SHADE_ROW_EXPAND(3),
29     CUJ_NOTIFICATION_SHADE_ROW_SWIPE(4),
30     CUJ_NOTIFICATION_SHADE_QS_EXPAND_COLLAPSE(5),
31     CUJ_NOTIFICATION_SHADE_QS_SCROLL_SWIPE(6),
32     CUJ_LAUNCHER_APP_LAUNCH_FROM_RECENTS(7),
33     CUJ_LAUNCHER_APP_LAUNCH_FROM_ICON(8),
34     CUJ_LAUNCHER_APP_CLOSE_TO_HOME(9),
35     CUJ_LAUNCHER_APP_CLOSE_TO_PIP(10),
36     CUJ_LAUNCHER_QUICK_SWITCH(11),
37     CUJ_NOTIFICATION_HEADS_UP_APPEAR(12),
38     CUJ_NOTIFICATION_HEADS_UP_DISAPPEAR(13),
39     CUJ_NOTIFICATION_ADD(14),
40     CUJ_NOTIFICATION_REMOVE(15),
41     CUJ_NOTIFICATION_APP_START(16),
42     CUJ_LOCKSCREEN_PASSWORD_APPEAR(17),
43     CUJ_LOCKSCREEN_PATTERN_APPEAR(18),
44     CUJ_LOCKSCREEN_PIN_APPEAR(19),
45     CUJ_LOCKSCREEN_PASSWORD_DISAPPEAR(20),
46     CUJ_LOCKSCREEN_PATTERN_DISAPPEAR(21),
47     CUJ_LOCKSCREEN_PIN_DISAPPEAR(22),
48     CUJ_LOCKSCREEN_TRANSITION_FROM_AOD(23),
49     CUJ_LOCKSCREEN_TRANSITION_TO_AOD(24),
50     CUJ_LAUNCHER_OPEN_ALL_APPS(25),
51     CUJ_LAUNCHER_ALL_APPS_SCROLL(26),
52     CUJ_LAUNCHER_APP_LAUNCH_FROM_WIDGET(27),
53     CUJ_SETTINGS_PAGE_SCROLL(28),
54     CUJ_LOCKSCREEN_UNLOCK_ANIMATION(29),
55     CUJ_SHADE_APP_LAUNCH_FROM_HISTORY_BUTTON(30),
56     CUJ_SHADE_APP_LAUNCH_FROM_MEDIA_PLAYER(31),
57     CUJ_SHADE_APP_LAUNCH_FROM_QS_TILE(32),
58     CUJ_SHADE_APP_LAUNCH_FROM_SETTINGS_BUTTON(33),
59     CUJ_STATUS_BAR_APP_LAUNCH_FROM_CALL_CHIP(34),
60     CUJ_PIP_TRANSITION(35),
61     CUJ_WALLPAPER_TRANSITION(36),
62     CUJ_USER_SWITCH(37),
63     CUJ_SPLASHSCREEN_AVD(38),
64     CUJ_SPLASHSCREEN_EXIT_ANIM(39),
65     CUJ_SCREEN_OFF(40),
66     CUJ_SCREEN_OFF_SHOW_AOD(41),
67     CUJ_ONE_HANDED_ENTER_TRANSITION(42),
68     CUJ_ONE_HANDED_EXIT_TRANSITION(43),
69     CUJ_UNFOLD_ANIM(44),
70     CUJ_SUW_LOADING_TO_SHOW_INFO_WITH_ACTIONS(45),
71     CUJ_SUW_SHOW_FUNCTION_SCREEN_WITH_ACTIONS(46),
72     CUJ_SUW_LOADING_TO_NEXT_FLOW(47),
73     CUJ_SUW_LOADING_SCREEN_FOR_STATUS(48),
74     CUJ_SPLIT_SCREEN_ENTER(49),
75     CUJ_SPLIT_SCREEN_EXIT(50),
76     CUJ_LOCKSCREEN_LAUNCH_CAMERA(51),
77     CUJ_SPLIT_SCREEN_RESIZE(52),
78     CUJ_SETTINGS_SLIDER(53),
79     CUJ_TAKE_SCREENSHOT(54),
80     CUJ_VOLUME_CONTROL(55),
81     CUJ_BIOMETRIC_PROMPT_TRANSITION(56),
82     CUJ_SETTINGS_TOGGLE(57),
83     CUJ_SHADE_DIALOG_OPEN(58),
84     CUJ_USER_DIALOG_OPEN(59),
85     CUJ_TASKBAR_EXPAND(60),
86     CUJ_TASKBAR_COLLAPSE(61),
87     CUJ_SHADE_CLEAR_ALL(62),
88     CUJ_LAUNCHER_UNLOCK_ENTRANCE_ANIMATION(63),
89     CUJ_LOCKSCREEN_OCCLUSION(64),
90     CUJ_RECENTS_SCROLLING(65),
91     CUJ_LAUNCHER_APP_SWIPE_TO_RECENTS(66),
92     CUJ_LAUNCHER_CLOSE_ALL_APPS_SWIPE(67),
93     CUJ_LAUNCHER_CLOSE_ALL_APPS_TO_HOME(68),
94     CUJ_LOCKSCREEN_CLOCK_MOVE_ANIMATION(70),
95     CUJ_LAUNCHER_OPEN_SEARCH_RESULT(71),
96 
97     // 72 - 77 are reserved for b/281564325.
98 
99     CUJ_LAUNCHER_APP_CLOSE_TO_HOME_FALLBACK(78),
100     CUJ_SHADE_EXPAND_FROM_STATUS_BAR(79),
101     CUJ_IME_INSETS_SHOW_ANIMATION(80),
102     CUJ_IME_INSETS_HIDE_ANIMATION(81),
103 
104     // KEEP AS LAST TYPE
105     // used to handle new types that haven't been added here yet but might be dumped by the platform
106     UNKNOWN(-1);
107 
108     companion object {
<lambda>null109         fun from(eventId: Int): CujType = values().firstOrNull { it.id == eventId } ?: UNKNOWN
110     }
111 }
112