Commit 48397cb3 authored by Ryan Hansberry's avatar Ryan Hansberry Committed by Commit Bot

[SmartLock] Don't record SignIn metric in multi-signin context.

EasyUnlockServiceSignin assumes that it is called in a signin context,
but in this particular codepath, ExistingUserController was calling
it in a multi-signin context. In that multi-signin context, the
EasyUnlockServiceSignin object being grabbed was already shut down,
with deleted members -- its use caused a segfault. This CL makes that
assumption clear and only uses EasyUnlockServiceSignin in a signin
context.

Also add check in EasyUnlockServiceSignIn::IsEnabled() that
|pref_manager| is valid.

Bug: 971202
Fix: 971202

Change-Id: Iccc86faaef74ac882bda34fbdde5e5c26394ceea
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1648674
Commit-Queue: Ryan Hansberry <hansberry@chromium.org>
Reviewed-by: default avatarKyle Horimoto <khorimoto@chromium.org>
Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Auto-Submit: Ryan Hansberry <hansberry@chromium.org>
Cr-Commit-Position: refs/heads/master@{#667304}
parent ba2cbf5e
......@@ -411,6 +411,8 @@ void EasyUnlockServiceSignin::OnScreenDidUnlock(
? SmartLockMetricsRecorder::SmartLockAuthMethodChoice::kSmartLock
: SmartLockMetricsRecorder::SmartLockAuthMethodChoice::kOther);
// TODO(crbug.com/972156): A KeyedService shutting itself seems dangerous;
// look into other ways to "reset state" besides this.
Shutdown();
}
......
......@@ -206,8 +206,14 @@ void TransferHttpAuthCaches() {
&TransferHttpAuthCacheToSystemNetworkContext, completion_callback));
}
// Record UMA for password login of regular user when Easy sign-in is enabled.
// Record UMA for password login of regular user when Signin with Smart Lock is
// enabled. Excludes signins in the multi-signin context; only records for the
// signin screen context.
void RecordPasswordLoginEvent(const UserContext& user_context) {
// If a user is already logged in, this is a multi-signin attempt. Disregard.
if (session_manager::SessionManager::Get()->IsInSecondaryLoginScreen())
return;
EasyUnlockService* easy_unlock_service =
EasyUnlockService::Get(ProfileHelper::GetSigninProfile());
if (user_context.GetUserType() == user_manager::USER_TYPE_REGULAR &&
......
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