1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37
   38
   39
   40
   41
   42
   43
   44
   45
   46
   47
   48
   49
   50
   51
   52
   53
   54
   55
   56
   57
   58
   59
   60
   61
   62
   63
   64
   65
   66
   67
   68
   69
   70
   71
   72
   73
   74
   75
   76
   77
   78
   79
   80
   81
   82
   83
   84
   85
   86
   87
   88
   89
   90
   91
   92
   93
   94
   95
   96
   97
   98
   99
  100
  101
  102
  103
  104
  105
  106
  107
  108
  109
  110
  111
  112
  113
  114
  115
  116
  117
  118
  119
  120
  121
  122
  123
  124
  125
  126
  127
  128
  129
  130
  131
  132
  133
  134
  135
  136
  137
  138
  139
  140
  141
  142
  143
  144
  145
  146
  147
  148
  149
  150
  151
  152
  153
  154
  155
  156
  157
  158
  159
  160
  161
  162
  163
  164
  165
  166
  167
  168
  169
  170
  171
  172
  173
  174
  175
  176
  177
  178
  179
  180
  181
  182
  183
  184
  185
  186
  187
  188
  189
  190
  191
  192
  193
  194
  195
  196
  197
  198
  199
  200
  201
  202
  203
  204
  205
  206
  207
  208
  209
  210
  211
  212
  213
  214
  215
  216
  217
  218
  219
  220
  221
  222

ash / system / phonehub / phone_hub_metrics.h [blame]

// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef ASH_SYSTEM_PHONEHUB_PHONE_HUB_METRICS_H_
#define ASH_SYSTEM_PHONEHUB_PHONE_HUB_METRICS_H_

#include "base/time/time.h"
#include "chromeos/ash/components/phonehub/recent_apps_interaction_handler.h"

