0

[High5] Show correct UI elements on lock screen for PIN-only

- Do not show recover user button on the lock screen when pin is locked
- Fix fingerprint icon not showing on the lock screen when pin is locked

Bug: b:375138344
Change-Id: If8407e3dbc6e8f779c8e2d55ae6cda5b7896c167
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5955893
Reviewed-by: Denis Kuznetsov <antrim@chromium.org>
Commit-Queue: Yunke Zhou <yunkez@google.com>
Cr-Commit-Position: refs/heads/main@{#1373333}
This commit is contained in:
Yunke Zhou
2024-10-24 15:20:16 +00:00
committed by Chromium LUCI CQ
parent 5bd2ae2240
commit bb5c907f66
4 changed files with 27 additions and 16 deletions

@ -1991,15 +1991,6 @@ void LockContentsView::LayoutAuth(LoginBigUserView* to_update,
// Currently the challenge-response authentication can't be combined
// with the password or PIN based one.
to_update_auth = LoginAuthUserView::AUTH_CHALLENGE_RESPONSE;
} else if (!state->show_password && !state->show_pin) {
CHECK(IsTimeInFuture(state->pin_available_at))
<< "Password or pin factor must be present, if pin is not locked";
to_update_auth = LoginAuthUserView::AUTH_RECOVERY;
auth_metadata.pin_available_at = state->pin_available_at;
// The auth error message might be shown at the moment due to previous
// wrong attempts. We will hide it as it shows similar content as the
// recover button and the pin delay message.
HideAuthErrorMessage();
} else {
to_update_auth = LoginAuthUserView::AUTH_NONE;
if (state->show_password) {
@ -2017,6 +2008,18 @@ void LockContentsView::LayoutAuth(LoginBigUserView* to_update,
if (state->show_pin) {
to_update_auth |= LoginAuthUserView::AUTH_PIN;
}
if (!state->show_password && !state->show_pin) {
CHECK(IsTimeInFuture(state->pin_available_at))
<< "Password or pin factor must be present, if pin is not locked";
to_update_auth =
screen_type_ == LockScreen::ScreenType::kLogin
? LoginAuthUserView::AUTH_PIN_LOCKED_SHOW_RECOVERY
: LoginAuthUserView::AUTH_PIN_LOCKED;
// The auth error message might be shown at the moment due to previous
// wrong attempts. We will hide it as it shows similar content as the
// recover button and the pin delay message.
HideAuthErrorMessage();
}
if (state->fingerprint_state != FingerprintState::UNAVAILABLE) {
to_update_auth |= LoginAuthUserView::AUTH_FINGERPRINT;
}

@ -391,7 +391,8 @@ struct LoginAuthUserView::UiState {
auth_factor_is_hiding_password = view->HasAuthMethod(
LoginAuthUserView::AUTH_AUTH_FACTOR_IS_HIDING_PASSWORD);
pin_is_locked = view->ShouldShowPinStatusMessage();
show_recover_button = view->HasAuthMethod(LoginAuthUserView::AUTH_RECOVERY);
show_recover_button =
view->HasAuthMethod(LoginAuthUserView::AUTH_PIN_LOCKED_SHOW_RECOVERY);
non_pin_y_start_in_screen = view->GetBoundsInScreen().y();
pin_start_in_screen = view->pin_view_->GetBoundsInScreen().origin();
@ -1332,7 +1333,7 @@ void LoginAuthUserView::OnPinTextChanged(bool is_empty) {
void LoginAuthUserView::OnRecoverButtonPressed() {
DCHECK(recover_button_);
DCHECK(HasAuthMethod(AUTH_RECOVERY));
DCHECK(HasAuthMethod(AUTH_PIN_LOCKED_SHOW_RECOVERY));
on_recover_button_pressed_.Run();
}
@ -1526,7 +1527,8 @@ bool LoginAuthUserView::ShouldShowPinStatusMessage() const {
// When `pin_available_at` is present, pin status message should be shown when
// in `kPasswordOnly` mode or when the recover button is present.
return input_field_mode_ == InputFieldMode::kPasswordOnly ||
HasAuthMethod(AUTH_RECOVERY);
HasAuthMethod(AUTH_PIN_LOCKED) ||
HasAuthMethod(AUTH_PIN_LOCKED_SHOW_RECOVERY);
}
gfx::Size LoginAuthUserView::GetPaddingBelowUserView() const {

@ -76,8 +76,11 @@ class ASH_EXPORT LoginAuthUserView : public NonAccessibleView {
// the user to click a button as a final step. Note that if
// this bit is set, the password/pin will be hidden even if
// AUTH_PASSWORD and/or AUTH_PIN are set.
AUTH_RECOVERY = 1 << 9, // Shows the recovery user button when PIN is
// locked and it is the only auth factor.
AUTH_PIN_LOCKED_SHOW_RECOVERY =
1 << 9, // Shows PIN locked message and recover user button when
// the PIN is locked and is the only auth factor.
AUTH_PIN_LOCKED = 1 << 10, // Shows PIN locked message when the PIN is
// locked and is the only auth factor.
};
// Extra control parameters to be passed when setting the auth methods.

@ -323,8 +323,11 @@ TEST_F(LoginAuthUserViewUnittest, ModesWithoutInputFields) {
LoginAuthUserView::TestApi auth_test(view_);
LoginAuthUserView::AuthMethods methods_without_input[] = {
LoginAuthUserView::AUTH_CHALLENGE_RESPONSE,
LoginAuthUserView::AUTH_DISABLED, LoginAuthUserView::AUTH_NONE,
LoginAuthUserView::AUTH_ONLINE_SIGN_IN};
LoginAuthUserView::AUTH_DISABLED,
LoginAuthUserView::AUTH_NONE,
LoginAuthUserView::AUTH_ONLINE_SIGN_IN,
LoginAuthUserView::AUTH_PIN_LOCKED_SHOW_RECOVERY,
LoginAuthUserView::AUTH_PIN_LOCKED};
for (auto method : methods_without_input) {
SetAuthMethods(method);