0

ash: Add a DWC to investigate unexpected LoggedInStateChanged

b/333262357 shows a case that `LoggedInStateChanged` could be
called unexpectedly to start the login animation timeout timer.
Add a DWC to investigate how it happens. This should suppress
the DWC in OnLoginAnimationFinishedTimerFired.

Bug: 333262357
Change-Id: I8d3484a5fce28a423407e7382dd5d7399369c77d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5436995
Commit-Queue: Xiyuan Xia <xiyuan@chromium.org>
Reviewed-by: Hidehiko Abe <hidehiko@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1284617}
This commit is contained in:
Xiyuan Xia
2024-04-09 18:57:45 +00:00
committed by Chromium LUCI CQ
parent 2361871838
commit 3f4974a861
2 changed files with 18 additions and 0 deletions

@ -244,6 +244,7 @@ void LoginUnlockThroughputRecorder::OnAuthSuccess() {
}
void LoginUnlockThroughputRecorder::OnAshRestart() {
is_ash_restart_ = true;
login_animation_finished_timer_.Stop();
if (!post_login_deferred_task_runner_->Started()) {
post_login_deferred_task_runner_->Start();
@ -270,6 +271,20 @@ void LoginUnlockThroughputRecorder::LoggedInStateChanged() {
return;
}
// On ash restart, `SessionManager::CreateSessionForRestart` should happen
// and trigger `LoggedInStateChanged` here to set `user_logged_in_` flag
// before `OnAshRestart` is called. So `is_ash_restart_` should never be true
// here. Otherwise, we have unexpected sequence of events and login metrics
// would not be correctly reported.
//
// It seems somehow happening in b/333262357. Adding a DumpWithoutCrashing
// to capture the offending stack.
// TODO(b/333262357): Remove `DumpWithoutCrashing`.
if (is_ash_restart_) {
base::debug::DumpWithoutCrashing();
return;
}
user_logged_in_ = true;
// Report UserLoggedIn histogram if we had OnAuthSuccess() event previously.

@ -224,6 +224,9 @@ class ASH_EXPORT LoginUnlockThroughputRecorder : public SessionObserver,
// final.
bool first_restored_window_created_ = false;
// Whether ash is restarted (due to crash, or applying flags etc).
bool is_ash_restart_ = false;
std::optional<base::TimeTicks> arc_opt_in_time_;
base::WeakPtr<ui::TotalAnimationThroughputReporter>