Commit c06d6ca5 authored by Jacob Dufault's avatar Jacob Dufault Committed by Commit Bot

cros: Log authentication stage in LoginScreenController::OnShow.

There was one crash report in this method, but the crash did not seem to include
local variables. Log the value of authentication_stage_ to capture it.

Bug: 820671
Change-Id: I82c25b8a58f0993a9eef94c497c2c3e06c48b255
Reviewed-on: https://chromium-review.googlesource.com/1015880Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Commit-Queue: Jacob Dufault <jdufault@chromium.org>
Cr-Commit-Position: refs/heads/master@{#553372}
parent 053b929f
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include "ash/session/session_controller.h" #include "ash/session/session_controller.h"
#include "ash/shell.h" #include "ash/shell.h"
#include "ash/system/status_area_widget.h" #include "ash/system/status_area_widget.h"
#include "base/debug/alias.h"
#include "base/strings/string_number_conversions.h" #include "base/strings/string_number_conversions.h"
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "chromeos/cryptohome/system_salt_getter.h" #include "chromeos/cryptohome/system_salt_getter.h"
...@@ -87,7 +88,7 @@ void LoginScreenController::AuthenticateUser(const AccountId& account_id, ...@@ -87,7 +88,7 @@ void LoginScreenController::AuthenticateUser(const AccountId& account_id,
OnAuthenticateCallback callback) { OnAuthenticateCallback callback) {
// It is an error to call this function while an authentication is in // It is an error to call this function while an authentication is in
// progress. // progress.
LOG_IF(ERROR, authentication_stage_ == AuthenticationStage::kIdle) LOG_IF(ERROR, authentication_stage_ != AuthenticationStage::kIdle)
<< "Authentication stage is " << static_cast<int>(authentication_stage_); << "Authentication stage is " << static_cast<int>(authentication_stage_);
CHECK_EQ(authentication_stage_, AuthenticationStage::kIdle); CHECK_EQ(authentication_stage_, AuthenticationStage::kIdle);
...@@ -420,7 +421,12 @@ LoginDataDispatcher* LoginScreenController::DataDispatcher() const { ...@@ -420,7 +421,12 @@ LoginDataDispatcher* LoginScreenController::DataDispatcher() const {
void LoginScreenController::OnShow() { void LoginScreenController::OnShow() {
SetSystemTrayVisibility(SystemTrayVisibility::kPrimary); SetSystemTrayVisibility(SystemTrayVisibility::kPrimary);
CHECK_EQ(authentication_stage_, AuthenticationStage::kIdle); if (authentication_stage_ != AuthenticationStage::kIdle) {
AuthenticationStage authentication_stage = authentication_stage_;
base::debug::Alias(&authentication_stage);
LOG(FATAL) << "Unexpected authentication stage "
<< static_cast<int>(authentication_stage_);
}
} }
} // namespace ash } // namespace ash
...@@ -26,6 +26,14 @@ class LoginDataDispatcher; ...@@ -26,6 +26,14 @@ class LoginDataDispatcher;
// LoginScreenClient through mojo. // LoginScreenClient through mojo.
class ASH_EXPORT LoginScreenController : public mojom::LoginScreen { class ASH_EXPORT LoginScreenController : public mojom::LoginScreen {
public: public:
// The current authentication stage. Used to get more verbose logging.
enum class AuthenticationStage {
kIdle,
kGetSystemSalt,
kDoAuthenticate,
kUserCallback,
};
using OnShownCallback = base::OnceCallback<void(bool did_show)>; using OnShownCallback = base::OnceCallback<void(bool did_show)>;
// Callback for authentication checks. |success| is nullopt if an // Callback for authentication checks. |success| is nullopt if an
// authentication check did not run, otherwise it is true/false if auth // authentication check did not run, otherwise it is true/false if auth
...@@ -113,6 +121,10 @@ class ASH_EXPORT LoginScreenController : public mojom::LoginScreen { ...@@ -113,6 +121,10 @@ class ASH_EXPORT LoginScreenController : public mojom::LoginScreen {
// Flushes the mojo pipes - to be used in tests. // Flushes the mojo pipes - to be used in tests.
void FlushForTesting(); void FlushForTesting();
AuthenticationStage authentication_stage() const {
return authentication_stage_;
}
private: private:
using PendingDoAuthenticateUser = using PendingDoAuthenticateUser =
base::OnceCallback<void(const std::string& system_salt)>; base::OnceCallback<void(const std::string& system_salt)>;
...@@ -136,13 +148,6 @@ class ASH_EXPORT LoginScreenController : public mojom::LoginScreen { ...@@ -136,13 +148,6 @@ class ASH_EXPORT LoginScreenController : public mojom::LoginScreen {
// Bindings for users of the LockScreen interface. // Bindings for users of the LockScreen interface.
mojo::BindingSet<mojom::LoginScreen> bindings_; mojo::BindingSet<mojom::LoginScreen> bindings_;
// The current authentication stage. Used to get more verbose logging.
enum class AuthenticationStage {
kIdle,
kGetSystemSalt,
kDoAuthenticate,
kUserCallback,
};
AuthenticationStage authentication_stage_ = AuthenticationStage::kIdle; AuthenticationStage authentication_stage_ = AuthenticationStage::kIdle;
base::ObserverList<LoginScreenControllerObserver> observers_; base::ObserverList<LoginScreenControllerObserver> observers_;
......
...@@ -100,6 +100,14 @@ bool LockScreen::IsShown() { ...@@ -100,6 +100,14 @@ bool LockScreen::IsShown() {
} }
void LockScreen::Destroy() { void LockScreen::Destroy() {
LoginScreenController::AuthenticationStage authentication_stage =
ash::Shell::Get()->login_screen_controller()->authentication_stage();
base::debug::Alias(&authentication_stage);
if (ash::Shell::Get()->login_screen_controller()->authentication_stage() !=
authentication_stage) {
LOG(FATAL) << "Unexpected authentication stage "
<< static_cast<int>(authentication_stage);
}
CHECK_EQ(instance_, this); CHECK_EQ(instance_, this);
// Restore the initial wallpaper bluriness if they were changed. // Restore the initial wallpaper bluriness if they were changed.
......
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