Commit 6c5f20cb authored by Roman Sorokin's avatar Roman Sorokin Committed by Commit Bot

cros fingerprint: Tweak icon and messages

depending on the fingerprint state

Fixed: 936958
Change-Id: If920f13828140f78b765737c881c80eb5afa212c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2035998
Commit-Queue: Roman Sorokin [CET] <rsorokin@chromium.org>
Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#738899}
parent 9df0c398
...@@ -1839,8 +1839,11 @@ This file contains the strings for ash. ...@@ -1839,8 +1839,11 @@ This file contains the strings for ash.
<message name="IDS_ASH_LOGIN_FINGERPRINT_UNLOCK_AUTH_FAILED" desc="Text shown in the user pod to tell user that couldn't unlock because finger is not recognized"> <message name="IDS_ASH_LOGIN_FINGERPRINT_UNLOCK_AUTH_FAILED" desc="Text shown in the user pod to tell user that couldn't unlock because finger is not recognized">
Not recognized Not recognized
</message> </message>
<message name="IDS_ASH_LOGIN_FINGERPRINT_UNLOCK_DISABLED_FROM_TIMEOUT" desc="Text shown when fingerprint has been disabled because it has been too long since the user last used the device"> <message name="IDS_ASH_LOGIN_FINGERPRINT_UNLOCK_PASSWORD_REQUIRED" desc="Text shown when fingerprint has been disabled because it has been too long since the user last used the device">
To unlock, enter your password Password required for more security
</message>
<message name="IDS_ASH_LOGIN_FINGERPRINT_UNLOCK_PIN_OR_PASSWORD_REQUIRED" desc="Text shown when fingerprint has been disabled because it has been too long since the user last used the device">
PIN or password required for more security
</message> </message>
<message name="IDS_ASH_LOGIN_FINGERPRINT_UNLOCK_DISABLED_FROM_ATTEMPTS" desc="Text shown in the user pod to tell user that fingerprint unlock has reached maximum attempt"> <message name="IDS_ASH_LOGIN_FINGERPRINT_UNLOCK_DISABLED_FROM_ATTEMPTS" desc="Text shown in the user pod to tell user that fingerprint unlock has reached maximum attempt">
Too many attempts Too many attempts
......
532906acba025c06dcb3c8ba90a353b662a090d6
\ No newline at end of file
1f24efdc8738ecbbbcfb91883a4468f827b706a3
\ No newline at end of file
9be91ca2a5e9f63c32afd4c6b1f1a30db9f346f3
\ No newline at end of file
...@@ -869,17 +869,6 @@ void LockContentsView::OnFingerprintStateChanged(const AccountId& account_id, ...@@ -869,17 +869,6 @@ void LockContentsView::OnFingerprintStateChanged(const AccountId& account_id,
big_view->auth_user()->SetFingerprintState(user_state->fingerprint_state); big_view->auth_user()->SetFingerprintState(user_state->fingerprint_state);
LayoutAuth(big_view, nullptr /*opt_to_hide*/, animate); LayoutAuth(big_view, nullptr /*opt_to_hide*/, animate);
if (user_state->fingerprint_state ==
FingerprintState::DISABLED_FROM_TIMEOUT) {
base::string16 error_text = l10n_util::GetStringUTF16(
IDS_ASH_LOGIN_FINGERPRINT_UNLOCK_DISABLED_FROM_TIMEOUT);
auth_error_bubble_->SetAnchorView(big_view->auth_user()->password_view());
auth_error_bubble_->SetTextContent(error_text);
auth_error_bubble_->SetPersistent(true);
auth_error_bubble_->Show();
}
} }
void LockContentsView::OnFingerprintAuthResult(const AccountId& account_id, void LockContentsView::OnFingerprintAuthResult(const AccountId& account_id,
...@@ -1664,11 +1653,8 @@ void LockContentsView::LayoutAuth(LoginBigUserView* to_update, ...@@ -1664,11 +1653,8 @@ void LockContentsView::LayoutAuth(LoginBigUserView* to_update,
} }
if (state->enable_tap_auth) if (state->enable_tap_auth)
to_update_auth |= LoginAuthUserView::AUTH_TAP; to_update_auth |= LoginAuthUserView::AUTH_TAP;
if (state->fingerprint_state != FingerprintState::UNAVAILABLE && if (state->fingerprint_state != FingerprintState::UNAVAILABLE)
state->fingerprint_state !=
FingerprintState::DISABLED_FROM_TIMEOUT) {
to_update_auth |= LoginAuthUserView::AUTH_FINGERPRINT; to_update_auth |= LoginAuthUserView::AUTH_FINGERPRINT;
}
// External binary based authentication is only available for unlock. // External binary based authentication is only available for unlock.
if (screen_type_ == LockScreen::ScreenType::kLock && if (screen_type_ == LockScreen::ScreenType::kLock &&
......
...@@ -79,6 +79,10 @@ constexpr SkColor kChallengeResponseArrowBackgroundColor = ...@@ -79,6 +79,10 @@ constexpr SkColor kChallengeResponseArrowBackgroundColor =
SkColorSetARGB(0x2B, 0xFF, 0xFF, 0xFF); SkColorSetARGB(0x2B, 0xFF, 0xFF, 0xFF);
constexpr SkColor kChallengeResponseErrorColor = gfx::kGoogleRed300; constexpr SkColor kChallengeResponseErrorColor = gfx::kGoogleRed300;
// 38% opacity.
constexpr SkColor kDisabledFingerprintIconColor =
SkColorSetA(SK_ColorWHITE, 97);
// Date time format containing only the day of the week, for example: "Tuesday". // Date time format containing only the day of the week, for example: "Tuesday".
constexpr char kDayOfWeekOnlyTimeFormat[] = "EEEE"; constexpr char kDayOfWeekOnlyTimeFormat[] = "EEEE";
...@@ -181,8 +185,9 @@ class FingerprintLabel : public views::Label { ...@@ -181,8 +185,9 @@ class FingerprintLabel : public views::Label {
SetSubpixelRenderingEnabled(false); SetSubpixelRenderingEnabled(false);
SetAutoColorReadabilityEnabled(false); SetAutoColorReadabilityEnabled(false);
SetEnabledColor(login_constants::kAuthMethodsTextColor); SetEnabledColor(login_constants::kAuthMethodsTextColor);
SetMultiLine(true);
SetTextBasedOnState(FingerprintState::AVAILABLE); SetTextBasedOnState(FingerprintState::AVAILABLE, false /*can_use_pin*/);
} }
void SetTextBasedOnAuthAttempt(bool success) { void SetTextBasedOnAuthAttempt(bool success) {
...@@ -194,7 +199,7 @@ class FingerprintLabel : public views::Label { ...@@ -194,7 +199,7 @@ class FingerprintLabel : public views::Label {
: IDS_ASH_LOGIN_FINGERPRINT_UNLOCK_ACCESSIBLE_AUTH_FAILED)); : IDS_ASH_LOGIN_FINGERPRINT_UNLOCK_ACCESSIBLE_AUTH_FAILED));
} }
void SetTextBasedOnState(FingerprintState state) { void SetTextBasedOnState(FingerprintState state, bool can_use_pin) {
auto get_displayed_id = [&]() { auto get_displayed_id = [&]() {
switch (state) { switch (state) {
case FingerprintState::UNAVAILABLE: case FingerprintState::UNAVAILABLE:
...@@ -203,7 +208,9 @@ class FingerprintLabel : public views::Label { ...@@ -203,7 +208,9 @@ class FingerprintLabel : public views::Label {
case FingerprintState::DISABLED_FROM_ATTEMPTS: case FingerprintState::DISABLED_FROM_ATTEMPTS:
return IDS_ASH_LOGIN_FINGERPRINT_UNLOCK_DISABLED_FROM_ATTEMPTS; return IDS_ASH_LOGIN_FINGERPRINT_UNLOCK_DISABLED_FROM_ATTEMPTS;
case FingerprintState::DISABLED_FROM_TIMEOUT: case FingerprintState::DISABLED_FROM_TIMEOUT:
return IDS_ASH_LOGIN_FINGERPRINT_UNLOCK_DISABLED_FROM_TIMEOUT; if (can_use_pin)
return IDS_ASH_LOGIN_FINGERPRINT_UNLOCK_PIN_OR_PASSWORD_REQUIRED;
return IDS_ASH_LOGIN_FINGERPRINT_UNLOCK_PASSWORD_REQUIRED;
} }
NOTREACHED(); NOTREACHED();
}; };
...@@ -375,6 +382,14 @@ class LoginAuthUserView::FingerprintView : public views::View { ...@@ -375,6 +382,14 @@ class LoginAuthUserView::FingerprintView : public views::View {
FireAlert(); FireAlert();
} }
void SetCanUsePin(bool value) {
if (can_use_pin_ == value)
return;
can_use_pin_ = value;
label_->SetTextBasedOnState(state_, can_use_pin_);
}
void NotifyFingerprintAuthResult(bool success) { void NotifyFingerprintAuthResult(bool success) {
reset_state_.Stop(); reset_state_.Stop();
label_->SetTextBasedOnAuthAttempt(success); label_->SetTextBasedOnAuthAttempt(success);
...@@ -405,10 +420,9 @@ class LoginAuthUserView::FingerprintView : public views::View { ...@@ -405,10 +420,9 @@ class LoginAuthUserView::FingerprintView : public views::View {
private: private:
void DisplayCurrentState() { void DisplayCurrentState() {
SetVisible(state_ != FingerprintState::UNAVAILABLE && SetVisible(state_ != FingerprintState::UNAVAILABLE);
state_ != FingerprintState::DISABLED_FROM_TIMEOUT);
SetIcon(state_); SetIcon(state_);
label_->SetTextBasedOnState(state_); label_->SetTextBasedOnState(state_, can_use_pin_);
} }
void FireAlert() { void FireAlert() {
...@@ -417,12 +431,15 @@ class LoginAuthUserView::FingerprintView : public views::View { ...@@ -417,12 +431,15 @@ class LoginAuthUserView::FingerprintView : public views::View {
} }
void SetIcon(FingerprintState state) { void SetIcon(FingerprintState state) {
const SkColor color =
(state == FingerprintState::AVAILABLE ? SK_ColorWHITE
: kDisabledFingerprintIconColor);
switch (state) { switch (state) {
case FingerprintState::UNAVAILABLE: case FingerprintState::UNAVAILABLE:
case FingerprintState::AVAILABLE: case FingerprintState::AVAILABLE:
case FingerprintState::DISABLED_FROM_TIMEOUT: case FingerprintState::DISABLED_FROM_TIMEOUT:
icon_->SetImage(gfx::CreateVectorIcon( icon_->SetImage(gfx::CreateVectorIcon(kLockScreenFingerprintIcon,
kLockScreenFingerprintIcon, kFingerprintIconSizeDp, SK_ColorWHITE)); kFingerprintIconSizeDp, color));
break; break;
case FingerprintState::DISABLED_FROM_ATTEMPTS: case FingerprintState::DISABLED_FROM_ATTEMPTS:
icon_->SetAnimationDecoder( icon_->SetAnimationDecoder(
...@@ -447,6 +464,9 @@ class LoginAuthUserView::FingerprintView : public views::View { ...@@ -447,6 +464,9 @@ class LoginAuthUserView::FingerprintView : public views::View {
base::OneShotTimer reset_state_; base::OneShotTimer reset_state_;
FingerprintState state_ = FingerprintState::AVAILABLE; FingerprintState state_ = FingerprintState::AVAILABLE;
// Affects DISABLED_FROM_TIMEOUT message.
bool can_use_pin_ = false;
DISALLOW_COPY_AND_ASSIGN(FingerprintView); DISALLOW_COPY_AND_ASSIGN(FingerprintView);
}; };
...@@ -960,6 +980,7 @@ void LoginAuthUserView::SetAuthMethods(uint32_t auth_methods, ...@@ -960,6 +980,7 @@ void LoginAuthUserView::SetAuthMethods(uint32_t auth_methods,
password_view_->RequestFocus(); password_view_->RequestFocus();
fingerprint_view_->SetVisible(has_fingerprint); fingerprint_view_->SetVisible(has_fingerprint);
fingerprint_view_->SetCanUsePin(can_use_pin);
challenge_response_view_->SetVisible(has_challenge_response); challenge_response_view_->SetVisible(has_challenge_response);
external_binary_auth_button_->SetVisible(has_external_binary); external_binary_auth_button_->SetVisible(has_external_binary);
external_binary_enrollment_button_->SetVisible(has_external_binary); external_binary_enrollment_button_->SetVisible(has_external_binary);
......
...@@ -201,9 +201,6 @@ IN_PROC_BROWSER_TEST_F(FingerprintUnlockTest, FingerprintTimedOutTest) { ...@@ -201,9 +201,6 @@ IN_PROC_BROWSER_TEST_F(FingerprintUnlockTest, FingerprintTimedOutTest) {
session_manager::SessionManager::Get()->session_state()); session_manager::SessionManager::Get()->session_state());
EXPECT_EQ(0, FakeSessionManagerClient::Get() EXPECT_EQ(0, FakeSessionManagerClient::Get()
->notify_lock_screen_dismissed_call_count()); ->notify_lock_screen_dismissed_call_count());
// Auth Error button should be visible as fingerprint has expired.
EXPECT_TRUE(tester.IsAuthErrorBubbleShown());
} }
IN_PROC_BROWSER_TEST_F(FingerprintUnlockTest, TimeoutIncludesSuspendedTime) { IN_PROC_BROWSER_TEST_F(FingerprintUnlockTest, TimeoutIncludesSuspendedTime) {
...@@ -230,9 +227,6 @@ IN_PROC_BROWSER_TEST_F(FingerprintUnlockTest, TimeoutIncludesSuspendedTime) { ...@@ -230,9 +227,6 @@ IN_PROC_BROWSER_TEST_F(FingerprintUnlockTest, TimeoutIncludesSuspendedTime) {
session_manager::SessionManager::Get()->session_state()); session_manager::SessionManager::Get()->session_state());
EXPECT_EQ(0, FakeSessionManagerClient::Get() EXPECT_EQ(0, FakeSessionManagerClient::Get()
->notify_lock_screen_dismissed_call_count()); ->notify_lock_screen_dismissed_call_count());
// Auth Error button should be visible as fingerprint has expired.
EXPECT_TRUE(tester.IsAuthErrorBubbleShown());
} }
} // namespace chromeos } // namespace chromeos
...@@ -122,11 +122,6 @@ bool ScreenLockerTester::IsLockShutdownButtonShown() { ...@@ -122,11 +122,6 @@ bool ScreenLockerTester::IsLockShutdownButtonShown() {
ash::LoginScreenTestApi::IsShutdownButtonShown(); ash::LoginScreenTestApi::IsShutdownButtonShown();
} }
bool ScreenLockerTester::IsAuthErrorBubbleShown() {
return IsScreenLockerLocked() &&
ash::LoginScreenTestApi::IsAuthErrorBubbleShown();
}
void ScreenLockerTester::UnlockWithPassword(const AccountId& account_id, void ScreenLockerTester::UnlockWithPassword(const AccountId& account_id,
const std::string& password) { const std::string& password) {
ash::LoginScreenTestApi::SubmitPassword(account_id, password); ash::LoginScreenTestApi::SubmitPassword(account_id, password);
......
...@@ -35,9 +35,6 @@ class ScreenLockerTester { ...@@ -35,9 +35,6 @@ class ScreenLockerTester {
// Returns true if Shutdown button is visible. // Returns true if Shutdown button is visible.
bool IsLockShutdownButtonShown(); bool IsLockShutdownButtonShown();
// Returns true if there is an auth error button on the lock screen.
bool IsAuthErrorBubbleShown();
// Enters and submits the given password for the given account. // Enters and submits the given password for the given account.
void UnlockWithPassword(const AccountId& account_id, void UnlockWithPassword(const AccountId& account_id,
const std::string& password); const std::string& password);
......
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