Skip to content

Commit

Permalink
[SmartLock] Delete ProximityAuthLocalStatePrefManager
Browse files Browse the repository at this point in the history
Now that sign in with Smart Lock is deprecated, we no longer need to
access any Smart Lock prefs outside of a user profile. This cl removes
Smart Lock local state prefs and the ProximityAuthLocalStatePrefManager.

TEST=existing unittests pass, manually tested Smart Lock with strongbad
and pixel4a.

Change-Id: I364801111bc8260fc0f7cb1b3225fcea77781644
Bug: b/227674947
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4335758
Reviewed-by: Tommy Nyquist <nyquist@chromium.org>
Reviewed-by: Ryan Hansberry <hansberry@chromium.org>
Commit-Queue: Brittany Hartmire <bhartmire@google.com>
Cr-Commit-Position: refs/heads/main@{#1117868}
  • Loading branch information
Brittany Hartmire authored and Chromium LUCI CQ committed Mar 16, 2023
1 parent 207b00e commit afd3531
Show file tree
Hide file tree
Showing 16 changed files with 33 additions and 539 deletions.
5 changes: 1 addition & 4 deletions chrome/browser/ash/login/easy_unlock/easy_unlock_service.cc
Expand Up @@ -34,7 +34,6 @@
#include "chromeos/ash/components/dbus/dbus_thread_manager.h"
#include "chromeos/ash/components/login/auth/public/user_context.h"
#include "chromeos/ash/components/multidevice/logging/logging.h"
#include "chromeos/ash/components/proximity_auth/proximity_auth_local_state_pref_manager.h"
#include "chromeos/ash/components/proximity_auth/proximity_auth_profile_pref_manager.h"
#include "chromeos/ash/components/proximity_auth/proximity_auth_system.h"
#include "chromeos/ash/components/proximity_auth/screenlock_bridge.h"
Expand Down Expand Up @@ -146,7 +145,6 @@ void EasyUnlockService::RegisterProfilePrefs(
// static
void EasyUnlockService::RegisterPrefs(PrefRegistrySimple* registry) {
registry->RegisterDictionaryPref(prefs::kEasyUnlockHardlockState);
proximity_auth::ProximityAuthLocalStatePrefManager::RegisterPrefs(registry);
}

// static
Expand All @@ -158,8 +156,7 @@ void EasyUnlockService::ResetLocalStateForUser(const AccountId& account_id) {
return;

for (const std::string& pref :
std::vector<std::string>{prefs::kEasyUnlockHardlockState,
prefs::kEasyUnlockLocalStateUserPrefs}) {
std::vector<std::string>{prefs::kEasyUnlockHardlockState}) {
ScopedDictPrefUpdate update(local_state, pref);
update->Remove(account_id.GetUserEmail());
}
Expand Down
1 change: 1 addition & 0 deletions chrome/browser/ash/login/easy_unlock/easy_unlock_service.h
Expand Up @@ -63,6 +63,7 @@ class EasyUnlockService : public KeyedService,
static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);

// Registers Easy Unlock local state entries.
// TODO(b/227674947): Delete
static void RegisterPrefs(PrefRegistrySimple* registry);

// Removes the hardlock state for the given user.
Expand Down
Expand Up @@ -186,8 +186,6 @@ void EasyUnlockServiceRegular::InitializeInternal() {
pref_manager_ =
std::make_unique<proximity_auth::ProximityAuthProfilePrefManager>(
profile()->GetPrefs(), multidevice_setup_client_);
pref_manager_->StartSyncingToLocalState(g_browser_process->local_state(),
GetAccountId());

// If `device_sync_client_` is not ready yet, wait for it to call back on
// OnReady().
Expand Down
15 changes: 15 additions & 0 deletions chrome/browser/prefs/browser_prefs.cc
Expand Up @@ -818,6 +818,11 @@ const char kGlanceablesSignoutScreenshotDuration[] =
"ash.signout_screenshot.duration";
#endif // BUILDFLAG(IS_CHROMEOS_ASH)

// Deprecated 03/2023.
#if BUILDFLAG(IS_CHROMEOS_ASH)
const char kEasyUnlockLocalStateUserPrefs[] = "easy_unlock.user_prefs";
#endif // BUILDFLAG(IS_CHROMEOS_ASH)

// Register local state used only for migration (clearing or moving to a new
// key).
void RegisterLocalStatePrefsForMigration(PrefRegistrySimple* registry) {
Expand Down Expand Up @@ -910,6 +915,11 @@ void RegisterLocalStatePrefsForMigration(PrefRegistrySimple* registry) {
registry->RegisterTimeDeltaPref(kGlanceablesSignoutScreenshotDuration,
base::TimeDelta());
#endif // BUILDFLAG(IS_CHROMEOS_ASH)

// Deprecated 03/2023.
#if BUILDFLAG(IS_CHROMEOS_ASH)
registry->RegisterDictionaryPref(kEasyUnlockLocalStateUserPrefs);
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
}

// Register prefs used only for migration (clearing or moving to a new key).
Expand Down Expand Up @@ -1882,6 +1892,11 @@ void MigrateObsoleteLocalStatePrefs(PrefService* local_state) {
local_state->ClearPref(kGlanceablesSignoutScreenshotDuration);
#endif // BUILDFLAG(IS_CHROMEOS_ASH)

// Added 03/2023.
#if BUILDFLAG(IS_CHROMEOS_ASH)
local_state->ClearPref(kEasyUnlockLocalStateUserPrefs);
#endif // BUILDFLAG(IS_CHROMEOS_ASH)

// Please don't delete the following line. It is used by PRESUBMIT.py.
// END_MIGRATE_OBSOLETE_LOCAL_STATE_PREFS

Expand Down
6 changes: 0 additions & 6 deletions chrome/common/pref_names.cc
Expand Up @@ -2923,12 +2923,6 @@ const char kCryptAuthInstanceIdToken[] = "cryptauth.instance_id_token";
// A dictionary that maps user id to hardlock state.
const char kEasyUnlockHardlockState[] = "easy_unlock.hardlock_state";

// A dictionary in local state containing each user's Easy Unlock profile
// preferences, so they can be accessed outside of the user's profile. The value
// is a dictionary containing an entry for each user. Each user's entry mirrors
// their profile's Easy Unlock preferences.
const char kEasyUnlockLocalStateUserPrefs[] = "easy_unlock.user_prefs";

// Boolean that indicates whether elevation is needed to recover Chrome upgrade.
const char kRecoveryComponentNeedsElevation[] =
"recovery_component.needs_elevation";
Expand Down
1 change: 0 additions & 1 deletion chrome/common/pref_names.h
Expand Up @@ -985,7 +985,6 @@ extern const char kCryptAuthDeviceId[];
extern const char kCryptAuthInstanceId[];
extern const char kCryptAuthInstanceIdToken[];
extern const char kEasyUnlockHardlockState[];
extern const char kEasyUnlockLocalStateUserPrefs[];

extern const char kRecoveryComponentNeedsElevation[];

Expand Down
3 changes: 0 additions & 3 deletions chromeos/ash/components/proximity_auth/BUILD.gn
Expand Up @@ -16,8 +16,6 @@ static_library("proximity_auth") {
"metrics.cc",
"metrics.h",
"proximity_auth_client.h",
"proximity_auth_local_state_pref_manager.cc",
"proximity_auth_local_state_pref_manager.h",
"proximity_auth_pref_manager.h",
"proximity_auth_pref_names.cc",
"proximity_auth_pref_names.h",
Expand Down Expand Up @@ -96,7 +94,6 @@ source_set("unit_tests") {
testonly = true
sources = [
"messenger_impl_unittest.cc",
"proximity_auth_local_state_pref_manager_unittest.cc",
"proximity_auth_profile_pref_manager_unittest.cc",
"proximity_auth_system_unittest.cc",
"proximity_monitor_impl_unittest.cc",
Expand Down

This file was deleted.

This file was deleted.

0 comments on commit afd3531

Please sign in to comment.