Commit bc227842 authored by Ajit Narayanan's avatar Ajit Narayanan Committed by Chromium LUCI CQ

Adds UMA histograms for Select-to-speak actions.

Records how the Select-to-speak actions of sentence/paragraph navigation and exit were triggered (i.e. through button click or keyboard shortcuts).

Bug: 1143814
Change-Id: I17b524d9683f1298ce3cfb4d5fa97fbdc3bc4415
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2602854Reviewed-by: default avatarBrian White <bcwhite@chromium.org>
Reviewed-by: default avatarKatie Dektar <katie@chromium.org>
Reviewed-by: default avatarAkihiro Ota <akihiroota@chromium.org>
Commit-Queue: Ajit Narayanan <ajitnarayanan@google.com>
Cr-Commit-Position: refs/heads/master@{#845774}
parent d59c6969
...@@ -908,6 +908,7 @@ component("ash") { ...@@ -908,6 +908,7 @@ component("ash") {
"system/accessibility/select_to_speak_menu_bubble_controller.h", "system/accessibility/select_to_speak_menu_bubble_controller.h",
"system/accessibility/select_to_speak_menu_view.cc", "system/accessibility/select_to_speak_menu_view.cc",
"system/accessibility/select_to_speak_menu_view.h", "system/accessibility/select_to_speak_menu_view.h",
"system/accessibility/select_to_speak_metrics_utils.h",
"system/accessibility/select_to_speak_speed_bubble_controller.cc", "system/accessibility/select_to_speak_speed_bubble_controller.cc",
"system/accessibility/select_to_speak_speed_bubble_controller.h", "system/accessibility/select_to_speak_speed_bubble_controller.h",
"system/accessibility/select_to_speak_speed_view.cc", "system/accessibility/select_to_speak_speed_view.cc",
......
...@@ -10,8 +10,10 @@ ...@@ -10,8 +10,10 @@
#include "ash/style/ash_color_provider.h" #include "ash/style/ash_color_provider.h"
#include "ash/system/accessibility/floating_menu_button.h" #include "ash/system/accessibility/floating_menu_button.h"
#include "ash/system/accessibility/select_to_speak_constants.h" #include "ash/system/accessibility/select_to_speak_constants.h"
#include "ash/system/accessibility/select_to_speak_metrics_utils.h"
#include "ash/system/tray/tray_constants.h" #include "ash/system/tray/tray_constants.h"
#include "base/bind.h" #include "base/bind.h"
#include "base/metrics/histogram_functions.h"
#include "ui/base/l10n/l10n_util.h" #include "ui/base/l10n/l10n_util.h"
#include "ui/gfx/canvas.h" #include "ui/gfx/canvas.h"
#include "ui/gfx/paint_vector_icon.h" #include "ui/gfx/paint_vector_icon.h"
...@@ -31,6 +33,16 @@ constexpr int kButtonSize = 36; ...@@ -31,6 +33,16 @@ constexpr int kButtonSize = 36;
constexpr int kStopButtonPadding = 14; constexpr int kStopButtonPadding = 14;
constexpr int kSeparatorHeight = 16; constexpr int kSeparatorHeight = 16;
// Histograms in which user action statistics are recorded. These values
// correspond to their respective entries in histograms.xml, so if they are
// changed, please deprecate the corresponding histograms there.
const char kParagraphNavigationMethodHistogramName[] =
"Accessibility.CrosSelectToSpeak.ParagraphNavigationMethod";
const char kSentenceNavigationMethodHistogramName[] =
"Accessibility.CrosSelectToSpeak.SentenceNavigationMethod";
const char kBubbleDismissMethodHistogramName[] =
"Accessibility.CrosSelectToSpeak.BubbleDismissMethod";
SelectToSpeakPanelAction PanelActionForButtonID(int button_id, bool is_paused) { SelectToSpeakPanelAction PanelActionForButtonID(int button_id, bool is_paused) {
auto button_enum = static_cast<SelectToSpeakMenuView::ButtonId>(button_id); auto button_enum = static_cast<SelectToSpeakMenuView::ButtonId>(button_id);
switch (button_enum) { switch (button_enum) {
...@@ -183,23 +195,39 @@ void SelectToSpeakMenuView::OnKeyEvent(ui::KeyEvent* key_event) { ...@@ -183,23 +195,39 @@ void SelectToSpeakMenuView::OnKeyEvent(ui::KeyEvent* key_event) {
switch (key_event->key_code()) { switch (key_event->key_code()) {
case ui::KeyboardCode::VKEY_LEFT: case ui::KeyboardCode::VKEY_LEFT:
action = SelectToSpeakPanelAction::kPreviousSentence; action = SelectToSpeakPanelAction::kPreviousSentence;
base::UmaHistogramEnumeration(
kSentenceNavigationMethodHistogramName,
CrosSelectToSpeakActivationMethod::kKeyboardShortcut);
break; break;
case ui::KeyboardCode::VKEY_RIGHT: case ui::KeyboardCode::VKEY_RIGHT:
action = SelectToSpeakPanelAction::kNextSentence; action = SelectToSpeakPanelAction::kNextSentence;
base::UmaHistogramEnumeration(
kSentenceNavigationMethodHistogramName,
CrosSelectToSpeakActivationMethod::kKeyboardShortcut);
break; break;
case ui::KeyboardCode::VKEY_UP: case ui::KeyboardCode::VKEY_UP:
action = SelectToSpeakPanelAction::kPreviousParagraph; action = SelectToSpeakPanelAction::kPreviousParagraph;
base::UmaHistogramEnumeration(
kParagraphNavigationMethodHistogramName,
CrosSelectToSpeakActivationMethod::kKeyboardShortcut);
break; break;
case ui::KeyboardCode::VKEY_DOWN: case ui::KeyboardCode::VKEY_DOWN:
action = SelectToSpeakPanelAction::kNextParagraph; action = SelectToSpeakPanelAction::kNextParagraph;
base::UmaHistogramEnumeration(
kParagraphNavigationMethodHistogramName,
CrosSelectToSpeakActivationMethod::kKeyboardShortcut);
break; break;
case ui::KeyboardCode::VKEY_ESCAPE: case ui::KeyboardCode::VKEY_ESCAPE:
action = SelectToSpeakPanelAction::kExit; action = SelectToSpeakPanelAction::kExit;
base::UmaHistogramEnumeration(
kBubbleDismissMethodHistogramName,
CrosSelectToSpeakActivationMethod::kKeyboardShortcut);
break; break;
default: default:
// Unhandled key. // Unhandled key.
return; return;
} }
delegate_->OnActionSelected(action); delegate_->OnActionSelected(action);
key_event->SetHandled(); key_event->SetHandled();
key_event->StopPropagation(); key_event->StopPropagation();
...@@ -229,10 +257,35 @@ void SelectToSpeakMenuView::SetSpeedButtonToggled(bool toggled) { ...@@ -229,10 +257,35 @@ void SelectToSpeakMenuView::SetSpeedButtonToggled(bool toggled) {
void SelectToSpeakMenuView::OnButtonPressed(views::Button* sender) { void SelectToSpeakMenuView::OnButtonPressed(views::Button* sender) {
SelectToSpeakPanelAction action = SelectToSpeakPanelAction action =
PanelActionForButtonID(sender->GetID(), is_paused_); PanelActionForButtonID(sender->GetID(), is_paused_);
switch (action) {
case SelectToSpeakPanelAction::kPreviousParagraph:
ABSL_FALLTHROUGH_INTENDED;
case SelectToSpeakPanelAction::kNextParagraph:
base::UmaHistogramEnumeration(
kParagraphNavigationMethodHistogramName,
CrosSelectToSpeakActivationMethod::kMenuButton);
break;
case SelectToSpeakPanelAction::kPreviousSentence:
ABSL_FALLTHROUGH_INTENDED;
case SelectToSpeakPanelAction::kNextSentence:
base::UmaHistogramEnumeration(
kSentenceNavigationMethodHistogramName,
CrosSelectToSpeakActivationMethod::kMenuButton);
break;
case SelectToSpeakPanelAction::kExit:
base::UmaHistogramEnumeration(
kBubbleDismissMethodHistogramName,
CrosSelectToSpeakActivationMethod::kMenuButton);
break;
default:
break; // Nothing to record
}
delegate_->OnActionSelected(action); delegate_->OnActionSelected(action);
} }
BEGIN_METADATA(SelectToSpeakMenuView, views::BoxLayoutView) BEGIN_METADATA(SelectToSpeakMenuView, views::BoxLayoutView)
END_METADATA END_METADATA
} // namespace ash } // namespace ash
\ No newline at end of file
// Copyright 2021 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef ASH_SYSTEM_ACCESSIBILITY_SELECT_TO_SPEAK_METRICS_UTILS_H_
#define ASH_SYSTEM_ACCESSIBILITY_SELECT_TO_SPEAK_METRICS_UTILS_H_
namespace ash {
// How the user performs an action, including canceling or navigating between
// paragraphs and sentences in Select-to-speak. This is recorded in histograms
// |CrosSelectToSpeak.ParagraphNavigationMethod|,
// |CrosSelectToSpeak.SentenceNavigationMethod|, and
// |CrosSelectToSpeak.BubbleDismissMethod|. These values correspond to
// CrosSelectToSpeakActivationMethod in enums.xml, so should not be
// changed. New values should be added at the end.
enum class CrosSelectToSpeakActivationMethod {
kUnknown = 0,
kMenuButton = 1,
kKeyboardShortcut = 2,
kMaxValue = kKeyboardShortcut
};
} // namespace ash
#endif // ASH_SYSTEM_ACCESSIBILITY_SELECT_TO_SPEAK_METRICS_UTILS_H_
...@@ -14674,6 +14674,12 @@ metrics consent we also won't be able to send UMA metrics. --> ...@@ -14674,6 +14674,12 @@ metrics consent we also won't be able to send UMA metrics. -->
<int value="2" label="Finished with &quot;Keep Exploring&quot; button"/> <int value="2" label="Finished with &quot;Keep Exploring&quot; button"/>
</enum> </enum>
<enum name="CrosSelectToSpeakActivationMethod">
<int value="0" label="Unknown"/>
<int value="1" label="Canceled with menu button"/>
<int value="2" label="Canceled with keyboard shortcut"/>
</enum>
<enum name="CrosSelectToSpeakOverrideSpeechRateMultiplier"> <enum name="CrosSelectToSpeakOverrideSpeechRateMultiplier">
<int value="50" label="0.5"/> <int value="50" label="0.5"/>
<int value="100" label="1.0"/> <int value="100" label="1.0"/>
...@@ -328,6 +328,17 @@ reviews. Googlers can read more about this at go/gwsq-gerrit. ...@@ -328,6 +328,17 @@ reviews. Googlers can read more about this at go/gwsq-gerrit.
</summary> </summary>
</histogram> </histogram>
<histogram name="Accessibility.CrosSelectToSpeak.BubbleDismissMethod"
enum="CrosSelectToSpeakActivationMethod" expires_after="2021-11-30">
<owner>ajitnarayanan@google.com</owner>
<owner>chrome-a11y-core@google.com</owner>
<summary>
When Select-to-speak is active, the user can dismiss the bubble menu in
multiple ways: by clicking the cancel button on the Select-to-speak menu or
using keyboard shortcuts. Track the methods here.
</summary>
</histogram>
<histogram name="Accessibility.CrosSelectToSpeak.NavigationControls" <histogram name="Accessibility.CrosSelectToSpeak.NavigationControls"
enum="BooleanEnabled" expires_after="2021-11-30"> enum="BooleanEnabled" expires_after="2021-11-30">
<owner>ajitnarayanan@google.com</owner> <owner>ajitnarayanan@google.com</owner>
...@@ -353,6 +364,28 @@ reviews. Googlers can read more about this at go/gwsq-gerrit. ...@@ -353,6 +364,28 @@ reviews. Googlers can read more about this at go/gwsq-gerrit.
</summary> </summary>
</histogram> </histogram>
<histogram name="Accessibility.CrosSelectToSpeak.ParagraphNavigationMethod"
enum="CrosSelectToSpeakActivationMethod" expires_after="2021-11-30">
<owner>ajitnarayanan@google.com</owner>
<owner>chrome-a11y-core@google.com</owner>
<summary>
When Select-to-speak is active, the user can navigate between paragraphs in
multiple ways: by clicking the navigation buttons on the Select-to-speak
menu or using keyboard shortcuts. Track the methods here.
</summary>
</histogram>
<histogram name="Accessibility.CrosSelectToSpeak.SentenceNavigationMethod"
enum="CrosSelectToSpeakActivationMethod" expires_after="2021-11-30">
<owner>ajitnarayanan@google.com</owner>
<owner>chrome-a11y-core@google.com</owner>
<summary>
When Select-to-speak is active, the user can navigate between sentences in
multiple ways: by clicking the navigation buttons on the Select-to-speak
menu or using keyboard shortcuts. Track the methods here.
</summary>
</histogram>
<histogram name="Accessibility.CrosSelectToSpeak.StartSpeechMethod" <histogram name="Accessibility.CrosSelectToSpeak.StartSpeechMethod"
enum="CrosSelectToSpeakStartSpeechMethod" expires_after="2021-06-20"> enum="CrosSelectToSpeakStartSpeechMethod" expires_after="2021-06-20">
<owner>katie@chromium.org</owner> <owner>katie@chromium.org</owner>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment