[go: nahoru, domu]

[CrOS] Speculative fix for the Lock Screen Crash

My theory is that authentication_stage_ was not reset during the
previous unlock attempt. I suggest it could be a race between for
example password and fingerprint unlock.
In this CL we reset the authentication_stage_ whenever the Lock/Login
screen is hidden.

Bug: 1184728
Change-Id: I5b22853db16ebd92b836111e089b03048594ecd0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2744581
Commit-Queue: Roman Sorokin [CET] <rsorokin@chromium.org>
Commit-Queue: Denis Kuznetsov [CET] <antrim@chromium.org>
Auto-Submit: Roman Sorokin [CET] <rsorokin@chromium.org>
Reviewed-by: Denis Kuznetsov [CET] <antrim@chromium.org>
Cr-Commit-Position: refs/heads/master@{#861169}
diff --git a/ash/login/login_screen_controller.cc b/ash/login/login_screen_controller.cc
index ec1d56b..048a2cf 100644
--- a/ash/login/login_screen_controller.cc
+++ b/ash/login/login_screen_controller.cc
@@ -387,11 +387,13 @@
 }
 
 void LoginScreenController::ShowLockScreen() {
+  CHECK(!LockScreen::HasInstance());
   OnShow();
   LockScreen::Show(LockScreen::ScreenType::kLock);
 }
 
 void LoginScreenController::ShowLoginScreen() {
+  CHECK(!LockScreen::HasInstance());
   // Login screen can only be used during login.
   session_manager::SessionState session_state =
       Shell::Get()->session_controller()->GetSessionState();
@@ -478,6 +480,13 @@
   client_->OnFocusLeavingSystemTray(reverse);
 }
 
+void LoginScreenController::OnLockScreenDestroyed() {
+  DCHECK_EQ(authentication_stage_, AuthenticationStage::kIdle);
+
+  // Still handle it to avoid crashes during Login/Lock/Unlock flows.
+  authentication_stage_ = AuthenticationStage::kIdle;
+}
+
 void LoginScreenController::NotifyLoginScreenShown() {
   if (!client_)
     return;