0

[SmartLock] Delete hardlock icon tap callback

Now that Sign in with Smart Lock is deprecated there is no use for
hardlock. This CL deletes the EasyUnlock icon tap callback which is
supposed to trigger hardlock. Hardlock and the EasyUnlockIcon is doubly irrelevant since the SmartLockUIRevamp is also fully ramped up already. Follow up CLs will delete Hardlock UI, state management, and user prefs.

TEST=existing unittests test and manually tested smart lock with strongbad and pixel4a

Change-Id: I2c4ad2c6d491bc7660ac339e30dca02e4b16c7ac
Bug: b/227674947
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4358450
Commit-Queue: Brittany Hartmire <bhartmire@google.com>
Reviewed-by: Ryan Hansberry <hansberry@chromium.org>
Reviewed-by: Toni Barzic <tbarzic@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1121938}
This commit is contained in:
Brittany Hartmire
2023-03-24 21:36:26 +00:00
committed by Chromium LUCI CQ
parent 984cfc3e93
commit e94bd8429d
14 changed files with 7 additions and 70 deletions

@ -470,7 +470,7 @@ void AuthDialogContentsView::AddPasswordView() {
/*authenticated_by_pin=*/false),
base::BindRepeating(&AuthDialogContentsView::OnInputTextChanged,
base::Unretained(this)),
base::DoNothing(), views::Button::PressedCallback());
base::DoNothing());
}
void AuthDialogContentsView::AddPinPadView() {
@ -503,7 +503,7 @@ void AuthDialogContentsView::AddPinPadView() {
/*authenticated_by_pin=*/true),
base::BindRepeating(&AuthDialogContentsView::OnInputTextChanged,
base::Unretained(this)),
base::DoNothing(), views::Button::PressedCallback());
base::DoNothing());
}
pin_pad_view_->SetVisible(true);
}

@ -2242,21 +2242,6 @@ void LockContentsView::OnEasyUnlockIconHovered() {
}
}
void LockContentsView::OnEasyUnlockIconTapped() {
UserState* state = FindStateForUser(
CurrentBigUserView()->GetCurrentUser().basic_user_info.account_id);
DCHECK(state);
DCHECK(state->easy_unlock_icon_info);
if (state->easy_unlock_icon_info->hardlock_on_click) {
AccountId user =
CurrentBigUserView()->GetCurrentUser().basic_user_info.account_id;
Shell::Get()->login_screen_controller()->HardlockPod(user);
// TODO(jdufault): This should get called as a result of HardlockPod.
OnTapToUnlockEnabledForUserChanged(user, false /*enabled*/);
}
}
void LockContentsView::OnParentAccessValidationFinished(
const AccountId& account_id,
bool access_granted) {
@ -2343,8 +2328,6 @@ std::unique_ptr<LoginBigUserView> LockContentsView::AllocateLoginBigUserView(
&LockContentsView::RemoveUser, base::Unretained(this), is_primary);
auth_user_callbacks.on_easy_unlock_icon_hovered = base::BindRepeating(
&LockContentsView::OnEasyUnlockIconHovered, base::Unretained(this));
auth_user_callbacks.on_easy_unlock_icon_tapped = base::BindRepeating(
&LockContentsView::OnEasyUnlockIconTapped, base::Unretained(this));
auth_user_callbacks.on_auth_factor_is_hiding_password_changed =
base::BindRepeating(
&LockContentsView::OnAuthFactorIsHidingPasswordChanged,

@ -343,8 +343,6 @@ class ASH_EXPORT LockContentsView
// Called when the easy unlock icon is hovered.
void OnEasyUnlockIconHovered();
// Called when the easy unlock icon is tapped.
void OnEasyUnlockIconTapped();
// Called when LoginAuthFactorsView enters/exits a state where an auth
// factor wants to hide the password and pin fields.

@ -1047,8 +1047,7 @@ LoginAuthUserView::LoginAuthUserView(const LoginUserInfo& user,
base::Unretained(this)),
base::BindRepeating(&LoginAuthUserView::OnPasswordTextChanged,
base::Unretained(this)),
callbacks.on_easy_unlock_icon_hovered,
callbacks.on_easy_unlock_icon_tapped);
callbacks.on_easy_unlock_icon_hovered);
auto pin_input_view = std::make_unique<LoginPinInputView>();
pin_input_view_ = pin_input_view.get();

