Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(51)

Unified Diff: components/proximity_auth/proximity_auth_system.cc

Issue 2861913002: [EasyUnlock] Fix crash when the same user pod is refocused. (Closed)
Patch Set: [EasyUnlock] Fix crash when the same user pod is refocused. Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/proximity_auth/proximity_auth_system.cc
diff --git a/components/proximity_auth/proximity_auth_system.cc b/components/proximity_auth/proximity_auth_system.cc
index 4b70d6865451dcb677745dc0e52c73833033c9bb..52be76966c2e4a8a7bce4b2fa137e96211b6cba8 100644
--- a/components/proximity_auth/proximity_auth_system.cc
+++ b/components/proximity_auth/proximity_auth_system.cc
@@ -127,17 +127,18 @@ void ProximityAuthSystem::OnScreenDidUnlock(
}
void ProximityAuthSystem::OnFocusedUserChanged(const AccountId& account_id) {
- if (!account_id.is_valid())
- return;
-
// Update the current RemoteDeviceLifeCycle to the focused user.
- if (remote_device_life_cycle_ &&
- remote_device_life_cycle_->GetRemoteDevice().user_id !=
- account_id.GetUserEmail()) {
- PA_LOG(INFO) << "Focused user changed, destroying life cycle for "
- << account_id.Serialize() << ".";
- unlock_manager_->SetRemoteDeviceLifeCycle(nullptr);
- remote_device_life_cycle_.reset();
+ if (remote_device_life_cycle_) {
+ if (remote_device_life_cycle_->GetRemoteDevice().user_id !=
+ account_id.GetUserEmail()) {
+ PA_LOG(INFO) << "Focused user changed, destroying life cycle for "
+ << account_id.Serialize() << ".";
+ unlock_manager_->SetRemoteDeviceLifeCycle(nullptr);
+ remote_device_life_cycle_.reset();
+ } else {
+ PA_LOG(INFO) << "User " << account_id.Serialize() << " already focused.";
Ryan Hansberry 2017/05/09 02:51:43 nit: describe more what happened, e.g. "Refocused
Tim Song 2017/05/10 18:11:16 Done.
+ return;
+ }
}
if (remote_devices_map_.find(account_id) == remote_devices_map_.end() ||

Powered by Google App Engine
This is Rietveld 408576698