1 // Copyright 2018 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef ASH_APP_LIST_APP_LIST_METRICS_H_ 6 #define ASH_APP_LIST_APP_LIST_METRICS_H_ 7 8 #include "ash/app_list/app_list_export.h" 9 #include "ash/public/cpp/app_list/app_list_types.h" 10 #include "base/time/time.h" 11 #include "ui/events/event.h" 12 13 namespace ash { 14 15 class AppListModel; 16 class SearchModel; 17 class SearchResult; 18 19 // The UMA histogram that logs the input latency from input event to the 20 // representation time of the shown launcher UI. 21 constexpr char kAppListShowInputLatencyHistogram[] = 22 "Apps.AppListShow.InputLatency"; 23 24 // The UMA histogram that logs the input latency from input event to the 25 // representation time of the dismissed launcher UI. 26 constexpr char kAppListHideInputLatencyHistogram[] = 27 "Apps.AppListHide.InputLatency"; 28 29 // The UMA histogram that logs different ways to move an app in app list's apps 30 // grid. 31 constexpr char kAppListAppMovingType[] = "Apps.AppListAppMovingType"; 32 33 // The UMA histogram that logs the creation time of the AppListView. 34 constexpr char kAppListCreationTimeHistogram[] = "Apps.AppListCreationTime"; 35 36 // The UMA histogram that logs usage of state transitions in the new 37 // app list UI. 38 constexpr char kAppListStateTransitionSourceHistogram[] = 39 "Apps.AppListStateTransitionSource"; 40 41 // The UMA histogram that logs the source of root app grid page switcher usage 42 // in the app list. 43 constexpr char kAppListPageSwitcherSourceHistogram[] = 44 "Apps.AppListPageSwitcherSource"; 45 46 // The UMA histogram that logs the source of root app grid page switcher usage 47 // in the app list in tablet mode. 48 constexpr char kAppListPageSwitcherSourceHistogramInTablet[] = 49 "Apps.AppListPageSwitcherSource.TabletMode"; 50 51 // The UMA histogram that logs the source of root app grid page switcher usage 52 // in the app list in clamshell mode. 53 constexpr char kAppListPageSwitcherSourceHistogramInClamshell[] = 54 "Apps.AppListPageSwitcherSource.ClamshellMode"; 55 56 // The UMA histogram that logs usage of the original and redesigned folders. 57 constexpr char kAppListFolderOpenedHistogram[] = "Apps.AppListFolderOpened"; 58 59 // The UMA histogram that logs how the app list transitions from peeking to 60 // fullscreen. 61 constexpr char kAppListPeekingToFullscreenHistogram[] = 62 "Apps.AppListPeekingToFullscreenSource"; 63 64 // The UMA histogram that logs how the app list is shown. 65 constexpr char kAppListToggleMethodHistogram[] = "Apps.AppListShowSource"; 66 67 // The UMA histogram that logs the index launched item in the results list and 68 // the query length. 69 constexpr char kAppListResultLaunchIndexAndQueryLength[] = 70 "Apps.AppListResultLaunchIndexAndQueryLength"; 71 72 // The UMA histogram that logs if the query that introduces a launch of an item 73 // in the results list is empty or not. 74 constexpr char kAppListResultLaunchIsEmptyQuery[] = 75 "Apps.AppListResultLaunchIsEmptyQuery"; 76 77 // The UMA histogram that logs the presence or absence of Drive QuickAccess 78 // search results in the zero-state results list. Differentiates between results 79 // existing in the model's results list, but not being displayed in the view. 80 constexpr char kDriveQuickAccessResultPresence[] = 81 "Apps.AppListDriveQuickAccessProvider.ResultPresence"; 82 83 // The UMA histogram that logs smoothness of folder show/hide animation. 84 constexpr char kFolderShowHideAnimationSmoothness[] = 85 "Apps.AppListFolder.ShowHide.AnimationSmoothness"; 86 87 // The UMA histogram that logs which page gets opened by the user. 88 constexpr char kPageOpenedHistogram[] = "Apps.AppListPageOpened"; 89 90 // The UMA histogram that logs how many apps users have in folders. 91 constexpr char kNumberOfAppsInFoldersHistogram[] = 92 "Apps.AppsInFolders.FullscreenAppListEnabled"; 93 94 // The UMA histogram that logs how many folders users have. 95 constexpr char kNumberOfFoldersHistogram[] = "Apps.NumberOfFolders"; 96 97 // The UMA histogram that logs how many pages users have in top level apps grid. 98 constexpr char kNumberOfPagesHistogram[] = "Apps.NumberOfPages"; 99 100 // The UMA histogram that logs how many pages with empty slots users have in top 101 // level apps grid. 102 constexpr char kNumberOfPagesNotFullHistogram[] = "Apps.NumberOfPagesNotFull"; 103 104 // The UMA histogram that logs the type of search result opened. 105 constexpr char kSearchResultOpenDisplayTypeHistogram[] = 106 "Apps.AppListSearchResultOpenDisplayType"; 107 108 // The UMA histogram that logs how long the search query was when a result was 109 // opened. 110 constexpr char kSearchQueryLength[] = "Apps.AppListSearchQueryLength"; 111 112 // The UMA histogram that logs how long the search query was when a result was 113 // opened in clamshell mode. 114 constexpr char kSearchQueryLengthInClamshell[] = 115 "Apps.AppListSearchQueryLength.ClamshellMode"; 116 117 // The UMA histogram that logs how long the search query was when a result was 118 // opened in tablet mode. 119 constexpr char kSearchQueryLengthInTablet[] = 120 "Apps.AppListSearchQueryLength.TabletMode"; 121 122 // The different ways to create a new page in the apps grid. These values are 123 // written to logs. New enum values can be added, but existing enums must never 124 // be renumbered or deleted and reused. 125 enum class AppListPageCreationType { 126 kDraggingApp = 0, 127 kMovingAppWithKeyboard = 1, 128 kSyncOrInstall = 2, 129 kMaxValue = kSyncOrInstall, 130 }; 131 132 // These are used in histograms, do not remove/renumber entries. If you're 133 // adding to this enum with the intention that it will be logged, update the 134 // AppListZeroStateSearchResultUserActionType enum listing in 135 // tools/metrics/histograms/enums.xml. 136 enum class ZeroStateSearchResultUserActionType { 137 kRemoveResult = 0, 138 kAppendResult = 1, 139 kMaxValue = kAppendResult, 140 }; 141 142 // These are used in histograms, do not remove/renumber entries. If you're 143 // adding to this enum with the intention that it will be logged, update the 144 // AppListZeroStateResultRemovalConfirmation enum listing in 145 // tools/metrics/histograms/enums.xml. 146 enum class ZeroStateSearchResutRemovalConfirmation { 147 kRemovalConfirmed = 0, 148 kRemovalCanceled = 1, 149 kMaxValue = kRemovalCanceled, 150 }; 151 152 // The different ways that the app list can transition from PEEKING to 153 // FULLSCREEN_ALL_APPS. These values are written to logs. New enum 154 // values can be added, but existing enums must never be renumbered or deleted 155 // and reused. 156 enum AppListPeekingToFullscreenSource { 157 kSwipe = 0, 158 kExpandArrow = 1, 159 kMousepadScroll = 2, 160 kMousewheelScroll = 3, 161 kMaxPeekingToFullscreen = 4, 162 }; 163 164 // The different ways the app list can be shown. These values are written to 165 // logs. New enum values can be added, but existing enums must never be 166 // renumbered or deleted and reused. 167 enum AppListShowSource { 168 kSearchKey = 0, 169 kShelfButton = 1, 170 kSwipeFromShelf = 2, 171 kTabletMode = 3, 172 kSearchKeyFullscreen = 4, 173 kShelfButtonFullscreen = 5, 174 kAssistantEntryPoint = 6, 175 kScrollFromShelf = 7, 176 kMaxValue = kScrollFromShelf, 177 }; 178 179 // The two versions of folders. These values are written to logs. New enum 180 // values can be added, but existing enums must never be renumbered or deleted 181 // and reused. 182 enum AppListFolderOpened { 183 kOldFolders = 0, 184 kFullscreenAppListFolders = 1, 185 kMaxFolderOpened = 2, 186 }; 187 188 // The valid AppListState transitions. These values are written to logs. New 189 // enum values can be added, but existing enums must never be renumbered or 190 // deleted and reused. If adding a state transition, add it to the switch 191 // statement in AppListView::GetAppListStateTransitionSource. 192 enum AppListStateTransitionSource { 193 kFullscreenAllAppsToClosed = 0, 194 kFullscreenAllAppsToFullscreenSearch = 1, 195 kFullscreenAllAppsToPeeking = 2, 196 kFullscreenSearchToClosed = 3, 197 kFullscreenSearchToFullscreenAllApps = 4, 198 kHalfToClosed = 5, 199 KHalfToFullscreenSearch = 6, 200 kHalfToPeeking = 7, 201 kPeekingToClosed = 8, 202 kPeekingToFullscreenAllApps = 9, 203 kPeekingToHalf = 10, 204 kMaxAppListStateTransition = 11, 205 }; 206 207 // The different ways to change pages in the app list's app grid. These values 208 // are written to logs. New enum values can be added, but existing enums must 209 // never be renumbered or deleted and reused. 210 enum AppListPageSwitcherSource { 211 kTouchPageIndicator = 0, 212 kClickPageIndicator = 1, 213 kSwipeAppGrid = 2, 214 kFlingAppGrid = 3, 215 kMouseWheelScroll = 4, 216 kMousePadScroll = 5, 217 kDragAppToBorder = 6, 218 kMoveAppWithKeyboard = 7, 219 kMouseDrag = 8, 220 kMaxAppListPageSwitcherSource = 9, 221 }; 222 223 // The different ways to move an app in app list's apps grid. These values are 224 // written to logs. New enum values can be added, but existing enums must never 225 // be renumbered or deleted and reused. 226 enum AppListAppMovingType { 227 kMoveByDragIntoFolder = 0, 228 kMoveByDragOutOfFolder = 1, 229 kMoveIntoAnotherFolder = 2, 230 kReorderByDragInFolder = 3, 231 kReorderByDragInTopLevel = 4, 232 kReorderByKeyboardInFolder = 5, 233 kReorderByKeyboardInTopLevel = 6, 234 kMoveByKeyboardIntoFolder = 7, 235 kMoveByKeyboardOutOfFolder = 8, 236 kMaxAppListAppMovingType = 9, 237 }; 238 239 // The presence of Drive QuickAccess search results when updating the zero-state 240 // results list. These values are persisted to logs. Entries should not be 241 // renumbered and numeric values should never be reused. 242 enum class DriveQuickAccessResultPresence { 243 kPresentAndShown = 0, 244 kPresentAndNotShown = 1, 245 kAbsent = 2, 246 kMaxValue = kAbsent 247 }; 248 249 // Different places a search result can be launched from. These values do not 250 // persist to logs, so can be changed as-needed. However, changes should be 251 // reflected in RecordSearchLaunchIndexAndQueryLength(). 252 enum SearchResultLaunchLocation { 253 kResultList = 0, 254 kTileList = 1, 255 }; 256 257 // Different ways to trigger launcher animation in tablet mode. 258 enum TabletModeAnimationTransition { 259 // Release drag to show the launcher (launcher animates the rest of the way). 260 kDragReleaseShow, 261 262 // Release drag to hide the launcher (launcher animates the rest of the way). 263 kDragReleaseHide, 264 265 // Click the Home button in tablet mode. 266 kHomeButtonShow, 267 268 // Activate a window from shelf to hide the launcher in tablet mode. 269 kHideHomeLauncherForWindow, 270 271 // Enter the kFullscreenAllApps state (usually by deactivating the search box) 272 kEnterFullscreenAllApps, 273 274 // Enter the kFullscreenSearch state (usually by activating the search box). 275 kEnterFullscreenSearch, 276 277 // Enter the overview mode in tablet, with overview fading in instead of 278 // sliding (as is the case with kEnterOverviewMode). 279 kFadeInOverview, 280 281 // Exit the overview mode in tablet, with overview fading out instead of 282 // sliding (as is the case with kExitOverviewMode). 283 kFadeOutOverview, 284 }; 285 286 // Parameters to call RecordAppListAppLaunched. Passed to code that does not 287 // directly have access to them, such ash AppListMenuModelAdapter. 288 struct AppLaunchedMetricParams { 289 AppListLaunchedFrom launched_from = AppListLaunchedFrom::kLaunchedFromGrid; 290 AppListLaunchType search_launch_type = AppListLaunchType::kSearchResult; 291 AppListViewState app_list_view_state = AppListViewState::kClosed; 292 bool is_tablet_mode = false; 293 bool home_launcher_shown = false; 294 }; 295 296 void AppListRecordPageSwitcherSourceByEventType(ui::EventType type, 297 bool is_tablet_mode); 298 299 void RecordPageSwitcherSource(AppListPageSwitcherSource source, 300 bool is_tablet_mode); 301 302 void RecordZeroStateSearchResultUserActionHistogram( 303 ZeroStateSearchResultUserActionType action); 304 305 void RecordZeroStateSearchResultRemovalHistogram( 306 ZeroStateSearchResutRemovalConfirmation removal_decision); 307 308 APP_LIST_EXPORT void RecordSearchAbandonWithQueryLengthHistogram( 309 int query_length); 310 311 APP_LIST_EXPORT void RecordSearchResultOpenSource( 312 const SearchResult* result, 313 const AppListModel* model, 314 const SearchModel* search_model); 315 316 APP_LIST_EXPORT void RecordSearchLaunchIndexAndQueryLength( 317 SearchResultLaunchLocation launch_location, 318 int query_length, 319 int suggestion_index); 320 321 APP_LIST_EXPORT void RecordAppListAppLaunched(AppListLaunchedFrom launched_from, 322 AppListViewState app_list_state, 323 bool is_tablet_mode, 324 bool home_launcher_shown); 325 326 APP_LIST_EXPORT bool IsCommandIdAnAppLaunch(int command_id); 327 328 APP_LIST_EXPORT void ReportPaginationSmoothness(bool is_tablet_mode, 329 int smoothness); 330 331 APP_LIST_EXPORT void ReportCardifiedSmoothness(bool is_entering_cardified, 332 int smoothness); 333 334 } // namespace ash 335 336 #endif // ASH_APP_LIST_APP_LIST_METRICS_H_ 337