Clean up code to wipe WEB_APK DataTypeStore
This code was added to clean up data that might have been left behind
due to a past bug. It has now been around long enough that all the
leftover data should've been cleaned up, so the cleanup logic can be
removed now.
This CL is effectively a partial revert of https://crrev.com/c/5868109.
Fixed: 365978267
Change-Id: I9c022ad023265304b4995a732b0f9a6960119f77
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6534161
Reviewed-by: Mahmoud Rashad <[email protected]>
Commit-Queue: Marc Treib <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1458745}
diff --git a/chrome/browser/prefs/browser_prefs.cc b/chrome/browser/prefs/browser_prefs.cc
index 61746b09..b48408d 100644
--- a/chrome/browser/prefs/browser_prefs.cc
+++ b/chrome/browser/prefs/browser_prefs.cc
@@ -1100,6 +1100,12 @@
inline constexpr char kManagedPrivateNetworkAccessRestrictionsEnabled[] =
"managed_private_network_access_restrictions_enabled";
+#if BUILDFLAG(IS_ANDROID)
+// Deprecated 05/2025.
+inline constexpr char kWipedWebAPkDataForMigration[] =
+ "sync.wiped_web_apk_data_for_migration";
+#endif // BUILDFLAG(IS_ANDROID)
+
// Register local state used only for migration (clearing or moving to a new
// key).
void RegisterLocalStatePrefsForMigration(PrefRegistrySimple* registry) {
@@ -1549,6 +1555,11 @@
// Deprecated 05/2025
registry->RegisterBooleanPref(kManagedPrivateNetworkAccessRestrictionsEnabled,
false);
+
+ // Deprecated 05/2025.
+#if BUILDFLAG(IS_ANDROID)
+ registry->RegisterBooleanPref(kWipedWebAPkDataForMigration, false);
+#endif // BUILDFLAG(IS_ANDROID)
}
} // namespace
@@ -2842,6 +2853,11 @@
// Added 05/2025
profile_prefs->ClearPref(kManagedPrivateNetworkAccessRestrictionsEnabled);
+#if BUILDFLAG(IS_ANDROID)
+ // Added 05/2025.
+ profile_prefs->ClearPref(kWipedWebAPkDataForMigration);
+#endif // BUILDFLAG(IS_ANDROID)
+
// Please don't delete the following line. It is used by PRESUBMIT.py.
// END_MIGRATE_OBSOLETE_PROFILE_PREFS
diff --git a/components/sync/base/pref_names.h b/components/sync/base/pref_names.h
index d6821e4..3f17b32 100644
--- a/components/sync/base/pref_names.h
+++ b/components/sync/base/pref_names.h
@@ -154,13 +154,6 @@
inline constexpr char kFirstTimeTriedToMigrateSyncFeaturePausedToSignin[] =
"sync.first_time_tried_to_migrate_sync_feature_paused_to_signin";
-#if BUILDFLAG(IS_ANDROID)
-// Name of a boolean pref recording whether the WEB_APK data went through a
-// one-off wipe to fix crbug.com/361771496.
-inline constexpr char kWipedWebAPkDataForMigration[] =
- "sync.wiped_web_apk_data_for_migration";
-#endif // BUILDFLAG(IS_ANDROID)
-
} // namespace internal
} // namespace syncer::prefs
diff --git a/components/sync/model/data_type_store_service_impl.cc b/components/sync/model/data_type_store_service_impl.cc
index daed3e1..04b1c99 100644
--- a/components/sync/model/data_type_store_service_impl.cc
+++ b/components/sync/model/data_type_store_service_impl.cc
@@ -36,14 +36,11 @@
constexpr base::FilePath::CharType kLevelDBFolderName[] =
FILE_PATH_LITERAL("LevelDB");
-constexpr const char kLegacyWebApkPrefix[] = "web_apks";
-
// Initializes DataTypeStoreBackend, on the backend sequence.
std::optional<ModelError> InitOnBackendSequence(
const base::FilePath& level_db_path,
scoped_refptr<DataTypeStoreBackend> store_backend,
- bool migrate_rl_from_local_to_account,
- bool wipe_legacy_webapks) {
+ bool migrate_rl_from_local_to_account) {
base::flat_map<std::string, std::optional<std::string>>
prefixes_to_update_or_delete;
if (migrate_rl_from_local_to_account) {
@@ -55,14 +52,6 @@
RecordSyncToSigninMigrationReadingListStep(
ReadingListMigrationStep::kMigrationStarted);
}
- if (wipe_legacy_webapks) {
- // Wipe all WEB_APK data to fix crbug.com/361771496. This won't cause any
- // apps to be uninstalled, such data is only a mirror of the source of
- // truth.
- // std::nullopt in the map below means a deletion.
- // TODO(crbug.com/365978267): Remove migration after enough time.
- prefixes_to_update_or_delete.emplace(kLegacyWebApkPrefix, std::nullopt);
- }
return store_backend->Init(level_db_path, prefixes_to_update_or_delete);
}
@@ -137,16 +126,10 @@
DCHECK(backend_task_runner_);
bool migrate_rl_from_local_to_account = pref_service_->GetBoolean(
prefs::internal::kMigrateReadingListFromLocalToAccount);
- bool wipe_legacy_webapks =
-#if BUILDFLAG(IS_ANDROID)
- !pref_service_->GetBoolean(prefs::internal::kWipedWebAPkDataForMigration);
-#else
- false;
-#endif // BUILDFLAG(IS_ANDROID)
backend_task_runner_->PostTaskAndReplyWithResult(
FROM_HERE,
base::BindOnce(&InitOnBackendSequence, leveldb_path_, store_backend_,
- migrate_rl_from_local_to_account, wipe_legacy_webapks),
+ migrate_rl_from_local_to_account),
base::BindOnce(&DataTypeStoreServiceImpl::BackendInitializationDone,
weak_ptr_factory_.GetWeakPtr()));
}
@@ -171,12 +154,6 @@
error ? ReadingListMigrationStep::kMigrationFailed
: ReadingListMigrationStep::kMigrationFinishedAndPrefCleared);
}
-#if BUILDFLAG(IS_ANDROID)
- if (!error) {
- pref_service_->SetBoolean(prefs::internal::kWipedWebAPkDataForMigration,
- true);
- }
-#endif // BUILDFLAG(IS_ANDROID)
base::UmaHistogramBoolean("Sync.DataTypeStoreBackendInitializationSuccess",
!error.has_value());
diff --git a/components/sync/model/data_type_store_service_impl_unittest.cc b/components/sync/model/data_type_store_service_impl_unittest.cc
index 7a118ba..35fc44f7 100644
--- a/components/sync/model/data_type_store_service_impl_unittest.cc
+++ b/components/sync/model/data_type_store_service_impl_unittest.cc
@@ -80,10 +80,6 @@
DataTypeStoreServiceImplTest() {
pref_service_.registry()->RegisterBooleanPref(
prefs::internal::kMigrateReadingListFromLocalToAccount, false);
-#if BUILDFLAG(IS_ANDROID)
- pref_service_.registry()->RegisterBooleanPref(
- prefs::internal::kWipedWebAPkDataForMigration, false);
-#endif // BUILDFLAG(IS_ANDROID)
}
protected:
diff --git a/components/sync/service/sync_prefs.cc b/components/sync/service/sync_prefs.cc
index b49c850e..bcc94ef7a 100644
--- a/components/sync/service/sync_prefs.cc
+++ b/components/sync/service/sync_prefs.cc
@@ -206,10 +206,6 @@
registry->RegisterTimePref(
prefs::internal::kFirstTimeTriedToMigrateSyncFeaturePausedToSignin,
base::Time());
-#if BUILDFLAG(IS_ANDROID)
- registry->RegisterBooleanPref(prefs::internal::kWipedWebAPkDataForMigration,
- false);
-#endif // BUILDFLAG(IS_ANDROID)
SyncFeatureStatusForMigrationsRecorder::RegisterProfilePrefs(registry);