Commit ec0ed3dd authored by Alexander Alekseev's avatar Alexander Alekseev Committed by Commit Bot

Chrome OS OOBE: Increase startup sound delay and add UMA metric.

This CL increases OOBE startup sound delay to 4 seconds, and adds UMA metric
on it.

Bug: 848485
Change-Id: I5401a2625634315760906789fcd69afe04d2972c
Reviewed-on: https://chromium-review.googlesource.com/1173014Reviewed-by: default avatarIlya Sherman <isherman@chromium.org>
Reviewed-by: default avatarWenzhao (Colin) Zang <wzang@chromium.org>
Commit-Queue: Alexander Alekseev <alemate@chromium.org>
Cr-Commit-Position: refs/heads/master@{#582866}
parent 91d73d51
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include "base/location.h" #include "base/location.h"
#include "base/logging.h" #include "base/logging.h"
#include "base/macros.h" #include "base/macros.h"
#include "base/metrics/histogram_macros.h"
#include "base/single_thread_task_runner.h" #include "base/single_thread_task_runner.h"
#include "base/strings/string_split.h" #include "base/strings/string_split.h"
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
...@@ -113,7 +114,7 @@ ...@@ -113,7 +114,7 @@
namespace { namespace {
// Maximum delay for startup sound after 'loginPromptVisible' signal. // Maximum delay for startup sound after 'loginPromptVisible' signal.
const int kStartupSoundMaxDelayMs = 2000; const int kStartupSoundMaxDelayMs = 4000;
// URL which corresponds to the login WebUI. // URL which corresponds to the login WebUI.
const char kLoginURL[] = "chrome://oobe/login"; const char kLoginURL[] = "chrome://oobe/login";
...@@ -357,14 +358,6 @@ bool CanPlayStartupSound() { ...@@ -357,14 +358,6 @@ bool CanPlayStartupSound() {
device.type != chromeos::AudioDeviceType::AUDIO_TYPE_OTHER; device.type != chromeos::AudioDeviceType::AUDIO_TYPE_OTHER;
} }
// Returns true if it is too late to play startup sound.
bool StartupSoundOutdated(base::TimeTicks login_prompt_visible_time) {
// Don't try to play startup sound if login prompt has been already visible
// for a long time.
return base::TimeTicks::Now() - login_prompt_visible_time >
base::TimeDelta::FromMilliseconds(kStartupSoundMaxDelayMs);
}
} // namespace } // namespace
namespace chromeos { namespace chromeos {
...@@ -1202,9 +1195,17 @@ void LoginDisplayHostWebUI::PlayStartupSoundIfPossible() { ...@@ -1202,9 +1195,17 @@ void LoginDisplayHostWebUI::PlayStartupSoundIfPossible() {
need_to_play_startup_sound_ = false; need_to_play_startup_sound_ = false;
oobe_startup_sound_played_ = true; oobe_startup_sound_played_ = true;
if (StartupSoundOutdated(login_prompt_visible_time_)) const base::TimeDelta time_since_login_prompt_visible =
return; base::TimeTicks::Now() - login_prompt_visible_time_;
UMA_HISTOGRAM_TIMES("Accessibility.OOBEStartupSoundDelay",
time_since_login_prompt_visible);
// Don't try to play startup sound if login prompt has been already visible
// for a long time.
if (time_since_login_prompt_visible >
base::TimeDelta::FromMilliseconds(kStartupSoundMaxDelayMs)) {
return;
}
AccessibilityManager::Get()->PlayEarcon(SOUND_STARTUP, AccessibilityManager::Get()->PlayEarcon(SOUND_STARTUP,
PlaySoundOption::ALWAYS); PlaySoundOption::ALWAYS);
} }
......
...@@ -347,6 +347,15 @@ uploading your change for review. ...@@ -347,6 +347,15 @@ uploading your change for review.
</summary> </summary>
</histogram> </histogram>
<histogram name="Accessibility.OOBEStartupSoundDelay" units="ms">
<owner>lpalmaro@chromium.org</owner>
<owner>alemate@chromium.org</owner>
<summary>
Delay between login_prompt_visible and Chrome OS OOBE startup sound
playback. Depends on sound subsystem initialization time.
</summary>
</histogram>
<histogram name="Accessibility.State" enum="BooleanEnabled"> <histogram name="Accessibility.State" enum="BooleanEnabled">
<obsolete> <obsolete>
Deprecated 12/2016 in Issue 672205 with the addition of Deprecated 12/2016 in Issue 672205 with the addition of
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