namespace ash::phone_hub_metrics {

using RecentAppsUiState =
    phonehub::RecentAppsInteractionHandler::RecentAppsUiState;

// Keep in sync with corresponding PhoneHubInterstitialScreenEvent enum in
// //tools/metrics/histograms/metadata/phonehub/enums.xml.
//
// LINT.IfChange(PhoneHubInterstitialScreenEvent)
enum class InterstitialScreenEvent {
  kShown = 0,
  kLearnMore = 1,
  kDismiss = 2,
  kConfirm = 3,
  kMaxValue = kConfirm
};
// LINT.ThenChange(//tools/metrics/histograms/metadata/phonehub/enums.xml:PhoneHubInterstitialScreenEvent)

// Keep in sync with corresponding PhoneHubScreen enum in
// //tools/metrics/histograms/metadata/phonehub/enums.xml. These values are
// persisted to logs. Entries should not be renumbered and numeric values should
// never be reused.
// Note that value 2 and 3 have been deprecated and should not be reused.\
//
// LINT.IfChange(PhoneHubScreen)
enum class Screen {
  kBluetoothOrWifiDisabled = 0,
  kPhoneDisconnected = 1,
  kOnboardingExistingMultideviceUser = 4,
  kOnboardingNewMultideviceUser = 5,
  kPhoneConnected = 6,
  kOnboardingDismissPrompt = 7,
  kInvalid = 8,
  kPhoneConnecting = 9,
  kTetherConnectionPending = 10,
  kMiniLauncher = 11,
  kMaxValue = kMiniLauncher
};
// LINT.ThenChange(//tools/metrics/histograms/metadata/phonehub/enums.xml:PhoneHubScreen)

// Keep in sync with corresponding PhoneHubQuickAction enum in
// //tools/metrics/histograms/metadata/phonehub/enums.xml.
//
// LINT.IfChange(PhoneHubQuickAction)
enum class QuickAction {
  kToggleHotspotOn = 0,
  kToggleHotspotOff,
  kToggleQuietModeOn,
  kToggleQuietModeOff,
  kToggleLocatePhoneOn,
  kToggleLocatePhoneOff,
  kMaxValue = kToggleLocatePhoneOff
};
// LINT.ThenChange(//tools/metrics/histograms/metadata/phonehub/enums.xml:PhoneHubQuickAction)

// Enumeration of possible interactions with a PhoneHub notification. Keep in
// sync with corresponding PhoneHubNotificationInteraction enum in
// //tools/metrics/histograms/metadata/phonehub/enums.xml. Values are persisted
// to logs. Entries should not be renumbered and numeric values should never be
// reused.
//
// LINT.IfChange(PhoneHubNotificationInteraction)
enum class NotificationInteraction {
  kInlineReply = 0,
  kDismiss = 1,
  kMaxValue = kDismiss,
};
// LINT.ThenChange(//tools/metrics/histograms/metadata/phonehub/enums.xml:PhoneHubNotificationInteraction)

// Keep in sync with corresponding PhoneHubCameraRollContentShown enum in
// //tools/metrics/histograms/metadata/phonehub/enums.xml.
//
// LINT.IfChange(PhoneHubCameraRollContentShown)
enum class CameraRollContentShown {
  kContentShown1 = 1,
  kContentShown2 = 2,
  kContentShown3 = 3,
  kContentShown4 = 4,
  kContentShownGTE5 = 5,
  kMaxValue = kContentShownGTE5
};
// LINT.ThenChange(//tools/metrics/histograms/metadata/phonehub/enums.xml:PhoneHubCameraRollContentShown)

// Keep in sync with corresponding PhoneHubCameraRollContentClicked enum in
// //tools/metrics/histograms/metadata/phonehub/enums.xml.
//
// LINT.IfChange(PhoneHubCameraRollContentClicked)
enum class CameraRollContentClicked {
  kContentClicked1 = 11,
  kContentClicked2 = 21,
  kContentClicked3 = 31,
  kContentClicked4 = 41,
  kContentClickedGTE5 = 51,
  kMaxValue = kContentClickedGTE5
};
// LINT.ThenChange(//tools/metrics/histograms/metadata/phonehub/enums.xml:PhoneHubCameraRollContentClicked)

// Keep in sync with corresponding PhoneHubCameraRollContextMenuDownload enum in
// //tools/metrics/histograms/metadata/phonehub/enums.xml.
//
// LINT.IfChange(PhoneHubCameraRollContextMenuDownload)
enum class CameraRollContextMenuDownload {
  kDownload1 = 111,
  kDownload2 = 211,
  kDownload3 = 311,
  kDownload4 = 411,
  kDownloadGTE5 = 511,
  kMaxValue = kDownloadGTE5
};
// LINT.ThenChange(//tools/metrics/histograms/metadata/phonehub/enums.xml:PhoneHubCameraRollContextMenuDownload)

// Keep in sync with corresponding MoreAppsButtonLoadingState enum in
// //tools/metrics/histograms/metadata/phonehub/enums.xml.
//
// LINT.IfChange(MoreAppsButtonLoadingState)
enum class MoreAppsButtonLoadingState {
  kAnimationShown = 0,
  kMoreAppsButtonLoaded = 1,
  kMaxValue = kMoreAppsButtonLoaded
};
// LINT.ThenChange(//tools/metrics/histograms/metadata/phonehub/enums.xml:MoreAppsButtonLoadingState)

// Keep in sync with corresponding RecentAppsViewUiState enum in
// //tools/metrics/histograms/metadata/phonehub/enums.xml.
//
// LINT.IfChange(RecentAppsViewUiState)
enum class RecentAppsViewUiState {
  kLoading = 0,
  kError = 1,
  kApps = 2,
  kMaxValue = kApps,
};
// LINT.ThenChange(//tools/metrics/histograms/metadata/phonehub/enums.xml:RecentAppsViewUiState)

// Keep in sync with MultideviceSetupNudgeInteraction enum in
// //tools/metrics/histograms/metadata/cross_device/enums.xml.
//
// LINT.IfChange(MultideviceSetupNudgeInteraction)
enum class MultideviceSetupNudgeInteraction {
  kNudgeClicked = 0,
  kPhoneHubIconClicked = 1,
  kMaxValue = kPhoneHubIconClicked,
};
// LINT.ThenChange(//tools/metrics/histograms/metadata/cross_device/enums.xml:MultideviceSetupNudgeInteraction)

enum class CameraRollMediaType { kPhoto = 0, kVideo = 1, kMaxValue = kVideo };

// Logs an |event| occurring for the given |interstitial_screen|.
void LogInterstitialScreenEvent(Screen screen, InterstitialScreenEvent event);

// Logs the |screen| when the PhoneHub bubble opens.
void LogScreenOnBubbleOpen(Screen screen);

// Logs the |screen| when the PhoneHub bubble closes.
void LogScreenOnBubbleClose(Screen screen);

// Logs the |screen| when the settings button is clicked.
void LogScreenOnSettingsButtonClicked(Screen screen);

// Logs the |tab_index| of the tab continuation chip that was clicked.
void LogTabContinuationChipClicked(int tab_index);

// Logs a given |quick_action| click.
void LogQuickActionClick(QuickAction quick_action);

// Logs the number of PhoneHub notifications after one is added or removed.
void LogNotificationCount(int count);

// Logs a given |interaction| with a PhoneHub notification.
void LogNotificationInteraction(NotificationInteraction interaction);

// Logs the message length of a PhoneHub notification.
void LogNotificationMessageLength(int length);

// Logs the display of a Camera Roll item at |index|.
void LogCameraRollContentShown(int index, CameraRollMediaType mediaType);

// Logs clicking a Camera Roll item at |index|.
void LogCameraRollContentClicked(int index, CameraRollMediaType mediaType);

// Logs a download of item at |index| from the Camera Roll context menu.
void LogCameraRollContextMenuDownload(int index, CameraRollMediaType mediaType);

// Logs the display of any Camera Roll item. Emits once per opening of bubble.
void LogCameraRollContentPresent();

// Logs if the glimmer animation was shown or not (more apps button was shown
// instead) when Phone Hub is opened.
void LogMoreAppsButtonAnimationOnShow(MoreAppsButtonLoadingState loading_state);

// Logs the time latency from initializing the More Apps button and when we
// receive/load the full apps list.
void LogMoreAppsButtonFullAppsLatency(const base::TimeDelta latency);

// Logs the recent apps UI state when the Phone Hub bubble is opened.
void LogRecentAppsStateOnBubbleOpened(RecentAppsUiState ui_state);

// Logs the latency between showing the loading animation in the Recent Apps
// view to the connection failed error button.
void LogRecentAppsTransitionToFailedLatency(const base::TimeDelta latency);

// Logs the latency between showing the loading animation in the Recent Apps
// view to showing the recent apps icons and more apps button.
void LogRecentAppsTransitionToSuccessLatency(const base::TimeDelta latency);

// Logs the interaction with Multidedevice setup notification when it is
// visible.
void LogMultiDeviceSetupNotificationInteraction();

}  // namespace ash::phone_hub_metrics

#endif  // ASH_SYSTEM_PHONEHUB_PHONE_HUB_METRICS_H_