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

Unified Diff: components/proximity_auth/unlock_manager_impl.cc

Issue 2951223002: [EasyUnlock] Display a timeout state when the device isn't connected after a long time. (Closed)
Patch Set: fix test Created 3 years, 5 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/unlock_manager_impl_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/proximity_auth/unlock_manager_impl.cc
diff --git a/components/proximity_auth/unlock_manager_impl.cc b/components/proximity_auth/unlock_manager_impl.cc
index 92afbacee4338f8f51a3897338f6f18cf1d18196..c2af9d1cd1d8a5ce845ac0a3874a055cc8f5507a 100644
--- a/components/proximity_auth/unlock_manager_impl.cc
+++ b/components/proximity_auth/unlock_manager_impl.cc
@@ -247,9 +247,6 @@ void UnlockManagerImpl::OnScreenDidUnlock(
void UnlockManagerImpl::OnFocusedUserChanged(const AccountId& account_id) {}
void UnlockManagerImpl::OnScreenLockedOrUnlocked(bool is_locked) {
- // TODO(tengs): Chrome will only start connecting to the phone when
- // the screen is locked, for privacy reasons. We should reinvestigate
- // this behaviour if we want automatic locking.
if (is_locked && bluetooth_adapter_ && bluetooth_adapter_->IsPowered() &&
life_cycle_ &&
life_cycle_->GetState() ==
@@ -351,8 +348,11 @@ void UnlockManagerImpl::OnGotSignInChallenge(const std::string& challenge) {
}
ScreenlockState UnlockManagerImpl::GetScreenlockState() {
- if (!life_cycle_ ||
- life_cycle_->GetState() == RemoteDeviceLifeCycle::State::STOPPED)
+ if (!life_cycle_)
+ return ScreenlockState::INACTIVE;
+
+ RemoteDeviceLifeCycle::State life_cycle_state = life_cycle_->GetState();
+ if (life_cycle_state == RemoteDeviceLifeCycle::State::STOPPED)
return ScreenlockState::INACTIVE;
if (!bluetooth_adapter_ || !bluetooth_adapter_->IsPowered())
@@ -361,17 +361,19 @@ ScreenlockState UnlockManagerImpl::GetScreenlockState() {
if (IsUnlockAllowed())
return ScreenlockState::AUTHENTICATED;
- if (life_cycle_->GetState() ==
- RemoteDeviceLifeCycle::State::AUTHENTICATION_FAILED)
+ if (life_cycle_state == RemoteDeviceLifeCycle::State::AUTHENTICATION_FAILED)
return ScreenlockState::PHONE_NOT_AUTHENTICATED;
- if (is_waking_up_ ||
- life_cycle_->GetState() == RemoteDeviceLifeCycle::State::AUTHENTICATING ||
- life_cycle_->GetState() ==
- RemoteDeviceLifeCycle::State::FINDING_CONNECTION)
+ if (is_waking_up_)
return ScreenlockState::BLUETOOTH_CONNECTING;
Messenger* messenger = GetMessenger();
+
+ // Show a timeout state if we can not connect to the remote device in a
+ // reasonable amount of time.
+ if (!is_waking_up_ && !messenger)
+ return ScreenlockState::NO_PHONE;
+
if (screenlock_type_ == ProximityAuthSystem::SIGN_IN && messenger &&
!messenger->SupportsSignIn())
return ScreenlockState::PHONE_UNSUPPORTED;
« no previous file with comments | « no previous file | components/proximity_auth/unlock_manager_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698