Commit 0c491d56 authored by James Hawkins's avatar James Hawkins Committed by Commit Bot

Smart Lock: Remove SetTrialRun method.

There is no longer a trial run in the new setup flow.

R=hansberry@chromium.org

Bug: 899324
Test: none
Change-Id: Ic466140fbe18890e707f3338a38b58f385af0f2f
Reviewed-on: https://chromium-review.googlesource.com/c/1302704
Commit-Queue: James Hawkins <jhawkins@chromium.org>
Reviewed-by: default avatarRyan Hansberry <hansberry@chromium.org>
Reviewed-by: default avatarKyle Horimoto <khorimoto@chromium.org>
Reviewed-by: default avatarToni Baržić <tbarzic@chromium.org>
Reviewed-by: default avatarJacob Dufault <jdufault@chromium.org>
Reviewed-by: default avatarMustafa Emre Acer <meacer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#603607}
parent f02829c1
......@@ -75,11 +75,6 @@ struct EasyUnlockIconOptions {
// display via a separate EasyUnlockIconsOption update. See
// login_screen.mojom::HardlockPod.
bool hardlock_on_click;
// If true, the lock screen is being demoed so the user can test out easy
// unlock. The flow operates as normal. Hardlocking is disabled in this
// scenario.
// TODO(jdufault): This should be removed, as it does not change UI.
bool is_trial_run;
};
// Infomation of each input method. This is used to populate keyboard layouts
......
......@@ -3637,9 +3637,6 @@
<message name="IDS_EASY_UNLOCK_SCREENLOCK_TOOLTIP_PHONE_LOCKED_AND_RSSI_TOO_LOW" desc="Tooltip for an icon on a user's lock screen pod shown by Easy Unlock when a phone eligible to unlock the Chromebook is detected, but it's both (a) locked and (b) not in the Chromebook's proximity (> 1 foot away).">
Unlock your phone and bring it closer to unlock your <ph name="DEVICE_TYPE">$1<ex>Chromebook</ex></ph>.
</message>
<message name="IDS_EASY_UNLOCK_SCREENLOCK_TOOLTIP_INITIAL_AUTHENTICATED" desc="Tooltip text shown on lock screen when a phone eligible to unlock the Chromebook via Easy Unlock is detected and authenticated for the first time.">
When your phone is unlocked and nearby, just select to unlock. Otherwise, enter your password or PIN.
</message>
<message name="IDS_EASY_UNLOCK_SCREENLOCK_TOOLTIP_HARDLOCK_INSTRUCTIONS" desc="Tooltip for an icon on user's lock screen pod shown by Easy Unlock when a phone eligible to unlock the Chromebook is detected and authenticated. The tooltip shows instructions for hard-locking the Chromebook.">
If you click this icon, you will manually lock this <ph name="DEVICE_TYPE">$1<ex>Chromebook</ex></ph>. Next time, you’ll need to type your password to enter.
</message>
......
......@@ -34,10 +34,4 @@ void RecordEasyUnlockScreenUnlockEvent(EasyUnlockAuthEvent event) {
EASY_UNLOCK_AUTH_EVENT_COUNT);
}
void RecordEasyUnlockTrialRunEvent(EasyUnlockTrialRunEvent event) {
DCHECK_LT(event, EASY_UNLOCK_TRIAL_RUN_EVENT_COUNT);
UMA_HISTOGRAM_ENUMERATION("EasyUnlock.TrialRun.Events", event,
EASY_UNLOCK_TRIAL_RUN_EVENT_COUNT);
}
} // namespace chromeos
......@@ -74,20 +74,11 @@ enum EasyUnlockAuthEvent {
EASY_UNLOCK_AUTH_EVENT_COUNT // Must be the last entry.
};
enum EasyUnlockTrialRunEvent {
// A trial run was initiated from the Easy Unlock setup app.
EASY_UNLOCK_TRIAL_RUN_EVENT_LAUNCHED = 0,
// The user clicked on the lock icon during the trial run.
EASY_UNLOCK_TRIAL_RUN_EVENT_CLICKED_LOCK_ICON = 1,
EASY_UNLOCK_TRIAL_RUN_EVENT_COUNT // Must be the last entry.
};
void RecordEasyUnlockDidUserManuallyUnlockPhone(bool did_unlock);
void RecordEasyUnlockSigninDuration(const base::TimeDelta& duration);
void RecordEasyUnlockSigninEvent(EasyUnlockAuthEvent event);
void RecordEasyUnlockScreenUnlockDuration(const base::TimeDelta& duration);
void RecordEasyUnlockScreenUnlockEvent(EasyUnlockAuthEvent event);
void RecordEasyUnlockTrialRunEvent(EasyUnlockTrialRunEvent event);
} // namespace chromeos
......
......@@ -154,8 +154,7 @@ void EasyUnlockScreenlockStateHandler::ChangeState(ScreenlockState new_state) {
if (IsLockedState(state_))
did_see_locked_phone_ = true;
// No hardlock UI for trial run.
if (!is_trial_run_ && hardlock_state_ != NO_HARDLOCK) {
if (hardlock_state_ != NO_HARDLOCK) {
ShowHardlockUI();
return;
}
......@@ -173,10 +172,7 @@ void EasyUnlockScreenlockStateHandler::ChangeState(ScreenlockState new_state) {
proximity_auth::ScreenlockBridge::UserPodCustomIconOptions icon_options;
icon_options.SetIcon(icon);
// Don't hardlock on trial run.
if (is_trial_run_)
icon_options.SetTrialRun();
else if (HardlockOnClick(state_))
if (HardlockOnClick(state_))
icon_options.SetHardlockOnClick();
UpdateTooltipOptions(&icon_options);
......@@ -215,14 +211,6 @@ void EasyUnlockScreenlockStateHandler::MaybeShowHardlockUI() {
ShowHardlockUI();
}
void EasyUnlockScreenlockStateHandler::SetTrialRun() {
if (is_trial_run_)
return;
is_trial_run_ = true;
RefreshScreenlockState();
RecordEasyUnlockTrialRunEvent(EASY_UNLOCK_TRIAL_RUN_EVENT_LAUNCHED);
}
void EasyUnlockScreenlockStateHandler::OnScreenDidLock(
proximity_auth::ScreenlockBridge::LockHandler::ScreenType screen_type) {
did_see_locked_phone_ = IsLockedState(state_);
......@@ -234,7 +222,6 @@ void EasyUnlockScreenlockStateHandler::OnScreenDidUnlock(
if (hardlock_state_ == LOGIN_FAILED)
hardlock_state_ = NO_HARDLOCK;
hardlock_ui_shown_ = false;
is_trial_run_ = false;
// Upon a successful unlock event, record whether the user's phone was locked
// at any point while the lock screen was up.
......@@ -326,13 +313,9 @@ void EasyUnlockScreenlockStateHandler::UpdateTooltipOptions(
proximity_auth::ScreenlockBridge::UserPodCustomIconOptions* icon_options) {
size_t resource_id = 0;
base::string16 device_name;
if (is_trial_run_ && state_ == ScreenlockState::AUTHENTICATED) {
resource_id = IDS_EASY_UNLOCK_SCREENLOCK_TOOLTIP_INITIAL_AUTHENTICATED;
} else {
resource_id = GetTooltipResourceId(state_);
if (TooltipContainsDeviceType(state_))
device_name = GetDeviceName();
}
resource_id = GetTooltipResourceId(state_);
if (TooltipContainsDeviceType(state_))
device_name = GetDeviceName();
if (!resource_id)
return;
......@@ -347,8 +330,7 @@ void EasyUnlockScreenlockStateHandler::UpdateTooltipOptions(
if (tooltip.empty())
return;
bool autoshow_tooltip =
is_trial_run_ || state_ != ScreenlockState::AUTHENTICATED;
bool autoshow_tooltip = state_ != ScreenlockState::AUTHENTICATED;
icon_options->SetTooltip(tooltip, autoshow_tooltip);
}
......@@ -357,7 +339,7 @@ base::string16 EasyUnlockScreenlockStateHandler::GetDeviceName() {
}
void EasyUnlockScreenlockStateHandler::UpdateScreenlockAuthType() {
if (!is_trial_run_ && hardlock_state_ != NO_HARDLOCK)
if (hardlock_state_ != NO_HARDLOCK)
return;
// Do not override online signin.
......
......@@ -62,9 +62,6 @@ class EasyUnlockScreenlockStateHandler
// Shows the hardlock UI if the hardlock_state_ is not NO_HARDLOCK.
void MaybeShowHardlockUI();
// Marks the current screenlock state as the one for trial Easy Unlock run.
void SetTrialRun();
proximity_auth::ScreenlockState state() const { return state_; }
private:
......@@ -100,11 +97,6 @@ class EasyUnlockScreenlockStateHandler
HardlockState hardlock_state_;
bool hardlock_ui_shown_ = false;
// Whether this is the trial Easy Unlock run. If this is the case, a
// tutorial message should be shown and hard-locking be disabled. The trial
// run should be set if the screen was locked by the Easy Unlock setup app.
bool is_trial_run_ = false;
// Whether the user's phone was ever locked while on the current lock screen.
bool did_see_locked_phone_ = false;
......
......@@ -246,25 +246,6 @@ class EasyUnlockScreenlockStateHandlerTest : public testing::Test {
std::unique_ptr<TestLockHandler> lock_handler_;
};
TEST_F(EasyUnlockScreenlockStateHandlerTest, AuthenticatedTrialRun) {
state_handler_->SetTrialRun();
state_handler_->ChangeState(ScreenlockState::AUTHENTICATED);
EXPECT_EQ(1u, lock_handler_->GetAndResetShowIconCount());
EXPECT_EQ(proximity_auth::mojom::AuthType::USER_CLICK,
lock_handler_->GetAuthType(account_id_));
ASSERT_TRUE(lock_handler_->HasCustomIcon());
EXPECT_EQ(kUnlockedIconId, lock_handler_->GetCustomIconId());
EXPECT_TRUE(lock_handler_->CustomIconHasTooltip());
EXPECT_TRUE(lock_handler_->IsCustomIconTooltipAutoshown());
EXPECT_FALSE(lock_handler_->CustomIconHardlocksOnClick());
state_handler_->ChangeState(ScreenlockState::AUTHENTICATED);
// Duplicated state change should be ignored.
EXPECT_EQ(0u, lock_handler_->GetAndResetShowIconCount());
}
TEST_F(EasyUnlockScreenlockStateHandlerTest, AuthenticatedNotInitialRun) {
state_handler_->ChangeState(ScreenlockState::AUTHENTICATED);
......@@ -376,26 +357,6 @@ TEST_F(EasyUnlockScreenlockStateHandlerTest, StatesWithLockedIcon) {
}
}
TEST_F(EasyUnlockScreenlockStateHandlerTest, SettingTrialRunUpdatesUI) {
state_handler_->ChangeState(ScreenlockState::AUTHENTICATED);
EXPECT_EQ(1u, lock_handler_->GetAndResetShowIconCount());
EXPECT_EQ(proximity_auth::mojom::AuthType::USER_CLICK,
lock_handler_->GetAuthType(account_id_));
ASSERT_TRUE(lock_handler_->HasCustomIcon());
ASSERT_FALSE(lock_handler_->IsCustomIconTooltipAutoshown());
state_handler_->SetTrialRun();
EXPECT_EQ(1u, lock_handler_->GetAndResetShowIconCount());
EXPECT_EQ(proximity_auth::mojom::AuthType::USER_CLICK,
lock_handler_->GetAuthType(account_id_));
ASSERT_TRUE(lock_handler_->HasCustomIcon());
ASSERT_TRUE(lock_handler_->IsCustomIconTooltipAutoshown());
}
TEST_F(EasyUnlockScreenlockStateHandlerTest,
LockScreenClearedOnStateHandlerDestruction) {
state_handler_->ChangeState(ScreenlockState::AUTHENTICATED);
......@@ -457,40 +418,6 @@ TEST_F(EasyUnlockScreenlockStateHandlerTest, StateChangeWhileScreenUnlocked) {
EXPECT_EQ(kSpinnerIconId, lock_handler_->GetCustomIconId());
}
TEST_F(EasyUnlockScreenlockStateHandlerTest,
HardlockEnabledAfterInitialUnlock) {
state_handler_->SetTrialRun();
std::vector<ScreenlockState> states;
states.push_back(ScreenlockState::BLUETOOTH_CONNECTING);
states.push_back(ScreenlockState::PHONE_NOT_AUTHENTICATED);
states.push_back(ScreenlockState::NO_BLUETOOTH);
states.push_back(ScreenlockState::NO_PHONE);
states.push_back(ScreenlockState::PHONE_UNSUPPORTED);
states.push_back(ScreenlockState::PHONE_NOT_LOCKABLE);
// This one should go last as changing state to AUTHENTICATED enables hard
// locking.
states.push_back(ScreenlockState::AUTHENTICATED);
for (size_t i = 0; i < states.size(); ++i) {
SCOPED_TRACE(base::NumberToString(i));
state_handler_->ChangeState(states[i]);
ASSERT_TRUE(lock_handler_->HasCustomIcon());
EXPECT_FALSE(lock_handler_->CustomIconHardlocksOnClick());
}
proximity_auth::ScreenlockBridge::Get()->SetLockHandler(NULL);
lock_handler_.reset(new TestLockHandler(account_id_));
proximity_auth::ScreenlockBridge::Get()->SetLockHandler(lock_handler_.get());
for (size_t i = 0; i < states.size(); ++i) {
SCOPED_TRACE(base::NumberToString(i));
state_handler_->ChangeState(states[i]);
ASSERT_TRUE(lock_handler_->HasCustomIcon());
EXPECT_TRUE(lock_handler_->CustomIconHardlocksOnClick());
}
}
TEST_F(EasyUnlockScreenlockStateHandlerTest, NoPairingHardlockClearsIcon) {
state_handler_->ChangeState(ScreenlockState::PHONE_LOCKED);
......@@ -526,24 +453,6 @@ TEST_F(EasyUnlockScreenlockStateHandlerTest, PairingChangedHardlock) {
EXPECT_EQ(kLockedToBeActivatedIconId, lock_handler_->GetCustomIconId());
}
TEST_F(EasyUnlockScreenlockStateHandlerTest,
PairingChangedHardlockIneffectiveOnInitialRun) {
state_handler_->SetTrialRun();
state_handler_->ChangeState(ScreenlockState::PHONE_LOCKED);
EXPECT_EQ(1u, lock_handler_->GetAndResetShowIconCount());
ASSERT_TRUE(lock_handler_->HasCustomIcon());
EXPECT_EQ(kLockedIconId, lock_handler_->GetCustomIconId());
state_handler_->SetHardlockState(
EasyUnlockScreenlockStateHandler::PAIRING_CHANGED);
EXPECT_EQ(1u, lock_handler_->GetAndResetShowIconCount());
ASSERT_TRUE(lock_handler_->HasCustomIcon());
EXPECT_EQ(kLockedIconId, lock_handler_->GetCustomIconId());
}
TEST_F(EasyUnlockScreenlockStateHandlerTest, InactiveStateHidesIcon) {
state_handler_->ChangeState(ScreenlockState::AUTHENTICATED);
......
......@@ -494,14 +494,6 @@ void EasyUnlockService::CheckCryptohomeKeysAndMaybeHardlock() {
weak_ptr_factory_.GetWeakPtr(), account_id, paired_devices));
}
void EasyUnlockService::SetTrialRun() {
DCHECK_EQ(GetType(), TYPE_REGULAR);
EasyUnlockScreenlockStateHandler* handler = GetScreenlockStateHandler();
if (handler)
handler->SetTrialRun();
}
void EasyUnlockService::AddObserver(EasyUnlockServiceObserver* observer) {
observers_.AddObserver(observer);
}
......
......@@ -183,10 +183,6 @@ class EasyUnlockService : public KeyedService {
// hardlock state if the two do not match.
void CheckCryptohomeKeysAndMaybeHardlock();
// Marks the Easy Unlock screen lock state as the one associated with the
// trial run initiated by Easy Unlock app.
void SetTrialRun();
// Called when the user reauths (e.g. in chrome://settings) so we can cache
// the user context for the setup flow.
virtual void HandleUserReauth(const UserContext& user_context);
......
......@@ -56,9 +56,6 @@ ash::mojom::EasyUnlockIconOptionsPtr ToEasyUnlockIconOptionsPtr(
if (icon_options.hardlock_on_click())
options->hardlock_on_click = true;
if (icon_options.is_trial_run())
options->is_trial_run = true;
return options;
}
......
......@@ -72,15 +72,6 @@ bool ScreenlockPrivateSetLockedFunction::RunAsync() {
chromeos::EasyUnlockService* service =
chromeos::EasyUnlockService::Get(GetProfile());
if (params->locked) {
if (extension()->id() == extension_misc::kEasyUnlockAppId &&
AppWindowRegistry::Get(browser_context())
->GetAppWindowForAppAndKey(extension()->id(),
"easy_unlock_pairing")) {
// Mark the Easy Unlock behaviour on the lock screen as the one initiated
// by the Easy Unlock setup app as a trial one.
// TODO(tbarzic): Move this logic to a new easyUnlockPrivate function.
service->SetTrialRun();
}
proximity_auth::ScreenlockBridge::Get()->Lock();
} else {
proximity_auth::ScreenlockBridge::Get()->Unlock(AccountId::FromUserEmail(
......
......@@ -54,9 +54,7 @@ std::string GetIdForIcon(ScreenlockBridge::UserPodCustomIcon icon) {
} // namespace
ScreenlockBridge::UserPodCustomIconOptions::UserPodCustomIconOptions()
: autoshow_tooltip_(false),
hardlock_on_click_(false),
is_trial_run_(false) {}
: autoshow_tooltip_(false), hardlock_on_click_(false) {}
ScreenlockBridge::UserPodCustomIconOptions::~UserPodCustomIconOptions() {}
......@@ -78,9 +76,6 @@ ScreenlockBridge::UserPodCustomIconOptions::ToDictionaryValue() const {
if (hardlock_on_click_)
result->SetBoolean("hardlockOnClick", true);
if (is_trial_run_)
result->SetBoolean("isTrialRun", true);
return result;
}
......@@ -105,10 +100,6 @@ void ScreenlockBridge::UserPodCustomIconOptions::SetHardlockOnClick() {
hardlock_on_click_ = true;
}
void ScreenlockBridge::UserPodCustomIconOptions::SetTrialRun() {
is_trial_run_ = true;
}
std::string ScreenlockBridge::UserPodCustomIconOptions::GetIDString() const {
return GetIdForIcon(icon_);
}
......
......@@ -68,10 +68,6 @@ class ScreenlockBridge {
// go to state where password is required for unlock.
void SetHardlockOnClick();
// If the current lock screen is a trial run to introduce users to Easy
// Unlock, the icon will record metrics upon click.
void SetTrialRun();
std::string GetIDString() const;
UserPodCustomIcon icon() const { return icon_; }
......@@ -84,8 +80,6 @@ class ScreenlockBridge {
bool hardlock_on_click() const { return hardlock_on_click_; }
bool is_trial_run() const { return is_trial_run_; }
private:
UserPodCustomIcon icon_;
......@@ -96,8 +90,6 @@ class ScreenlockBridge {
bool hardlock_on_click_;
bool is_trial_run_;
DISALLOW_COPY_AND_ASSIGN(UserPodCustomIconOptions);
};
......
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