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

Unified Diff: components/proximity_auth/proximity_auth_system.cc

Issue 2861913002: [EasyUnlock] Fix crash when the same user pod is refocused. (Closed)
Patch Set: fixes Created 3 years, 7 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
« no previous file with comments | « no previous file | components/proximity_auth/proximity_auth_system_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..3386f14e5123ae06d6bf70001cf14e969924316d 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) << "Refocused on a user who is already focused.";
+ return;
+ }
}
if (remote_devices_map_.find(account_id) == remote_devices_map_.end() ||
« no previous file with comments | « no previous file | components/proximity_auth/proximity_auth_system_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698