@ -146,8 +146,6 @@ class ASH_EXPORT LoginAuthUserView : public NonAccessibleView {
LoginUserView::OnRemove on_remove;
// Called when the easy unlock icon is hovered.
OnEasyUnlockIconHovered on_easy_unlock_icon_hovered;
// Called when the easy unlock icon is tapped.
views::Button::PressedCallback on_easy_unlock_icon_tapped;
// Called when LoginAuthFactorsView enters/exits a state where an auth
// factor wants to hide the password and pin.
base::RepeatingCallback<void(bool)>

@ -114,8 +114,6 @@ class LoginAuthUserViewTestBase : public LoginTestBase {
LoginAuthUserView::Callbacks auth_callbacks;
auth_callbacks.on_auth = base::DoNothing();
auth_callbacks.on_easy_unlock_icon_hovered = base::DoNothing();
auth_callbacks.on_easy_unlock_icon_tapped =
views::Button::PressedCallback();
auth_callbacks.on_tap = base::DoNothing();
auth_callbacks.on_remove_warning_shown = base::DoNothing();
auth_callbacks.on_remove = base::DoNothing();

@ -315,12 +315,10 @@ class LoginPasswordView::EasyUnlockIcon : public views::ImageButton {
~EasyUnlockIcon() override = default;
void Init(const OnEasyUnlockIconHovered& on_hovered,
views::Button::PressedCallback on_tapped) {
void Init(const OnEasyUnlockIconHovered& on_hovered) {
DCHECK(on_hovered);
on_hovered_ = on_hovered;
SetCallback(std::move(on_tapped));
hover_notifier_ = std::make_unique<HoverNotifier>(
this, base::BindRepeating(
@ -687,14 +685,12 @@ LoginPasswordView::~LoginPasswordView() {
void LoginPasswordView::Init(
const OnPasswordSubmit& on_submit,
const OnPasswordTextChanged& on_password_text_changed,
const OnEasyUnlockIconHovered& on_easy_unlock_icon_hovered,
views::Button::PressedCallback on_easy_unlock_icon_tapped) {
const OnEasyUnlockIconHovered& on_easy_unlock_icon_hovered) {
DCHECK(on_submit);
DCHECK(on_password_text_changed);
on_submit_ = on_submit;
on_password_text_changed_ = on_password_text_changed;
easy_unlock_icon_->Init(on_easy_unlock_icon_hovered,
std::move(on_easy_unlock_icon_tapped));
easy_unlock_icon_->Init(on_easy_unlock_icon_hovered);
}
void LoginPasswordView::SetEnabledOnEmptyPassword(bool enabled) {

@ -15,7 +15,6 @@
#include "ui/base/ime/ash/ime_keyboard.h"
#include "ui/base/metadata/metadata_header_macros.h"
#include "ui/compositor/layer_animation_observer.h"
#include "ui/views/controls/button/button.h"
#include "ui/views/controls/textfield/textfield_controller.h"
#include "ui/views/view.h"
@ -104,8 +103,7 @@ class ASH_EXPORT LoginPasswordView
// changes.
void Init(const OnPasswordSubmit& on_submit,
const OnPasswordTextChanged& on_password_text_changed,
const OnEasyUnlockIconHovered& on_easy_unlock_icon_hovered,
views::Button::PressedCallback on_easy_unlock_icon_tapped);
const OnEasyUnlockIconHovered& on_easy_unlock_icon_hovered);
// Whether or not the password field is enabled when there is no text.
void SetEnabledOnEmptyPassword(bool enabled);

@ -50,8 +50,6 @@ class LoginPasswordViewTest : public LoginTestBase {
base::BindRepeating(&LoginPasswordViewTest::OnPasswordTextChanged,
base::Unretained(this)),
base::BindRepeating(&LoginPasswordViewTest::OnEasyUnlockIconHovered,
base::Unretained(this)),
base::BindRepeating(&LoginPasswordViewTest::OnEasyUnlockIconTapped,
base::Unretained(this)));
SetWidget(CreateWidgetWithContent(view_));
@ -64,7 +62,6 @@ class LoginPasswordViewTest : public LoginTestBase {
is_password_field_empty_ = is_empty;
}
void OnEasyUnlockIconHovered() { easy_unlock_icon_hovered_called_ = true; }
void OnEasyUnlockIconTapped() { easy_unlock_icon_tapped_called_ = true; }
LoginPasswordView* view_ = nullptr;
absl::optional<std::u16string> password_;

@ -173,11 +173,6 @@ struct ASH_PUBLIC_EXPORT EasyUnlockIconInfo {
// TODO(jdufault): Always populate and use |aria_label|, even if |tooltip| is
// non-empty.
std::u16string aria_label;
// If true, clicking the easy unlock icon should fire a hardlock event which
// will disable easy unlock. The hardlock event will request a new icon
// display via a separate EasyUnlockIconsOption update. See
// LoginScreenClient::HardlockPod.
bool hardlock_on_click = false;
};
// Enterprise information about a managed device.

@ -65,10 +65,6 @@ proximity_auth::ScreenlockBridge::UserPodCustomIcon GetIconForState(
return proximity_auth::ScreenlockBridge::USER_POD_CUSTOM_ICON_NONE;
}
bool HardlockOnClick(SmartLockState state) {
return state != SmartLockState::kInactive;
}
size_t GetTooltipResourceId(SmartLockState state) {
switch (state) {
case SmartLockState::kInactive:
@ -191,9 +187,6 @@ void SmartLockStateHandler::ChangeState(SmartLockState new_state) {
proximity_auth::ScreenlockBridge::UserPodCustomIconInfo icon_info;
icon_info.SetIcon(icon);
if (HardlockOnClick(state_))
icon_info.SetHardlockOnClick();
UpdateTooltipOptions(&icon_info);
// For states without tooltips, we still need to set an accessibility label.

@ -56,9 +56,6 @@ EasyUnlockIconInfo ToEasyUnlockIconInfo(
if (!user_pod_icon_info.aria_label().empty())
easy_unlock_icon_info.aria_label = user_pod_icon_info.aria_label();
if (user_pod_icon_info.hardlock_on_click())
easy_unlock_icon_info.hardlock_on_click = true;
return easy_unlock_icon_info;
}

@ -74,9 +74,6 @@ base::Value::Dict ScreenlockBridge::UserPodCustomIconInfo::ToDictForTesting()
if (!aria_label_.empty())
result.Set("ariaLabel", aria_label_);
if (hardlock_on_click_)
result.Set("hardlockOnClick", true);
return result;
}
@ -97,10 +94,6 @@ void ScreenlockBridge::UserPodCustomIconInfo::SetAriaLabel(
aria_label_ = aria_label;
}
void ScreenlockBridge::UserPodCustomIconInfo::SetHardlockOnClick() {
hardlock_on_click_ = true;
}
std::string ScreenlockBridge::UserPodCustomIconInfo::GetIDString() const {
return GetIdForIcon(icon_);
}

@ -66,10 +66,6 @@ class ScreenlockBridge {
// provided, then the tooltip will be used.
void SetAriaLabel(const std::u16string& aria_label);
// If hardlock on click is set, clicking the icon in the screenlock will
// go to state where password is required for unlock.
void SetHardlockOnClick();
std::string GetIDString() const;
UserPodCustomIcon icon() const { return icon_; }
@ -80,8 +76,6 @@ class ScreenlockBridge {
const std::u16string aria_label() const { return aria_label_; }
bool hardlock_on_click() const { return hardlock_on_click_; }
private:
UserPodCustomIcon icon_;
@ -89,8 +83,6 @@ class ScreenlockBridge {
bool autoshow_tooltip_ = false;
std::u16string aria_label_;
bool hardlock_on_click_ = false;
};
class LockHandler {