• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
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 package com.android.launcher3.logging;
17 
18 import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ALLAPPS_CLOSE_DOWN;
19 import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ALLAPPS_OPEN_UP;
20 import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_HOME_GESTURE;
21 import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_OVERVIEW_GESTURE;
22 
23 import android.content.Context;
24 import android.view.View;
25 
26 import androidx.annotation.NonNull;
27 import androidx.annotation.Nullable;
28 import androidx.slice.SliceItem;
29 
30 import com.android.launcher3.R;
31 import com.android.launcher3.logger.LauncherAtom;
32 import com.android.launcher3.logger.LauncherAtom.ContainerInfo;
33 import com.android.launcher3.logger.LauncherAtom.FromState;
34 import com.android.launcher3.logger.LauncherAtom.ToState;
35 import com.android.launcher3.model.data.ItemInfo;
36 import com.android.launcher3.util.ResourceBasedOverride;
37 import com.android.launcher3.views.ActivityContext;
38 
39 /**
40  * Handles the user event logging in R+.
41  *
42  * <pre>
43  * All of the event ids are defined here.
44  * Most of the methods are placeholder methods for Launcher3
45  * Actual call happens only for Launcher variant that implements QuickStep.
46  * </pre>
47  */
48 public class StatsLogManager implements ResourceBasedOverride {
49 
50     public static final int LAUNCHER_STATE_UNSPECIFIED = 0;
51     public static final int LAUNCHER_STATE_BACKGROUND = 1;
52     public static final int LAUNCHER_STATE_HOME = 2;
53     public static final int LAUNCHER_STATE_OVERVIEW = 3;
54     public static final int LAUNCHER_STATE_ALLAPPS = 4;
55     public static final int LAUNCHER_STATE_UNCHANGED = 5;
56 
57     @NonNull
58     protected final Context mContext;
59     @Nullable
60     protected final ActivityContext mActivityContext;
61 
62     private KeyboardStateManager mKeyboardStateManager;
63     private InstanceId mInstanceId;
64 
StatsLogManager(@onNull Context context)65     public StatsLogManager(@NonNull Context context) {
66         mContext = context;
67         mActivityContext = ActivityContext.lookupContextNoThrow(context);
68     }
69 
70     /**
71      * Returns event enum based on the two state transition information when swipe
72      * gesture happens(to be removed during UserEventDispatcher cleanup).
73      */
getLauncherAtomEvent(int startState, int targetState, EventEnum fallbackEvent)74     public static EventEnum getLauncherAtomEvent(int startState,
75             int targetState, EventEnum fallbackEvent) {
76         if (startState == LAUNCHER_STATE_HOME
77                 && targetState == LAUNCHER_STATE_HOME) {
78             return LAUNCHER_HOME_GESTURE;
79         } else if (startState != LAUNCHER_STATE_OVERVIEW
80                 && targetState == LAUNCHER_STATE_OVERVIEW) {
81             return LAUNCHER_OVERVIEW_GESTURE;
82         } else if (startState != LAUNCHER_STATE_ALLAPPS
83                 && targetState == LAUNCHER_STATE_ALLAPPS) {
84             return LAUNCHER_ALLAPPS_OPEN_UP;
85         } else if (startState == LAUNCHER_STATE_ALLAPPS
86                 && targetState != LAUNCHER_STATE_ALLAPPS) {
87             return LAUNCHER_ALLAPPS_CLOSE_DOWN;
88         }
89         return fallbackEvent; // TODO fix
90     }
91 
92     public interface EventEnum {
93 
94         /**
95          * Tag used to request new UI Event IDs via presubmit analysis.
96          *
97          * <p>Use RESERVE_NEW_UI_EVENT_ID as the constructor parameter for a new {@link EventEnum}
98          * to signal the presubmit analyzer to reserve a new ID for the event. The new ID will be
99          * returned as a Gerrit presubmit finding.  Do not submit {@code RESERVE_NEW_UI_EVENT_ID} as
100          * the constructor parameter for any event.
101          *
102          * <pre>
103          * &#064;UiEvent(doc = "Briefly describe the interaction when this event will be logged")
104          * UNIQUE_EVENT_NAME(RESERVE_NEW_UI_EVENT_ID);
105          * </pre>
106          */
107         int RESERVE_NEW_UI_EVENT_ID = Integer.MIN_VALUE; // Negative IDs are ignored by the logger.
108 
getId()109         int getId();
110     }
111 
112     public enum LauncherEvent implements EventEnum {
113         /* Used to prevent double logging. */
114         IGNORE(-1),
115 
116         @UiEvent(doc = "App launched from workspace, hotseat or folder in launcher")
117         LAUNCHER_APP_LAUNCH_TAP(338),
118 
119         @UiEvent(doc = "Task launched from overview using TAP")
120         LAUNCHER_TASK_LAUNCH_TAP(339),
121 
122         @UiEvent(doc = "User tapped on notification inside popup context menu.")
123         LAUNCHER_NOTIFICATION_LAUNCH_TAP(516),
124 
125         @UiEvent(doc = "Task launched from overview using SWIPE DOWN")
126         LAUNCHER_TASK_LAUNCH_SWIPE_DOWN(340),
127 
128         @UiEvent(doc = "App launched by dragging and dropping, probably from taskbar")
129         LAUNCHER_APP_LAUNCH_DRAGDROP(1552),
130 
131         @UiEvent(doc = "TASK dismissed from overview using SWIPE UP")
132         LAUNCHER_TASK_DISMISS_SWIPE_UP(341),
133 
134         @UiEvent(doc = "User dragged a launcher item")
135         LAUNCHER_ITEM_DRAG_STARTED(383),
136 
137         @UiEvent(doc = "A dragged launcher item is successfully dropped onto workspace, hotseat "
138                 + "open folder etc")
139         LAUNCHER_ITEM_DROP_COMPLETED(385),
140 
141         @UiEvent(doc = "A dragged launcher item is successfully dropped onto a folder icon.")
142         LAUNCHER_ITEM_DROP_COMPLETED_ON_FOLDER_ICON(697),
143 
144         @UiEvent(doc = "A dragged launcher item is successfully dropped on another item "
145                 + "resulting in a new folder creation")
146         LAUNCHER_ITEM_DROP_FOLDER_CREATED(386),
147 
148         @UiEvent(doc = "Folder's label is automatically assigned.")
149         LAUNCHER_FOLDER_AUTO_LABELED(591),
150 
151         @UiEvent(doc = "Could not auto-label a folder because primary suggestion is null or empty.")
152         LAUNCHER_FOLDER_AUTO_LABELING_SKIPPED_EMPTY_PRIMARY(592),
153 
154         @UiEvent(doc = "Could not auto-label a folder because no suggestions exist.")
155         LAUNCHER_FOLDER_AUTO_LABELING_SKIPPED_EMPTY_SUGGESTIONS(593),
156 
157         @UiEvent(doc = "User manually updated the folder label.")
158         LAUNCHER_FOLDER_LABEL_UPDATED(460),
159 
160         @UiEvent(doc = "User long pressed on the workspace empty space.")
161         LAUNCHER_WORKSPACE_LONGPRESS(461),
162 
163         @UiEvent(doc = "User tapped or long pressed on a wallpaper icon inside launcher settings.")
164         LAUNCHER_WALLPAPER_BUTTON_TAP_OR_LONGPRESS(462),
165 
166         @UiEvent(doc = "User tapped or long pressed on settings icon inside launcher settings.")
167         LAUNCHER_SETTINGS_BUTTON_TAP_OR_LONGPRESS(463),
168 
169         @UiEvent(doc = "User tapped or long pressed on apps icon inside launcher settings.")
170         LAUNCHER_ALL_APPS_TAP_OR_LONGPRESS(2204),
171 
172         @UiEvent(doc = "User tapped or long pressed on widget tray icon inside launcher settings.")
173         LAUNCHER_WIDGETSTRAY_BUTTON_TAP_OR_LONGPRESS(464),
174 
175         @UiEvent(doc = "User expanded the list of widgets for a single app in the widget picker.")
176         LAUNCHER_WIDGETSTRAY_APP_EXPANDED(818),
177 
178         @UiEvent(doc = "User searched for a widget in the widget picker.")
179         LAUNCHER_WIDGETSTRAY_SEARCHED(819),
180 
181         @UiEvent(doc = "User clicked on view all button to expand the displayed list in the "
182                 + "widget picker.")
183         LAUNCHER_WIDGETSTRAY_EXPAND_PRESS(1978),
184 
185         @UiEvent(doc = "A dragged item is dropped on 'Remove' button in the target bar")
186         LAUNCHER_ITEM_DROPPED_ON_REMOVE(465),
187 
188         @UiEvent(doc = "A dragged item is dropped on 'Cancel' button in the target bar")
189         LAUNCHER_ITEM_DROPPED_ON_CANCEL(466),
190 
191         @UiEvent(doc = "A predicted item is dragged and dropped on 'Don't suggest app'"
192                 + " button in the target bar")
193         LAUNCHER_ITEM_DROPPED_ON_DONT_SUGGEST(467),
194 
195         @UiEvent(doc = "A dragged item is dropped on 'Uninstall' button in target bar")
196         LAUNCHER_ITEM_DROPPED_ON_UNINSTALL(468),
197 
198         @UiEvent(doc = "User completed uninstalling the package after dropping on "
199                 + "the icon onto 'Uninstall' button in the target bar")
200         LAUNCHER_ITEM_UNINSTALL_COMPLETED(469),
201 
202         @UiEvent(doc = "User cancelled uninstalling the package after dropping on "
203                 + "the icon onto 'Uninstall' button in the target bar")
204         LAUNCHER_ITEM_UNINSTALL_CANCELLED(470),
205 
206         @UiEvent(doc = "User tapped or long pressed on the task icon(aka package icon) "
207                 + "from overview to open task menu.")
208         LAUNCHER_TASK_ICON_TAP_OR_LONGPRESS(517),
209 
210         @UiEvent(doc = "User opened package specific widgets list by tapping on widgets system "
211                 + "shortcut inside popup context menu.")
212         LAUNCHER_SYSTEM_SHORTCUT_WIDGETS_TAP(514),
213 
214         @UiEvent(doc = "User tapped on app info system shortcut.")
215         LAUNCHER_SYSTEM_SHORTCUT_APP_INFO_TAP(515),
216 
217         /**
218          * @deprecated Use {@link #LAUNCHER_APP_ICON_MENU_SPLIT_LEFT_TOP} or
219          *             {@link #LAUNCHER_APP_ICON_MENU_SPLIT_RIGHT_BOTTOM}
220          */
221         @Deprecated
222         @UiEvent(doc = "User tapped on split screen icon on a task menu.")
223         LAUNCHER_SYSTEM_SHORTCUT_SPLIT_SCREEN_TAP(518),
224 
225         @UiEvent(doc = "User tapped on free form icon on a task menu.")
226         LAUNCHER_SYSTEM_SHORTCUT_FREE_FORM_TAP(519),
227 
228         @UiEvent(doc = "User tapped on desktop icon on a task menu.")
229         LAUNCHER_SYSTEM_SHORTCUT_DESKTOP_TAP(1706),
230 
231         @UiEvent(doc = "User tapped on external display icon on a task menu,")
232         LAUNCHER_SYSTEM_SHORTCUT_EXTERNAL_DISPLAY_TAP(1957),
233 
234         @UiEvent(doc = "User tapped on close app on a task menu,")
235         LAUNCHER_SYSTEM_SHORTCUT_CLOSE_APP_TAP(2081),
236 
237         @UiEvent(doc = "User tapped on pause app system shortcut.")
238         LAUNCHER_SYSTEM_SHORTCUT_PAUSE_TAP(521),
239 
240         @UiEvent(doc = "User tapped on pin system shortcut.")
241         LAUNCHER_SYSTEM_SHORTCUT_PIN_TAP(522),
242 
243         @UiEvent(doc = "User tapped on don't suggest app system shortcut.")
244         LAUNCHER_SYSTEM_SHORTCUT_DONT_SUGGEST_APP_TAP(1603),
245 
246         @UiEvent(doc = "User is shown All Apps education view.")
247         LAUNCHER_ALL_APPS_EDU_SHOWN(523),
248 
249         @UiEvent(doc = "User opened a folder.")
250         LAUNCHER_FOLDER_OPEN(551),
251 
252         @UiEvent(doc = "Hotseat education half sheet seen")
253         LAUNCHER_HOTSEAT_EDU_SEEN(479),
254 
255         @UiEvent(doc = "Hotseat migration accepted")
256         LAUNCHER_HOTSEAT_EDU_ACCEPT(480),
257 
258         @UiEvent(doc = "Hotseat migration denied")
259         LAUNCHER_HOTSEAT_EDU_DENY(481),
260 
261         @UiEvent(doc = "Hotseat education tip shown")
262         LAUNCHER_HOTSEAT_EDU_ONLY_TIP(482),
263 
264         /**
265          * @deprecated LauncherUiChanged.rank field is repurposed to store all apps rank, so no
266          * separate event is required.
267          */
268         @Deprecated
269         @UiEvent(doc = "App launch ranking logged for all apps predictions")
270         LAUNCHER_ALL_APPS_RANKED(552),
271 
272         @UiEvent(doc = "App launch ranking logged for hotseat predictions)")
273         LAUNCHER_HOTSEAT_RANKED(553),
274         @UiEvent(doc = "Launcher is now in background. e.g., Screen off event")
275         LAUNCHER_ONSTOP(562),
276 
277         @UiEvent(doc = "Launcher is now in foreground. e.g., Screen on event, back button")
278         LAUNCHER_ONRESUME(563),
279 
280         @UiEvent(doc = "User swipes or fling in LEFT direction on workspace.")
281         LAUNCHER_SWIPELEFT(564),
282 
283         @UiEvent(doc = "User swipes or fling in RIGHT direction on workspace.")
284         LAUNCHER_SWIPERIGHT(565),
285 
286         @UiEvent(doc = "User swipes or fling in UP direction in unknown way.")
287         LAUNCHER_UNKNOWN_SWIPEUP(566),
288 
289         @UiEvent(doc = "User swipes or fling in DOWN direction in unknown way.")
290         LAUNCHER_UNKNOWN_SWIPEDOWN(567),
291 
292         @UiEvent(doc = "User swipes or fling in UP direction to open apps drawer.")
293         LAUNCHER_ALLAPPS_OPEN_UP(568),
294 
295         @UiEvent(doc = "User swipes or fling in DOWN direction to close apps drawer.")
296         LAUNCHER_ALLAPPS_CLOSE_DOWN(569),
297 
298         @UiEvent(doc = "User tap outside apps drawer sheet to close apps drawer.")
299         LAUNCHER_ALLAPPS_CLOSE_TAP_OUTSIDE(941),
300 
301         @UiEvent(doc = "User swipes or fling in UP direction and hold from the bottom bazel area")
302         LAUNCHER_OVERVIEW_GESTURE(570),
303 
304         @UiEvent(doc = "User swipes or fling in LEFT direction on the bottom bazel area.")
305         LAUNCHER_QUICKSWITCH_LEFT(571),
306 
307         @UiEvent(doc = "User swipes or fling in RIGHT direction on the bottom bazel area.")
308         LAUNCHER_QUICKSWITCH_RIGHT(572),
309 
310         @UiEvent(doc = "User swipes or fling on the bottom bazel area to enter Desktop mode.")
311         LAUNCHER_QUICKSWITCH_ENTER_DESKTOP_MODE(2025),
312 
313         @UiEvent(doc = "User swipes or fling on the bottom bazel area to exit Desktop mode.")
314         LAUNCHER_QUICKSWITCH_EXIT_DESKTOP_MODE(2026),
315 
316         @UiEvent(doc = "User swipes or fling in DOWN direction on the bottom bazel area.")
317         LAUNCHER_SWIPEDOWN_NAVBAR(573),
318 
319         @UiEvent(doc = "User deep presses on the bottom bezel area.")
320         LAUNCHER_DEEP_PRESS_NAVBAR(1543),
321 
322         @UiEvent(doc = "User long presses on the bottom bezel area.")
323         LAUNCHER_LONG_PRESS_NAVBAR(1544),
324 
325         @UiEvent(doc = "User deep presses on the stashed taskbar")
326         LAUNCHER_DEEP_PRESS_STASHED_TASKBAR(1602),
327 
328         @UiEvent(doc = "User long presses on the stashed taskbar")
329         LAUNCHER_LONG_PRESS_STASHED_TASKBAR(1592),
330 
331         @UiEvent(doc = "User swipes or fling in UP direction from bottom bazel area.")
332         LAUNCHER_HOME_GESTURE(574),
333 
334         @UiEvent(doc = "User's workspace layout information is snapshot in the background.")
335         LAUNCHER_WORKSPACE_SNAPSHOT(579),
336 
337         @UiEvent(doc = "User tapped on the screenshot button on overview)")
338         LAUNCHER_OVERVIEW_ACTIONS_SCREENSHOT(580),
339 
340         @UiEvent(doc = "User tapped on the select button on overview)")
341         LAUNCHER_OVERVIEW_ACTIONS_SELECT(581),
342 
343         @UiEvent(doc = "User tapped on the share button on overview")
344         LAUNCHER_OVERVIEW_ACTIONS_SHARE(582),
345 
346         @UiEvent(doc = "User tapped on the split screen button on overview")
347         LAUNCHER_OVERVIEW_ACTIONS_SPLIT(895),
348 
349         @UiEvent(doc = "User tapped on the close button in select mode")
350         LAUNCHER_SELECT_MODE_CLOSE(583),
351 
352         @UiEvent(doc = "User tapped on the highlight items in select mode")
353         LAUNCHER_SELECT_MODE_ITEM(584),
354 
355         @UiEvent(doc = "Notification dot on app icon enabled.")
356         LAUNCHER_NOTIFICATION_DOT_ENABLED(611),
357 
358         @UiEvent(doc = "Notification dot on app icon disabled.")
359         LAUNCHER_NOTIFICATION_DOT_DISABLED(612),
360 
361         @UiEvent(doc = "For new apps, add app icons to home screen enabled.")
362         LAUNCHER_ADD_NEW_APPS_TO_HOME_SCREEN_ENABLED(613),
363 
364         @UiEvent(doc = "For new apps, add app icons to home screen disabled.")
365         LAUNCHER_ADD_NEW_APPS_TO_HOME_SCREEN_DISABLED(614),
366 
367         @UiEvent(doc = "Home screen rotation is enabled when phone is rotated.")
368         LAUNCHER_HOME_SCREEN_ROTATION_ENABLED(615),
369 
370         @UiEvent(doc = "Home screen rotation is disabled when phone is rotated.")
371         LAUNCHER_HOME_SCREEN_ROTATION_DISABLED(616),
372 
373         @UiEvent(doc = "Suggestions in all apps list enabled.")
374         LAUNCHER_ALL_APPS_SUGGESTIONS_ENABLED(619),
375 
376         @UiEvent(doc = "Suggestions in all apps list disabled.")
377         LAUNCHER_ALL_APPS_SUGGESTIONS_DISABLED(620),
378 
379         @UiEvent(doc = "Suggestions on home screen is enabled.")
380         LAUNCHER_HOME_SCREEN_SUGGESTIONS_ENABLED(621),
381 
382         @UiEvent(doc = "Suggestions on home screen is disabled.")
383         LAUNCHER_HOME_SCREEN_SUGGESTIONS_DISABLED(622),
384 
385         @UiEvent(doc = "System navigation is 3 button mode.")
386         LAUNCHER_NAVIGATION_MODE_3_BUTTON(623),
387 
388         @UiEvent(doc = "System navigation mode is 2 button mode.")
389         LAUNCHER_NAVIGATION_MODE_2_BUTTON(624),
390 
391         @UiEvent(doc = "System navigation mode is 0 button mode/gesture navigation mode .")
392         LAUNCHER_NAVIGATION_MODE_GESTURE_BUTTON(625),
393 
394         @UiEvent(doc = "User tapped on image content in Overview Select mode.")
395         LAUNCHER_SELECT_MODE_IMAGE(627),
396 
397         @UiEvent(doc = "User tapped on barcode content in Overview Select mode.")
398         LAUNCHER_SELECT_MODE_BARCODE(1531),
399 
400         @UiEvent(doc = "Highlight gleams for barcode content in Overview Select mode.")
401         LAUNCHER_SELECT_MODE_SHOW_BARCODE_REGIONS(1532),
402 
403         @UiEvent(doc = "Activity to add external item was started")
404         LAUNCHER_ADD_EXTERNAL_ITEM_START(641),
405 
406         @UiEvent(doc = "Activity to add external item was cancelled")
407         LAUNCHER_ADD_EXTERNAL_ITEM_CANCELLED(642),
408 
409         @UiEvent(doc = "Activity to add external item was backed out")
410         LAUNCHER_ADD_EXTERNAL_ITEM_BACK(643),
411 
412         @UiEvent(doc = "Item was placed automatically in external item addition flow")
413         LAUNCHER_ADD_EXTERNAL_ITEM_PLACED_AUTOMATICALLY(644),
414 
415         @UiEvent(doc = "Item was dragged in external item addition flow")
416         LAUNCHER_ADD_EXTERNAL_ITEM_DRAGGED(645),
417 
418         @UiEvent(doc = "A folder was replaced by a single item")
419         LAUNCHER_FOLDER_CONVERTED_TO_ICON(646),
420 
421         @UiEvent(doc = "A hotseat prediction item was pinned")
422         LAUNCHER_HOTSEAT_PREDICTION_PINNED(647),
423 
424         @UiEvent(doc = "Undo event was tapped.")
425         LAUNCHER_UNDO(648),
426 
427         @UiEvent(doc = "Task switcher clear all target was tapped.")
428         LAUNCHER_TASK_CLEAR_ALL(649),
429 
430         @UiEvent(doc = "Task preview was long pressed.")
431         LAUNCHER_TASK_PREVIEW_LONGPRESS(650),
432 
433         @UiEvent(doc = "User swiped down on workspace (triggering noti shade to open).")
434         LAUNCHER_SWIPE_DOWN_WORKSPACE_NOTISHADE_OPEN(651),
435 
436         @UiEvent(doc = "Notification dismissed by swiping right.")
437         LAUNCHER_NOTIFICATION_DISMISSED(652),
438 
439         @UiEvent(doc = "Current grid size is changed to 2x2")
440         LAUNCHER_GRID_SIZE_2_BY_2(2181),
441 
442         @UiEvent(doc = "Current grid size is changed to 3x3")
443         LAUNCHER_GRID_SIZE_3_BY_3(2182),
444 
445         @UiEvent(doc = "Current grid size is changed to 4x4")
446         LAUNCHER_GRID_SIZE_4_BY_4(2183),
447 
448         @UiEvent(doc = "Current grid size is changed to 4x5")
449         LAUNCHER_GRID_SIZE_4_BY_5(2184),
450 
451         @UiEvent(doc = "Current grid size is changed to 4x6")
452         LAUNCHER_GRID_SIZE_4_BY_6(2185),
453 
454         @UiEvent(doc = "Current grid size is changed to 5x5")
455         LAUNCHER_GRID_SIZE_5_BY_5(2186),
456 
457         @UiEvent(doc = "Current grid size is changed to 5x6")
458         LAUNCHER_GRID_SIZE_5_BY_6(2187),
459 
460         @UiEvent(doc = "Current grid size is changed to 6x5")
461         LAUNCHER_GRID_SIZE_6_BY_5(2188),
462 
463         @UiEvent(doc = "Launcher entered into AllApps state.")
464         LAUNCHER_ALLAPPS_ENTRY(692),
465 
466         @UiEvent(doc = "Launcher exited from AllApps state.")
467         LAUNCHER_ALLAPPS_EXIT(693),
468 
469         @UiEvent(doc = "User closed the AllApps keyboard.")
470         LAUNCHER_ALLAPPS_KEYBOARD_CLOSED(694),
471 
472         @UiEvent(doc = "User switched to AllApps Main/Personal tab by swiping left.")
473         LAUNCHER_ALLAPPS_SWIPE_TO_PERSONAL_TAB(695),
474 
475         @UiEvent(doc = "User switched to AllApps Work tab by swiping right.")
476         LAUNCHER_ALLAPPS_SWIPE_TO_WORK_TAB(696),
477 
478         @UiEvent(doc = "Default event when dedicated UI event is not available for the user action"
479                 + " on slice .")
480         LAUNCHER_SLICE_DEFAULT_ACTION(700),
481 
482         @UiEvent(doc = "User toggled-on a Slice item.")
483         LAUNCHER_SLICE_TOGGLE_ON(701),
484 
485         @UiEvent(doc = "User toggled-off a Slice item.")
486         LAUNCHER_SLICE_TOGGLE_OFF(702),
487 
488         @UiEvent(doc = "User acted on a Slice item with a button.")
489         LAUNCHER_SLICE_BUTTON_ACTION(703),
490 
491         @UiEvent(doc = "User acted on a Slice item with a slider.")
492         LAUNCHER_SLICE_SLIDER_ACTION(704),
493 
494         @UiEvent(doc = "User tapped on the entire row of a Slice.")
495         LAUNCHER_SLICE_CONTENT_ACTION(705),
496 
497         @UiEvent(doc = "User tapped on the see more button of a Slice.")
498         LAUNCHER_SLICE_SEE_MORE_ACTION(706),
499 
500         @UiEvent(doc = "User selected from a selection row of Slice.")
501         LAUNCHER_SLICE_SELECTION_ACTION(707),
502 
503         @UiEvent(doc = "IME is used for selecting the focused item on the AllApps screen.")
504         LAUNCHER_ALLAPPS_FOCUSED_ITEM_SELECTED_WITH_IME(718),
505 
506         @UiEvent(doc = "User long-pressed on an AllApps item.")
507         LAUNCHER_ALLAPPS_ITEM_LONG_PRESSED(719),
508 
509         @UiEvent(doc = "Launcher entered into AllApps state with device search enabled.")
510         LAUNCHER_ALLAPPS_ENTRY_WITH_DEVICE_SEARCH(720),
511 
512         @UiEvent(doc = "User switched to AllApps Main/Personal tab by tapping on it.")
513         LAUNCHER_ALLAPPS_TAP_ON_PERSONAL_TAB(721),
514 
515         @UiEvent(doc = "User switched to AllApps Work tab by tapping on it.")
516         LAUNCHER_ALLAPPS_TAP_ON_WORK_TAB(722),
517 
518         @UiEvent(doc = "All apps vertical fling started.")
519         LAUNCHER_ALLAPPS_VERTICAL_SWIPE_BEGIN(724),
520 
521         @UiEvent(doc = "All apps vertical fling ended.")
522         LAUNCHER_ALLAPPS_VERTICAL_SWIPE_END(725),
523 
524         @UiEvent(doc = "Show URL indicator for Overview Sharing")
525         LAUNCHER_OVERVIEW_SHARING_SHOW_URL_INDICATOR(764),
526 
527         @UiEvent(doc = "Show image indicator for Overview Sharing")
528         LAUNCHER_OVERVIEW_SHARING_SHOW_IMAGE_INDICATOR(765),
529 
530         @UiEvent(doc = "User taps URL indicator in Overview")
531         LAUNCHER_OVERVIEW_SHARING_URL_INDICATOR_TAP(766),
532 
533         @UiEvent(doc = "User taps image indicator in Overview")
534         LAUNCHER_OVERVIEW_SHARING_IMAGE_INDICATOR_TAP(767),
535 
536         @UiEvent(doc = "User long presses an image in Overview")
537         LAUNCHER_OVERVIEW_SHARING_IMAGE_LONG_PRESS(768),
538 
539         @UiEvent(doc = "User drags a URL in Overview")
540         LAUNCHER_OVERVIEW_SHARING_URL_DRAG(769),
541 
542         @UiEvent(doc = "User drags an image in Overview")
543         LAUNCHER_OVERVIEW_SHARING_IMAGE_DRAG(770),
544 
545         @UiEvent(doc = "User drops URL to a direct share target")
546         LAUNCHER_OVERVIEW_SHARING_DROP_URL_TO_TARGET(771),
547 
548         @UiEvent(doc = "User drops an image to a direct share target")
549         LAUNCHER_OVERVIEW_SHARING_DROP_IMAGE_TO_TARGET(772),
550 
551         @UiEvent(doc = "User drops URL to the More button")
552         LAUNCHER_OVERVIEW_SHARING_DROP_URL_TO_MORE(773),
553 
554         @UiEvent(doc = "User drops an image to the More button")
555         LAUNCHER_OVERVIEW_SHARING_DROP_IMAGE_TO_MORE(774),
556 
557         @UiEvent(doc = "User taps a share target to share URL")
558         LAUNCHER_OVERVIEW_SHARING_TAP_TARGET_TO_SHARE_URL(775),
559 
560         @UiEvent(doc = "User taps a share target to share an image")
561         LAUNCHER_OVERVIEW_SHARING_TAP_TARGET_TO_SHARE_IMAGE(776),
562 
563         @UiEvent(doc = "User taps the More button to share URL")
564         LAUNCHER_OVERVIEW_SHARING_TAP_MORE_TO_SHARE_URL(777),
565 
566         @UiEvent(doc = "User taps the More button to share an image")
567         LAUNCHER_OVERVIEW_SHARING_TAP_MORE_TO_SHARE_IMAGE(778),
568 
569         @UiEvent(doc = "Show Barode indicator for overview sharing")
570         LAUNCHER_OVERVIEW_SHARING_SHOW_BARCODE_INDICATOR(1533),
571 
572         @UiEvent(doc = "User taps barcode indicator in overview")
573         LAUNCHER_OVERVIEW_SHARING_BARCODE_INDICATOR_TAP(1534),
574 
575         @UiEvent(doc = "Configure barcode region for long_press action for overview sharing")
576         LAUNCHER_OVERVIEW_SHARING_CONFIGURE_BARCODE_REGION_LONG_PRESS(1535),
577 
578         @UiEvent(doc = "User long presses a barcode region in overview")
579         LAUNCHER_OVERVIEW_SHARING_BARCODE_REGION_LONG_PRESS(1536),
580 
581         @UiEvent(doc = "User drags a barcode region in overview")
582         LAUNCHER_OVERVIEW_SHARING_BARCODE_REGION_DRAG(1537),
583 
584         @UiEvent(doc = "User started resizing a widget on their home screen.")
585         LAUNCHER_WIDGET_RESIZE_STARTED(820),
586 
587         @UiEvent(doc = "User finished resizing a widget on their home screen.")
588         LAUNCHER_WIDGET_RESIZE_COMPLETED(824),
589 
590         @UiEvent(doc = "User reconfigured a widget on their home screen.")
591         LAUNCHER_WIDGET_RECONFIGURED(821),
592 
593         @UiEvent(doc = "User enabled themed icons option in wallpaper & style settings.")
594         LAUNCHER_THEMED_ICON_ENABLED(836),
595 
596         @UiEvent(doc = "User disabled themed icons option in wallpaper & style settings.")
597         LAUNCHER_THEMED_ICON_DISABLED(837),
598 
599         @UiEvent(doc = "User tapped on 'Turn on work apps' button in all apps window.")
600         LAUNCHER_TURN_ON_WORK_APPS_TAP(838),
601 
602         @UiEvent(doc = "User tapped on 'Turn off work apps' button in all apps window.")
603         LAUNCHER_TURN_OFF_WORK_APPS_TAP(839),
604 
605         @UiEvent(doc = "Launcher item drop failed since there was not enough room on the screen.")
606         LAUNCHER_ITEM_DROP_FAILED_INSUFFICIENT_SPACE(872),
607 
608         @UiEvent(doc = "User clicks on the search icon on header to launch search in app.")
609         LAUNCHER_ALLAPPS_SEARCHINAPP_LAUNCH(913),
610 
611         @UiEvent(doc = "User is shown the back gesture navigation tutorial step.")
612         LAUNCHER_GESTURE_TUTORIAL_BACK_STEP_SHOWN(959),
613 
614         @UiEvent(doc = "User is shown the home gesture navigation tutorial step.")
615         LAUNCHER_GESTURE_TUTORIAL_HOME_STEP_SHOWN(960),
616 
617         @UiEvent(doc = "User is shown the overview gesture navigation tutorial step.")
618         LAUNCHER_GESTURE_TUTORIAL_OVERVIEW_STEP_SHOWN(961),
619 
620         @UiEvent(doc = "User completed the back gesture navigation tutorial step.")
621         LAUNCHER_GESTURE_TUTORIAL_BACK_STEP_COMPLETED(962),
622 
623         @UiEvent(doc = "User completed the home gesture navigation tutorial step.")
624         LAUNCHER_GESTURE_TUTORIAL_HOME_STEP_COMPLETED(963),
625 
626         @UiEvent(doc = "User completed the overview gesture navigation tutorial step.")
627         LAUNCHER_GESTURE_TUTORIAL_OVERVIEW_STEP_COMPLETED(964),
628 
629         @UiEvent(doc = "User skips the gesture navigation tutorial.")
630         LAUNCHER_GESTURE_TUTORIAL_SKIPPED(965),
631 
632         @UiEvent(doc = "User scrolled on one of the all apps surfaces such as A-Z list, search "
633                 + "result page etc.")
634         LAUNCHER_ALLAPPS_SCROLLED(985),
635 
636         @UiEvent(doc = "User scrolled up on the all apps personal A-Z list.")
637         LAUNCHER_ALLAPPS_PERSONAL_SCROLLED_UP(1287),
638 
639         @UiEvent(doc = "User scrolled down on the all apps personal A-Z list.")
640         LAUNCHER_ALLAPPS_PERSONAL_SCROLLED_DOWN(1288),
641 
642         @UiEvent(doc = "User scrolled on one of the all apps surfaces such as A-Z list, search "
643                 + "result page etc and we don't know the direction since user came back to "
644                 + "original position from which they scrolled.")
645         LAUNCHER_ALLAPPS_SCROLLED_UNKNOWN_DIRECTION(1231),
646 
647         @UiEvent(doc = "User tapped taskbar home button")
648         LAUNCHER_TASKBAR_HOME_BUTTON_TAP(1003),
649 
650         @UiEvent(doc = "User tapped taskbar back button")
651         LAUNCHER_TASKBAR_BACK_BUTTON_TAP(1004),
652 
653         @UiEvent(doc = "User tapped taskbar overview/recents button")
654         LAUNCHER_TASKBAR_OVERVIEW_BUTTON_TAP(1005),
655 
656         @UiEvent(doc = "User tapped taskbar IME switcher button")
657         LAUNCHER_TASKBAR_IME_SWITCHER_BUTTON_TAP(1006),
658 
659         @UiEvent(doc = "User tapped taskbar a11y button")
660         LAUNCHER_TASKBAR_A11Y_BUTTON_TAP(1007),
661 
662         @UiEvent(doc = "User tapped taskbar home button")
663         LAUNCHER_TASKBAR_HOME_BUTTON_LONGPRESS(1008),
664 
665         @UiEvent(doc = "User tapped taskbar back button")
666         LAUNCHER_TASKBAR_BACK_BUTTON_LONGPRESS(1009),
667 
668         @UiEvent(doc = "User tapped taskbar overview/recents button")
669         LAUNCHER_TASKBAR_OVERVIEW_BUTTON_LONGPRESS(1010),
670 
671         @UiEvent(doc = "User tapped taskbar a11y button")
672         LAUNCHER_TASKBAR_A11Y_BUTTON_LONGPRESS(1011),
673 
674         @UiEvent(doc = "Show an 'Undo' snackbar when users dismiss a predicted hotseat item")
675         LAUNCHER_DISMISS_PREDICTION_UNDO(1035),
676 
677         @UiEvent(doc = "User clicked on IME quicksearch button.")
678         LAUNCHER_ALLAPPS_QUICK_SEARCH_WITH_IME(1047),
679 
680         @UiEvent(doc = "User tapped taskbar All Apps button.")
681         LAUNCHER_TASKBAR_ALLAPPS_BUTTON_TAP(1057),
682 
683         @UiEvent(doc = "User long pressed taskbar All Apps button.")
684         LAUNCHER_TASKBAR_ALLAPPS_BUTTON_LONG_PRESS(1607),
685 
686         @UiEvent(doc = "User tapped on Share app system shortcut.")
687         LAUNCHER_SYSTEM_SHORTCUT_APP_SHARE_TAP(1075),
688 
689         @UiEvent(doc = "User has invoked split to right half from an app icon menu")
690         LAUNCHER_APP_ICON_MENU_SPLIT_RIGHT_BOTTOM(1199),
691 
692         @UiEvent(doc = "User has invoked split to left half from an app icon menu")
693         LAUNCHER_APP_ICON_MENU_SPLIT_LEFT_TOP(1200),
694 
695         @UiEvent(doc = "Number of apps in A-Z list (personal and work profile)")
696         LAUNCHER_ALLAPPS_COUNT(1225),
697 
698         @UiEvent(doc = "User has invoked split to right half with a keyboard shortcut.")
699         LAUNCHER_KEYBOARD_SHORTCUT_SPLIT_RIGHT_BOTTOM(1232),
700 
701         @UiEvent(doc = "User has invoked split to left half with a keyboard shortcut.")
702         LAUNCHER_KEYBOARD_SHORTCUT_SPLIT_LEFT_TOP(1233),
703 
704         @UiEvent(doc = "User has invoked split to right half from desktop mode.")
705         LAUNCHER_DESKTOP_MODE_SPLIT_RIGHT_BOTTOM(1412),
706 
707         @UiEvent(doc = "User has invoked split to left half from desktop mode.")
708         LAUNCHER_DESKTOP_MODE_SPLIT_LEFT_TOP(1464),
709 
710         @UiEvent(doc = "User has collapsed the work FAB button by scrolling down in the all apps"
711                 + " work A-Z list.")
712         LAUNCHER_WORK_FAB_BUTTON_COLLAPSE(1276),
713 
714         @UiEvent(doc = "User has collapsed the work FAB button by scrolling up in the all apps"
715                 + " work A-Z list.")
716         LAUNCHER_WORK_FAB_BUTTON_EXTEND(1277),
717 
718         @UiEvent(doc = "User scrolled down on the search result page.")
719         LAUNCHER_ALLAPPS_SEARCH_SCROLLED_DOWN(1285),
720 
721         @UiEvent(doc = "User scrolled up on the search result page.")
722         LAUNCHER_ALLAPPS_SEARCH_SCROLLED_UP(1286),
723 
724         @UiEvent(doc = "User or automatic timeout has hidden transient taskbar.")
725         LAUNCHER_TRANSIENT_TASKBAR_HIDE(1330),
726 
727         @UiEvent(doc = "User has swiped upwards from the gesture handle to show transient taskbar.")
728         LAUNCHER_TRANSIENT_TASKBAR_SHOW(1331),
729 
730         @UiEvent(doc = "User has clicked an app pair and launched directly into split screen.")
731         LAUNCHER_APP_PAIR_LAUNCH(1374),
732 
733         @UiEvent(doc = "User saved an app pair.")
734         LAUNCHER_APP_PAIR_SAVE(1456),
735 
736         @UiEvent(doc = "App launched through pending intent")
737         LAUNCHER_APP_LAUNCH_PENDING_INTENT(1394),
738 
739         @UiEvent(doc = "User long pressed on taskbar divider icon to open popup menu")
740         LAUNCHER_TASKBAR_DIVIDER_MENU_OPEN(1488),
741 
742         @UiEvent(doc = "User long pressed on taskbar divider icon to close popup menu")
743         LAUNCHER_TASKBAR_DIVIDER_MENU_CLOSE(1489),
744 
745         @UiEvent(doc = "User has pinned taskbar using taskbar divider menu")
746         LAUNCHER_TASKBAR_PINNED(1490),
747 
748         @UiEvent(doc = "User has unpinned taskbar using taskbar divider menu")
749         LAUNCHER_TASKBAR_UNPINNED(1491),
750 
751         @UiEvent(doc = "User tapped private space lock button")
752         LAUNCHER_PRIVATE_SPACE_LOCK_TAP(1548),
753 
754         @UiEvent(doc = "User tapped private space unlock button")
755         LAUNCHER_PRIVATE_SPACE_UNLOCK_TAP(1549),
756 
757         @UiEvent(doc = "User tapped private space settings button")
758         LAUNCHER_PRIVATE_SPACE_SETTINGS_TAP(1550),
759 
760         @UiEvent(doc = "User tapped on install to private space system shortcut.")
761         LAUNCHER_PRIVATE_SPACE_INSTALL_SYSTEM_SHORTCUT_TAP(1565),
762 
763         @UiEvent(doc = "User tapped private space install app button.")
764         LAUNCHER_PRIVATE_SPACE_INSTALL_APP_BUTTON_TAP(1605),
765 
766         @UiEvent(doc = "User attempted to create split screen with a widget")
767         LAUNCHER_SPLIT_WIDGET_ATTEMPT(1604),
768 
769         @UiEvent(doc = "User tapped on private space uninstall system shortcut.")
770         LAUNCHER_PRIVATE_SPACE_UNINSTALL_SYSTEM_SHORTCUT_TAP(1608),
771 
772         @UiEvent(doc = "User initiated split selection")
773         LAUNCHER_SPLIT_SELECTION_INITIATED(1618),
774 
775         @UiEvent(doc = "User finished a split selection session")
776         LAUNCHER_SPLIT_SELECTION_COMPLETE(1619),
777 
778         @UiEvent(doc = "User selected both apps for split screen")
779         LAUNCHER_SPLIT_SELECTED_SECOND_APP(1609),
780 
781         @UiEvent(doc = "User exited split selection by going home via swipe, button, or state "
782                 + "transition")
783         LAUNCHER_SPLIT_SELECTION_EXIT_HOME(1610),
784 
785         @UiEvent(doc = "User exited split selection by tapping cancel in split instructions view")
786         LAUNCHER_SPLIT_SELECTION_EXIT_CANCEL_BUTTON(1611),
787 
788         @UiEvent(doc = "User exited split selection when another activity/app came to foreground"
789                 + " after first app had been selected OR if user long-pressed on home. Default exit"
790                 + " metric.")
791         LAUNCHER_SPLIT_SELECTION_EXIT_INTERRUPTED(1612),
792 
793         @UiEvent(doc = "User tapped add widget button in widget sheet.")
794         LAUNCHER_WIDGET_ADD_BUTTON_TAP(1622),
795 
796         @UiEvent(doc = "Number of user installed Private profile apps, shown above separator line")
797         LAUNCHER_PRIVATE_SPACE_USER_INSTALLED_APPS_COUNT(1672),
798 
799         @UiEvent(doc = "Number of preinstalled Private profile apps, shown under separator line")
800         LAUNCHER_PRIVATE_SPACE_PREINSTALLED_APPS_COUNT(1673),
801 
802         @UiEvent(doc = "Private space lock animation started")
803         LAUNCHER_PRIVATE_SPACE_LOCK_ANIMATION_BEGIN(1725),
804 
805         @UiEvent(doc = "Private space lock animation finished")
806         LAUNCHER_PRIVATE_SPACE_LOCK_ANIMATION_END(1726),
807 
808         @UiEvent(doc = "Private space unlock animation started")
809         LAUNCHER_PRIVATE_SPACE_UNLOCK_ANIMATION_BEGIN(1727),
810 
811         @UiEvent(doc = "Private space unlock animation finished")
812         LAUNCHER_PRIVATE_SPACE_UNLOCK_ANIMATION_END(1728),
813 
814         @UiEvent(doc = "User rotates whilst in Overview / RecentsView")
815         LAUNCHER_OVERVIEW_ORIENTATION_CHANGED(1762),
816 
817         @UiEvent(doc = "User launches Overview from 3 button navigation")
818         LAUNCHER_OVERVIEW_SHOW_OVERVIEW_FROM_3_BUTTON(1763),
819 
820         @UiEvent(doc = "User launches Overview from alt+tab keyboard quick switch")
821         LAUNCHER_OVERVIEW_SHOW_OVERVIEW_FROM_KEYBOARD_QUICK_SWITCH(1764),
822 
823         @UiEvent(doc = "User launches Overview from meta+tab keyboard shortcut")
824         LAUNCHER_OVERVIEW_SHOW_OVERVIEW_FROM_KEYBOARD_SHORTCUT(1765),
825 
826         @UiEvent(doc = "User long pressed on the taskbar IME switcher button")
827         LAUNCHER_TASKBAR_IME_SWITCHER_BUTTON_LONGPRESS(1798),
828 
829         @UiEvent(doc = "Failed to launch assistant due to Google assistant not available")
830         LAUNCHER_LAUNCH_ASSISTANT_FAILED_NOT_AVAILABLE(1465),
831 
832         @UiEvent(doc = "Failed to launch assistant due to service error")
833         LAUNCHER_LAUNCH_ASSISTANT_FAILED_SERVICE_ERROR(1466),
834 
835         @UiEvent(doc = "User launched assistant by long-pressing nav handle")
836         LAUNCHER_LAUNCH_ASSISTANT_SUCCESSFUL_NAV_HANDLE(1467),
837 
838         @UiEvent(doc = "Failed to launch due to Contextual Search not available")
839         LAUNCHER_LAUNCH_OMNI_FAILED_NOT_AVAILABLE(1471),
840 
841         @UiEvent(doc = "Failed to launch due to Contextual Search setting disabled")
842         LAUNCHER_LAUNCH_OMNI_FAILED_SETTING_DISABLED(1632),
843 
844         @UiEvent(doc = "User launched Contextual Search by long-pressing home in 3-button mode")
845         LAUNCHER_LAUNCH_OMNI_SUCCESSFUL_HOME(1481),
846 
847         @UiEvent(doc = "User launched Contextual Search by using accessibility System Action")
848         LAUNCHER_LAUNCH_OMNI_SUCCESSFUL_SYSTEM_ACTION(1492),
849 
850         @UiEvent(doc = "User launched Contextual Search by long pressing the meta key")
851         LAUNCHER_LAUNCH_OMNI_SUCCESSFUL_META(1606),
852 
853         @UiEvent(doc = "Contextual Search invocation was attempted over the notification shade")
854         LAUNCHER_LAUNCH_OMNI_ATTEMPTED_OVER_NOTIFICATION_SHADE(1485),
855 
856         @UiEvent(doc = "The Contextual Search all entrypoints toggle value in Settings")
857         LAUNCHER_SETTINGS_OMNI_ALL_ENTRYPOINTS_TOGGLE_VALUE(1633),
858 
859         @UiEvent(doc = "Contextual Search invocation was attempted over the keyguard")
860         LAUNCHER_LAUNCH_OMNI_ATTEMPTED_OVER_KEYGUARD(1501),
861 
862         @UiEvent(doc = "Contextual Search invocation was attempted while splitscreen is active")
863         LAUNCHER_LAUNCH_OMNI_ATTEMPTED_SPLITSCREEN(1505),
864 
865         @UiEvent(doc = "User long press nav handle and a long press runnable was created.")
866         LAUNCHER_OMNI_GET_LONG_PRESS_RUNNABLE(1545),
867 
868         @UiEvent(doc = "User tapped on \"change aspect ratio\" system shortcut.")
869         LAUNCHER_ASPECT_RATIO_SETTINGS_SYSTEM_SHORTCUT_TAP(2219),
870 
871         // One Grid Flags
872         @UiEvent(doc = "User sets the device in Fixed Landscape")
873         FIXED_LANDSCAPE_TOGGLE_ENABLE(2014),
874 
875         @UiEvent(doc = "User sets the device in Fixed Landscape")
876         FIXED_LANDSCAPE_TOGGLE_DISABLED(2020),
877 
878         @UiEvent(doc = "Work utility view expand animation started")
879         LAUNCHER_WORK_UTILITY_VIEW_EXPAND_ANIMATION_BEGIN(2075),
880 
881         @UiEvent(doc = "Work utility view expand animation ended")
882         LAUNCHER_WORK_UTILITY_VIEW_EXPAND_ANIMATION_END(2076),
883 
884         @UiEvent(doc = "Work utility view shrink animation started")
885         LAUNCHER_WORK_UTILITY_VIEW_SHRINK_ANIMATION_BEGIN(2077),
886 
887         @UiEvent(doc = "Work utility view shrink animation ended")
888         LAUNCHER_WORK_UTILITY_VIEW_SHRINK_ANIMATION_END(2078),
889 
890         @UiEvent(doc = "Standard grid migration occurred")
891         LAUNCHER_STANDARD_GRID_MIGRATION(2200),
892 
893         @UiEvent(doc = "Row shift grid migration occurred")
894         LAUNCHER_ROW_SHIFT_GRID_MIGRATION(2201),
895 
896         @UiEvent(doc = "Do standard migration when upgrading to one grid")
897         LAUNCHER_STANDARD_ONE_GRID_MIGRATION(2205),
898 
899         @UiEvent(doc = "Do row shift migration when upgrading to one grid")
900         LAUNCHER_ROW_SHIFT_ONE_GRID_MIGRATION(2206),
901 
902         // ADD MORE
903         ;
904 
905         private final int mId;
906 
LauncherEvent(int id)907         LauncherEvent(int id) {
908             mId = id;
909         }
910 
getId()911         public int getId() {
912             return mId;
913         }
914     }
915 
916     /** Launcher's latency events. */
917     public enum LauncherLatencyEvent implements EventEnum {
918         // Details of below 6 events with prefix of "LAUNCHER_LATENCY_STARTUP_" are discussed in
919         // go/launcher-startup-latency
920         @UiEvent(doc = "The total duration of launcher startup latency.")
921         LAUNCHER_LATENCY_STARTUP_TOTAL_DURATION(1362),
922 
923         @UiEvent(doc = "The duration of launcher activity's onCreate().")
924         LAUNCHER_LATENCY_STARTUP_ACTIVITY_ON_CREATE(1363),
925 
926         @UiEvent(doc =
927                 "The duration to inflate launcher root view in launcher activity's onCreate().")
928         LAUNCHER_LATENCY_STARTUP_VIEW_INFLATION(1364),
929 
930         @UiEvent(doc = "The duration of asynchronous loading workspace")
931         LAUNCHER_LATENCY_STARTUP_WORKSPACE_LOADER_ASYNC(1367),
932 
933         @UiEvent(doc = "Time passed between Contextual Search runnable creation and execution. This"
934                 + " ensures that Recent animations have finished before Contextual Search starts.")
935         LAUNCHER_LATENCY_OMNI_RUNNABLE(1546),
936 
937         @UiEvent(doc = "Time passed between nav handle touch down and cancellation without "
938                 + "triggering Contextual Search")
939         LAUNCHER_LATENCY_CONTEXTUAL_SEARCH_LPNH_ABANDON(2171),
940         ;
941 
942         private final int mId;
943 
LauncherLatencyEvent(int id)944         LauncherLatencyEvent(int id) {
945             mId = id;
946         }
947 
948         @Override
getId()949         public int getId() {
950             return mId;
951         }
952     }
953 
954     /**
955      * Launcher specific ranking related events.
956      */
957     public enum LauncherRankingEvent implements EventEnum {
958 
959         UNKNOWN(0);
960         // ADD MORE
961 
962         private final int mId;
963 
LauncherRankingEvent(int id)964         LauncherRankingEvent(int id) {
965             mId = id;
966         }
967 
getId()968         public int getId() {
969             return mId;
970         }
971     }
972 
973     /**
974      * Helps to construct and log launcher event.
975      */
976     public interface StatsLogger {
977 
978         /**
979          * Sets log fields from provided {@link ItemInfo}.
980          */
withItemInfo(ItemInfo itemInfo)981         default StatsLogger withItemInfo(ItemInfo itemInfo) {
982             return this;
983         }
984 
985 
986         /**
987          * Sets {@link InstanceId} of log message.
988          */
withInstanceId(InstanceId instanceId)989         default StatsLogger withInstanceId(InstanceId instanceId) {
990             return this;
991         }
992 
993         /**
994          * Sets rank field of log message.
995          */
withRank(int rank)996         default StatsLogger withRank(int rank) {
997             return this;
998         }
999 
1000         /**
1001          * Sets source launcher state field of log message.
1002          */
withSrcState(int srcState)1003         default StatsLogger withSrcState(int srcState) {
1004             return this;
1005         }
1006 
1007         /**
1008          * Sets destination launcher state field of log message.
1009          */
withDstState(int dstState)1010         default StatsLogger withDstState(int dstState) {
1011             return this;
1012         }
1013 
1014         /**
1015          * Sets FromState field of log message.
1016          */
withFromState(FromState fromState)1017         default StatsLogger withFromState(FromState fromState) {
1018             return this;
1019         }
1020 
1021         /**
1022          * Sets ToState field of log message.
1023          */
withToState(ToState toState)1024         default StatsLogger withToState(ToState toState) {
1025             return this;
1026         }
1027 
1028         /**
1029          * Sets editText field of log message.
1030          */
withEditText(String editText)1031         default StatsLogger withEditText(String editText) {
1032             return this;
1033         }
1034 
1035         /**
1036          * Sets the final value for container related fields of log message.
1037          *
1038          * By default container related fields are derived from {@link ItemInfo}, this method would
1039          * override those values.
1040          */
withContainerInfo(ContainerInfo containerInfo)1041         default StatsLogger withContainerInfo(ContainerInfo containerInfo) {
1042             return this;
1043         }
1044 
1045         /**
1046          * Sets logging fields from provided {@link SliceItem}.
1047          */
withSliceItem(SliceItem sliceItem)1048         default StatsLogger withSliceItem(SliceItem sliceItem) {
1049             return this;
1050         }
1051 
1052         /**
1053          * Sets logging fields from provided {@link LauncherAtom.Slice}.
1054          */
withSlice(LauncherAtom.Slice slice)1055         default StatsLogger withSlice(LauncherAtom.Slice slice) {
1056             return this;
1057         }
1058 
1059         /**
1060          * Sets cardinality of log message.
1061          */
withCardinality(int cardinality)1062         default StatsLogger withCardinality(int cardinality) {
1063             return this;
1064         }
1065 
1066         /**
1067          * Sets the input type of the log message.
1068          */
withInputType(int inputType)1069         default StatsLogger withInputType(int inputType) {
1070             return this;
1071         }
1072 
1073         /**
1074          * Set the features of the log message.
1075          */
withFeatures(int feature)1076         default StatsLogger withFeatures(int feature) {
1077             return this;
1078         }
1079 
1080         /**
1081          * Set the package name of the log message.
1082          */
withPackageName(@ullable String packageName)1083         default StatsLogger withPackageName(@Nullable String packageName) {
1084             return this;
1085         }
1086 
1087         /**
1088          * Builds the final message and logs it as {@link EventEnum}.
1089          */
log(EventEnum event)1090         default void log(EventEnum event) {
1091         }
1092 
1093         /**
1094          * Builds the final message and logs it to two different atoms, one for
1095          * event tracking and the other for jank tracking.
1096          */
sendToInteractionJankMonitor(EventEnum event, View v)1097         default void sendToInteractionJankMonitor(EventEnum event, View v) {
1098         }
1099     }
1100 
1101     /**
1102      * Helps to construct and log latency event.
1103      */
1104     public interface StatsLatencyLogger {
1105 
1106         /**
1107          * Should be in sync with:
1108          * google3/wireless/android/sysui/aster/asterstats/launcher_event_processed.proto
1109          */
1110         enum LatencyType {
1111             UNKNOWN(0),
1112             // example: launcher restart that happens via daily backup and restore
1113             COLD(1),
1114             HOT(2),
1115             TIMEOUT(3),
1116             FAIL(4),
1117             COLD_USERWAITING(5),
1118             ATOMIC(6),
1119             CONTROLLED(7),
1120             CACHED(8),
1121             // example: device is rebooting via power key or shell command `adb reboot`
1122             COLD_DEVICE_REBOOTING(9),
1123             // Tracking warm startup latency:
1124             // https://developer.android.com/topic/performance/vitals/launch-time#warm
1125             WARM(10);
1126             private final int mId;
1127 
LatencyType(int id)1128             LatencyType(int id) {
1129                 this.mId = id;
1130             }
1131 
getId()1132             public int getId() {
1133                 return mId;
1134             }
1135         }
1136 
1137         /**
1138          * Sets {@link InstanceId} of log message.
1139          */
withInstanceId(InstanceId instanceId)1140         default StatsLatencyLogger withInstanceId(InstanceId instanceId) {
1141             return this;
1142         }
1143 
1144 
1145         /**
1146          * Sets latency of the event.
1147          */
withLatency(long latencyInMillis)1148         default StatsLatencyLogger withLatency(long latencyInMillis) {
1149             return this;
1150         }
1151 
1152         /**
1153          * Sets {@link LatencyType} of log message.
1154          */
withType(LatencyType type)1155         default StatsLatencyLogger withType(LatencyType type) {
1156             return this;
1157         }
1158 
1159         /**
1160          * Sets query length of the event.
1161          */
withQueryLength(int queryLength)1162         default StatsLatencyLogger withQueryLength(int queryLength) {
1163             return this;
1164         }
1165 
1166         /**
1167          * Sets sub event type.
1168          */
withSubEventType(int type)1169         default StatsLatencyLogger withSubEventType(int type) {
1170             return this;
1171         }
1172 
1173 
1174         /** Sets cardinality of the event. */
withCardinality(int cardinality)1175         default StatsLatencyLogger withCardinality(int cardinality) {
1176             return this;
1177         }
1178 
1179         /**
1180          * Sets packageId of log message.
1181          */
withPackageId(int packageId)1182         default StatsLatencyLogger withPackageId(int packageId) {
1183             return this;
1184         }
1185 
1186         /**
1187          * Builds the final message and logs it as {@link EventEnum}.
1188          */
log(EventEnum event)1189         default void log(EventEnum event) {
1190         }
1191     }
1192 
1193     /**
1194      * Helps to construct and log impression event.
1195      */
1196     public interface StatsImpressionLogger {
1197 
1198         enum State {
1199             UNKNOWN(0),
1200             ALLAPPS(1),
1201             SEARCHBOX_WIDGET(2);
1202             private final int mLauncherState;
1203 
State(int id)1204             State(int id) {
1205                 this.mLauncherState = id;
1206             }
1207 
getLauncherState()1208             public int getLauncherState() {
1209                 return mLauncherState;
1210             }
1211         }
1212 
1213         /**
1214          * Sets {@link InstanceId} of log message.
1215          */
withInstanceId(InstanceId instanceId)1216         default StatsImpressionLogger withInstanceId(InstanceId instanceId) {
1217             return this;
1218         }
1219 
1220         /**
1221          * Sets {@link State} of impression event.
1222          */
withState(State state)1223         default StatsImpressionLogger withState(State state) {
1224             return this;
1225         }
1226 
1227         /**
1228          * Sets query length of the event.
1229          */
withQueryLength(int queryLength)1230         default StatsImpressionLogger withQueryLength(int queryLength) {
1231             return this;
1232         }
1233 
1234         /**
1235          * Sets {@link com.android.app.search.ResultType} for the impression event.
1236          */
withResultType(int resultType)1237         default StatsImpressionLogger withResultType(int resultType) {
1238             return this;
1239         }
1240 
1241         /**
1242          * Sets boolean for each of {@link com.android.app.search.ResultType} that indicates
1243          * if this result is above keyboard or not for the impression event.
1244          */
withAboveKeyboard(boolean aboveKeyboard)1245         default StatsImpressionLogger withAboveKeyboard(boolean aboveKeyboard) {
1246             return this;
1247         }
1248 
1249         /**
1250          * Sets uid for each of {@link com.android.app.search.ResultType} that indicates
1251          * package name for the impression event.
1252          */
withUid(int uid)1253         default StatsImpressionLogger withUid(int uid) {
1254             return this;
1255         }
1256 
1257         /**
1258          * Sets result source that indicates the origin of the result for the impression event.
1259          */
withResultSource(int resultSource)1260         default StatsImpressionLogger withResultSource(int resultSource) {
1261             return this;
1262         }
1263 
1264         /**
1265          * Builds the final message and logs it as {@link EventEnum}.
1266          */
log(EventEnum event)1267         default void log(EventEnum event) {
1268         }
1269     }
1270 
1271     /**
1272      * Returns new logger object.
1273      */
logger()1274     public StatsLogger logger() {
1275         StatsLogger logger = createLogger();
1276         if (mInstanceId != null) {
1277             logger.withInstanceId(mInstanceId);
1278         }
1279         return logger;
1280     }
1281 
1282     /**
1283      * Returns new latency logger object.
1284      */
latencyLogger()1285     public StatsLatencyLogger latencyLogger() {
1286         StatsLatencyLogger logger = createLatencyLogger();
1287         if (mInstanceId != null) {
1288             logger.withInstanceId(mInstanceId);
1289         }
1290         return logger;
1291     }
1292 
1293     /**
1294      * Returns new impression logger object.
1295      */
impressionLogger()1296     public StatsImpressionLogger impressionLogger() {
1297         StatsImpressionLogger logger = createImpressionLogger();
1298         if (mInstanceId != null) {
1299             logger.withInstanceId(mInstanceId);
1300         }
1301         return logger;
1302     }
1303 
1304     /**
1305      * Returns a singleton KeyboardStateManager.
1306      */
keyboardStateManager()1307     public KeyboardStateManager keyboardStateManager() {
1308         if (mKeyboardStateManager == null) {
1309             mKeyboardStateManager = new KeyboardStateManager(
1310                     mContext != null ? mContext.getResources().getDimensionPixelSize(
1311                             R.dimen.default_ime_height) : 0);
1312         }
1313         return mKeyboardStateManager;
1314     }
1315 
createLogger()1316     protected StatsLogger createLogger() {
1317         return new StatsLogger() {
1318         };
1319     }
1320 
createLatencyLogger()1321     protected StatsLatencyLogger createLatencyLogger() {
1322         return new StatsLatencyLogger() {
1323         };
1324     }
1325 
createImpressionLogger()1326     protected StatsImpressionLogger createImpressionLogger() {
1327         return new StatsImpressionLogger() {
1328         };
1329     }
1330 
1331     /**
1332      * Sets InstanceId to every new {@link StatsLogger} object returned by {@link #logger()} when
1333      * not-null.
1334      */
withDefaultInstanceId(@ullable InstanceId instanceId)1335     public StatsLogManager withDefaultInstanceId(@Nullable InstanceId instanceId) {
1336         this.mInstanceId = instanceId;
1337         return this;
1338     }
1339 
1340     /**
1341      * Creates a new instance of {@link StatsLogManager} based on provided context.
1342      */
newInstance(Context context)1343     public static StatsLogManager newInstance(Context context) {
1344         return Overrides.getObject(
1345                 StatsLogManager.class, context, R.string.stats_log_manager_class);
1346     }
1347 }
1348