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
|
// Copyright 2024 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_ASH_ARC_INPUT_OVERLAY_ARC_INPUT_OVERLAY_METRICS_H_
#define CHROME_BROWSER_ASH_ARC_INPUT_OVERLAY_ARC_INPUT_OVERLAY_METRICS_H_
#include <string>
#include "chrome/browser/ash/arc/input_overlay/constants.h"
namespace arc::input_overlay {
inline constexpr char kEditingListFunctionTriggeredHistogram[] =
"EditingListFunctionTriggered";
inline constexpr char kButtonOptionsMenuFunctionTriggeredHistogram[] =
"ButtonOptionsMenuFunctionTriggered";
inline constexpr char kEditDeleteMenuFunctionTriggeredHistogram[] =
"EditDeleteMenuFuctionTriggered";
inline constexpr char kToggleWithMappingSourceHistogram[] =
"ToggleWithMappingSource";
inline constexpr char kPlayGameWithGameControlsHistogram[] =
"PlayGameWithGameControls";
inline constexpr char kToggleOnHistogramName[] = "On";
inline constexpr char kToggleOffHistogramName[] = "Off";
inline constexpr char kFeatureHistogramName[] = "Feature";
inline constexpr char kHintHistogramName[] = "Hint";
inline constexpr char kGameControlsHistogramSeparator[] = ".";
// This enum should be kept in sync with the
// `GameControlsButtonOptionsMenuFunction` in
// tools/metrics/histograms/enums.xml.
enum class ButtonOptionsMenuFunction {
kOptionSingleButton,
kOptionJoystick,
kEditLabelFocused,
kKeyAssigned,
kDone,
kDelete,
kMaxValue = kDelete,
};
// This enum should be kept in sync with the
// `GameControlsEditDeleteMenuFunction` in
// tools/metrics/histograms/enums.xml.
enum class EditDeleteMenuFunction {
kEdit,
kDelete,
kMaxValue = kDelete,
};
// This enum should be kept in sync with the `GameControlsEditingListFunction`
// in tools/metrics/histograms/enums.xml.
enum class EditingListFunction {
kAdd,
kDone,
kHoverListItem,
kPressListItem,
kEditLabelFocused,
kKeyAssigned,
kMaxValue = kKeyAssigned,
};
// This enum should be kept in sync with the `GameControlsMappingSource`
// in tools/metrics/histograms/enums.xml.
enum class MappingSource {
kEmpty,
// Only pre-defined default mapping. May include position change.
kDefault,
// Only user-added mapping.
kUserAdded,
// Includes default and user-added mapping.
kDefaultAndUserAdded,
kMaxValue = kDefaultAndUserAdded,
};
// This enum should be kept in sync with the `GameControlsToggleFunction`
// in tools/metrics/histograms/enums.xml.
enum class GameControlsToggleFunction {
kFeature,
kMappingHint,
kMaxValue = kMappingHint,
};
std::string BuildGameControlsHistogramName(const std::string& name);
std::string BuildGameControlsUkmEventName(const std::string& name);
// Records whether the feature is on or off.
void RecordInputOverlayFeatureState(const std::string& package_name,
bool enable);
// Records whether the mapping hint is on or off.
void RecordInputOverlayMappingHintState(const std::string& package_name,
bool enable);
// Records whether the overlay is customized.
void RecordInputOverlayCustomizedUsage(const std::string& package_name);
// Record when finishing action dragging or releasing arrow key.
void RecordInputOverlayActionReposition(const std::string& package_name,
RepositionType reposition_type,
InputOverlayWindowStateType state_type);
// Record when finishing menu entry dragging or releasing arrow key.
void RecordInputOverlayMenuEntryReposition(
const std::string& package_name,
RepositionType reposition_type,
InputOverlayWindowStateType state_type);
// Record when finishing button group dragging or releasing arrow key.
void RecordInputOverlayButtonGroupReposition(
const std::string& package_name,
RepositionType reposition_type,
InputOverlayWindowStateType state_type);
void RecordEditingListFunctionTriggered(const std::string& package_name,
EditingListFunction function);
void RecordButtonOptionsMenuFunctionTriggered(
const std::string& package_name,
ButtonOptionsMenuFunction function);
void RecordEditDeleteMenuFunctionTriggered(const std::string& package_name,
EditDeleteMenuFunction function);
// Records feature toggle data if `is_feature` is true. Otherwise, records the
// hint toggle data.
void RecordToggleWithMappingSource(const std::string& package_name,
bool is_feature,
bool is_on,
MappingSource source);
// Records whether the game was played with the Game Controls feature. This
// event is logged once per game session.
// - If the user uses Game Controls for the first time in a session,
// `played_with_game_controls` is set to true.
// - Otherwise, the event is logged when the game shuts down, with
// `played_with_game_controls` set to false.
void RecordPlayGameWithGameControls(const std::string& package_name,
bool played_with_game_controls);
} // namespace arc::input_overlay
#endif // CHROME_BROWSER_ASH_ARC_INPUT_OVERLAY_ARC_INPUT_OVERLAY_METRICS_H_
|