LoginScreen: Allow destroying lock screen when authentication not idle
This CL removes incorrect DCHECK which assumes the lock screen is only
destructed when the authentication process is fully completed.
Allowing non-kIdle stages won't break the behavior since it anyway
restarts ui.
This DCHECK is added a part of debug log for speculative fix
(https://chromium-review.googlesource.com/c/chromium/src/+/2744581),
and was not accurate.
Bug: b:280250064
Change-Id: I2b1eeac4ea2621beb8f8a9ccc035dbb0e3b7e454
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4733692
Commit-Queue: Eriko Kurimoto <elkurin@chromium.org>
Reviewed-by: Denis Kuznetsov <antrim@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1179426}
diff --git a/ash/login/login_screen_controller.cc b/ash/login/login_screen_controller.cc
index e491723..24aa91b 100644
--- a/ash/login/login_screen_controller.cc
+++ b/ash/login/login_screen_controller.cc
@@ -501,7 +501,12 @@
}
void LoginScreenController::OnLockScreenDestroyed() {
- DCHECK_EQ(authentication_stage_, AuthenticationStage::kIdle);
+ // TODO(b/280250064): Make sure allowing this condition won't break
+ // LoginScreenController logic.
+ if (authentication_stage_ != AuthenticationStage::kIdle) {
+ LOG(WARNING) << "Lock screen is destroyed while the authentication stage: "
+ << authentication_stage_;
+ }
// Still handle it to avoid crashes during Login/Lock/Unlock flows.
authentication_stage_ = AuthenticationStage::kIdle;
@@ -515,4 +520,16 @@
client_->OnLoginScreenShown();
}
+std::ostream& operator<<(std::ostream& ostream,
+ LoginScreenController::AuthenticationStage stage) {
+ switch (stage) {
+ case LoginScreenController::AuthenticationStage::kIdle:
+ return ostream << "kIdle";
+ case LoginScreenController::AuthenticationStage::kDoAuthenticate:
+ return ostream << "kDoAuthenticate";
+ case LoginScreenController::AuthenticationStage::kUserCallback:
+ return ostream << "kUserCallback";
+ }
+}
+
} // namespace ash