Cross Device: Remove Android Messages integration [part 5].
Remove and clear Android SMS prefs.
Bug: b/297567461
Test: none
Change-Id: I3e29afef80af41fcbd031a5f62e67d22b9294a3b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4912200
Reviewed-by: Jon Mann <[email protected]>
Auto-Submit: James Hawkins <[email protected]>
Reviewed-by: Alex Ilin <[email protected]>
Commit-Queue: Alex Ilin <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1205706}
diff --git a/chrome/browser/ash/android_sms/android_sms_app_manager_impl.cc b/chrome/browser/ash/android_sms/android_sms_app_manager_impl.cc
index 957a349..ac3a94ae 100644
--- a/chrome/browser/ash/android_sms/android_sms_app_manager_impl.cc
+++ b/chrome/browser/ash/android_sms/android_sms_app_manager_impl.cc
@@ -30,16 +30,8 @@
const PwaDomain kDomains[] = {PwaDomain::kProdAndroid, PwaDomain::kProdGoogle,
PwaDomain::kStaging};
-const char kLastSuccessfulDomainPref[] = "android_sms.last_successful_domain";
-
} // namespace
-// static
-void AndroidSmsAppManagerImpl::RegisterProfilePrefs(
- PrefRegistrySimple* registry) {
- registry->RegisterStringPref(kLastSuccessfulDomainPref, std::string());
-}
-
AndroidSmsAppManagerImpl::PwaDelegate::PwaDelegate() = default;
AndroidSmsAppManagerImpl::PwaDelegate::~PwaDelegate() = default;
@@ -142,8 +134,6 @@
}
void AndroidSmsAppManagerImpl::TearDownAndroidSmsApp() {
- pref_service_->SetString(kLastSuccessfulDomainPref, std::string());
-
absl::optional<GURL> installed_app_url = GetCurrentAppUrl();
if (!installed_app_url)
return;
@@ -152,12 +142,6 @@
base::DoNothing());
}
-bool AndroidSmsAppManagerImpl::HasAppBeenManuallyUninstalledByUser() {
- GURL url = GetAndroidMessagesURL(true /* use_install_url */);
- return pref_service_->GetString(kLastSuccessfulDomainPref) == url.spec() &&
- !setup_controller_->GetPwa(url);
-}
-
bool AndroidSmsAppManagerImpl::IsAppInstalled() {
if (GetInstalledPwaDomain())
return true;
@@ -243,9 +227,6 @@
return;
}
- if (success)
- pref_service_->SetString(kLastSuccessfulDomainPref, install_url.spec());
-
// If there is no PWA installed at the old URL, no migration is needed and
// setup is finished.
if (!migrating_from) {
diff --git a/chrome/browser/ash/android_sms/android_sms_app_manager_impl.h b/chrome/browser/ash/android_sms/android_sms_app_manager_impl.h
index 36c462a..87cb374 100644
--- a/chrome/browser/ash/android_sms/android_sms_app_manager_impl.h
+++ b/chrome/browser/ash/android_sms/android_sms_app_manager_impl.h
@@ -16,7 +16,6 @@
#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
-class PrefRegistrySimple;
class PrefService;
class Profile;
@@ -59,8 +58,6 @@
~AndroidSmsAppManagerImpl() override;
- static void RegisterProfilePrefs(PrefRegistrySimple* registry);
-
private:
friend class AndroidSmsAppManagerImplTest;
@@ -71,7 +68,6 @@
void SetUpAndroidSmsApp() override;
void SetUpAndLaunchAndroidSmsApp() override;
void TearDownAndroidSmsApp() override;
- bool HasAppBeenManuallyUninstalledByUser() override;
bool IsAppInstalled() override;
bool IsAppRegistryReady() override;
void ExecuteOnAppRegistryReady(base::OnceClosure task) override;
diff --git a/chrome/browser/ash/android_sms/android_sms_app_manager_impl_unittest.cc b/chrome/browser/ash/android_sms/android_sms_app_manager_impl_unittest.cc
index 55e48b8..8ccaf1e 100644
--- a/chrome/browser/ash/android_sms/android_sms_app_manager_impl_unittest.cc
+++ b/chrome/browser/ash/android_sms/android_sms_app_manager_impl_unittest.cc
@@ -28,7 +28,6 @@
const char kNewAppId[] = "newAppId";
const char kOldAppId[] = "oldAppId";
-const char kLastSuccessfulDomainPref[] = "android_sms.last_successful_domain";
GURL GetAndroidMessagesURLOld(bool use_install_url = false) {
// For this test, consider the staging server to be the "old" URL.
@@ -122,9 +121,6 @@
test_pref_service_ =
std::make_unique<sync_preferences::TestingPrefServiceSyncable>();
- AndroidSmsAppManagerImpl::RegisterProfilePrefs(
- test_pref_service_->registry());
-
auto test_pwa_delegate = std::make_unique<TestPwaDelegate>();
test_pwa_delegate_ = test_pwa_delegate.get();
android_sms_app_manager_ = std::make_unique<AndroidSmsAppManagerImpl>(
@@ -189,8 +185,6 @@
GetAndroidMessagesURL(true /* use_install_url */)));
EXPECT_FALSE(android_sms_app_manager()->GetCurrentAppUrl());
EXPECT_EQ(0u, test_observer()->num_installed_app_url_changed_events());
- EXPECT_EQ(std::string(),
- test_pref_service()->GetString(kLastSuccessfulDomainPref));
}
TEST_F(AndroidSmsAppManagerImplTest,
@@ -214,8 +208,6 @@
EXPECT_EQ(GetAndroidMessagesURL(),
*android_sms_app_manager()->GetCurrentAppUrl());
EXPECT_EQ(1u, test_observer()->num_installed_app_url_changed_events());
- EXPECT_EQ(install_url.spec(),
- test_pref_service()->GetString(kLastSuccessfulDomainPref));
// Now, tear down the app, which should remove the DefaultToPersist cookie.
android_sms_app_manager()->TearDownAndroidSmsApp();
@@ -227,8 +219,6 @@
->GetAppMetadataAtUrl(
GetAndroidMessagesURL(true /* use_install_url */))
->is_cookie_present);
- EXPECT_EQ(std::string(),
- test_pref_service()->GetString(kLastSuccessfulDomainPref));
}
TEST_F(AndroidSmsAppManagerImplTest, TestSetUpMessagesAndLaunch_NoPreviousApp) {
@@ -251,10 +241,6 @@
EXPECT_EQ(GetAndroidMessagesURL(),
*android_sms_app_manager()->GetCurrentAppUrl());
EXPECT_EQ(1u, test_observer()->num_installed_app_url_changed_events());
- EXPECT_EQ(install_url.spec(),
- test_pref_service()->GetString(kLastSuccessfulDomainPref));
- EXPECT_FALSE(
- android_sms_app_manager()->HasAppBeenManuallyUninstalledByUser());
// The app should have been launched.
EXPECT_EQ(kNewAppId, test_pwa_delegate()->opened_app_ids()[0]);
@@ -320,8 +306,6 @@
->is_cookie_present);
EXPECT_EQ(GetAndroidMessagesURL(),
*android_sms_app_manager()->GetCurrentAppUrl());
- EXPECT_EQ(install_url.spec(),
- test_pref_service()->GetString(kLastSuccessfulDomainPref));
EXPECT_EQ(std::make_pair(std::string(kOldAppId), std::string(kNewAppId)),
test_pwa_delegate()->transfer_item_attribute_params()[0]);
EXPECT_EQ(0u, test_observer()->num_installed_app_url_changed_events());
@@ -335,37 +319,6 @@
GetAndroidMessagesURL() /* expected_migrated_to_app_url */,
true /* success */);
EXPECT_EQ(1u, test_observer()->num_installed_app_url_changed_events());
- EXPECT_FALSE(
- android_sms_app_manager()->HasAppBeenManuallyUninstalledByUser());
-}
-
-TEST_F(AndroidSmsAppManagerImplTest, TestManualUninstall) {
- const GURL install_url = GetAndroidMessagesURL(true /* use_install_url */);
- CompleteAsyncInitialization();
-
- android_sms_app_manager()->SetUpAndroidSmsApp();
- fake_android_sms_app_setup_controller()->CompletePendingSetUpAppRequest(
- GetAndroidMessagesURL() /* expected_app_url */,
- install_url /* expected_install_url */, kNewAppId);
-
- // Verify that the app was installed and observers were notified.
- EXPECT_EQ(kNewAppId, fake_android_sms_app_setup_controller()
- ->GetAppMetadataAtUrl(GetAndroidMessagesURL(
- true /* use_install_url */))
- ->pwa);
- EXPECT_TRUE(fake_android_sms_app_setup_controller()
- ->GetAppMetadataAtUrl(install_url)
- ->is_cookie_present);
- EXPECT_EQ(GetAndroidMessagesURL(),
- *android_sms_app_manager()->GetCurrentAppUrl());
- EXPECT_EQ(1u, test_observer()->num_installed_app_url_changed_events());
- EXPECT_EQ(install_url.spec(),
- test_pref_service()->GetString(kLastSuccessfulDomainPref));
-
- // Now uninstall the app and verify that the app manager registers it.
- fake_android_sms_app_setup_controller()->SetAppAtUrl(install_url,
- absl::nullopt);
- EXPECT_TRUE(android_sms_app_manager()->HasAppBeenManuallyUninstalledByUser());
}
TEST_F(AndroidSmsAppManagerImplTest, TestGetCurrentAppUrl) {
diff --git a/chrome/browser/ash/android_sms/android_sms_service_factory.cc b/chrome/browser/ash/android_sms/android_sms_service_factory.cc
index 069d2792..2fdeef6 100644
--- a/chrome/browser/ash/android_sms/android_sms_service_factory.cc
+++ b/chrome/browser/ash/android_sms/android_sms_service_factory.cc
@@ -77,10 +77,5 @@
return true;
}
-void AndroidSmsServiceFactory::RegisterProfilePrefs(
- user_prefs::PrefRegistrySyncable* registry) {
- AndroidSmsAppManagerImpl::RegisterProfilePrefs(registry);
-}
-
} // namespace android_sms
} // namespace ash
diff --git a/chrome/browser/ash/android_sms/android_sms_service_factory.h b/chrome/browser/ash/android_sms/android_sms_service_factory.h
index f434f44..4e3e996 100644
--- a/chrome/browser/ash/android_sms/android_sms_service_factory.h
+++ b/chrome/browser/ash/android_sms/android_sms_service_factory.h
@@ -9,10 +9,6 @@
#include "chrome/browser/ash/android_sms/android_sms_service.h"
#include "components/keyed_service/content/browser_context_keyed_service_factory.h"
-namespace user_prefs {
-class PrefRegistrySyncable;
-} // namespace user_prefs
-
namespace ash {
namespace android_sms {
@@ -39,8 +35,6 @@
content::BrowserContext* context) const override;
bool ServiceIsCreatedWithBrowserContext() const override;
bool ServiceIsNULLWhileTesting() const override;
- void RegisterProfilePrefs(
- user_prefs::PrefRegistrySyncable* registry) override;
};
} // namespace android_sms
diff --git a/chrome/browser/prefs/browser_prefs.cc b/chrome/browser/prefs/browser_prefs.cc
index 72bcfa2..4c469af 100644
--- a/chrome/browser/prefs/browser_prefs.cc
+++ b/chrome/browser/prefs/browser_prefs.cc
@@ -560,28 +560,6 @@
const char kOriginTrialPrefKey[] = "origin_trials.persistent_trials";
#if BUILDFLAG(IS_CHROMEOS_ASH)
-// Deprecated 09/2022.
-constexpr char kClipboardHistoryNewFeatureBadgeCount[] =
- "ash.clipboard.multipaste_nudges.new_feature_shown_count";
-constexpr char kUsersLastInputMethod[] = "UsersLRUInputMethod";
-#endif // BUILDFLAG(IS_CHROMEOS_ASH)
-
-// Deprecated 09/2022.
-const char kPrivacySandboxFirstPartySetsDataAccessAllowed[] =
- "privacy_sandbox.first_party_sets_data_access_allowed";
-
-#if BUILDFLAG(IS_ANDROID)
-// Deprecated 09/2022.
-const char kDeprecatedAutofillAssistantConsent[] = "autofill_assistant_switch";
-const char kDeprecatedAutofillAssistantEnabled[] =
- "AUTOFILL_ASSISTANT_ONBOARDING_ACCEPTED";
-const char kDeprecatedAutofillAssistantTriggerScriptsEnabled[] =
- "Chrome.AutofillAssistant.ProactiveHelp";
-const char kDeprecatedAutofillAssistantTriggerScriptsIsFirstTimeUser[] =
- "Chrome.AutofillAssistant.LiteScriptFirstTimeUser";
-#endif // BUILDFLAG(IS_ANDROID)
-
-#if BUILDFLAG(IS_CHROMEOS_ASH)
// Deprecated 10/2022.
const char kSuggestedContentInfoShownInLauncher[] =
"ash.launcher.suggested_content_info_shown";
@@ -958,14 +936,15 @@
// Deprecated 10/2023.
inline constexpr char kSyncRequested[] = "sync.requested";
+// Deprecated 10/2023.
+#if BUILDFLAG(IS_CHROMEOS_ASH)
+const char kLastSuccessfulDomainPref[] = "android_sms.last_successful_domain";
+const char kShouldAttemptReenable[] = "android_sms.should_attempt_reenable";
+#endif // BUILDFLAG(IS_CHROMEOS_ASH)
+
// Register local state used only for migration (clearing or moving to a new
// key).
void RegisterLocalStatePrefsForMigration(PrefRegistrySimple* registry) {
-#if BUILDFLAG(IS_CHROMEOS_ASH)
- // Deprecated 09/2022
- registry->RegisterDictionaryPref(kUsersLastInputMethod);
-#endif // BUILDFLAG(IS_CHROMEOS_ASH)
-
// Deprecated 11/2022.
#if BUILDFLAG(ENABLE_BACKGROUND_MODE) && BUILDFLAG(IS_MAC)
registry->RegisterBooleanPref(kUserRemovedLoginItem, false);
@@ -1105,14 +1084,6 @@
registry->RegisterBooleanPref(kTokenServiceDiceCompatible, false);
#endif // BUILDFLAG(ENABLE_DICE_SUPPORT)
- // Deprecated 09/2022
- registry->RegisterBooleanPref(kPrivacySandboxFirstPartySetsDataAccessAllowed,
- true);
-
-#if BUILDFLAG(IS_CHROMEOS_ASH)
- registry->RegisterIntegerPref(kClipboardHistoryNewFeatureBadgeCount, 0);
-#endif // BUILDFLAG(IS_CHROMEOS_ASH)
-
#if BUILDFLAG(ENABLE_EXTENSIONS)
// Deprecated 10/2022.
registry->RegisterBooleanPref(kLoadCryptoTokenExtension, false);
@@ -1343,6 +1314,12 @@
registry->RegisterBooleanPref(kSettingsMigratedToUPM, false);
#endif
registry->RegisterBooleanPref(kSyncRequested, false);
+
+ // Deprecated 10/2023.
+#if BUILDFLAG(IS_CHROMEOS_ASH)
+ registry->RegisterStringPref(kLastSuccessfulDomainPref, std::string());
+ registry->RegisterBooleanPref(kShouldAttemptReenable, true);
+#endif // BUILDFLAG(IS_CHROMEOS_ASH)
}
void ClearSyncRequestedPrefAndMaybeMigrate(PrefService* profile_prefs) {
@@ -2073,11 +2050,6 @@
// BEGIN_MIGRATE_OBSOLETE_LOCAL_STATE_PREFS
// Please don't delete the preceding line. It is used by PRESUBMIT.py.
-#if BUILDFLAG(IS_CHROMEOS_ASH)
- // Added 09/2022
- local_state->ClearPref(kUsersLastInputMethod);
-#endif // BUILDFLAG(IS_CHROMEOS_ASH)
-
#if BUILDFLAG(ENABLE_BACKGROUND_MODE) && BUILDFLAG(IS_MAC)
// Added 11/2022.
local_state->ClearPref(kUserRemovedLoginItem);
@@ -2244,36 +2216,6 @@
profile_prefs->ClearPref(kTokenServiceDiceCompatible);
#endif // BUILDFLAG(ENABLE_DICE_SUPPORT)
- // Added 09/2022.
- profile_prefs->ClearPref(kPrivacySandboxFirstPartySetsDataAccessAllowed);
-
-#if BUILDFLAG(IS_CHROMEOS_ASH)
- // Added 09/2022.
- profile_prefs->ClearPref(kClipboardHistoryNewFeatureBadgeCount);
-#endif // BUILDFLAG(IS_CHROMEOS_ASH)
-
-// Added 09/2022.
-#if BUILDFLAG(IS_ANDROID)
- auto migrate_shared_pref = [profile_prefs](const std::string& source,
- const std::string& target) {
- if (absl::optional<bool> shared_pref =
- android::shared_preferences::GetAndClearBoolean(source);
- shared_pref) {
- profile_prefs->SetBoolean(target, shared_pref.value());
- }
- };
-
- // These settings will also need to be deleted from ChromePreferenceKeys.java.
- migrate_shared_pref(kDeprecatedAutofillAssistantConsent,
- kAutofillAssistantConsent);
- migrate_shared_pref(kDeprecatedAutofillAssistantEnabled,
- kAutofillAssistantEnabled);
- migrate_shared_pref(kDeprecatedAutofillAssistantTriggerScriptsEnabled,
- kAutofillAssistantTriggerScriptsEnabled);
- migrate_shared_pref(kDeprecatedAutofillAssistantTriggerScriptsIsFirstTimeUser,
- kAutofillAssistantTriggerScriptsIsFirstTimeUser);
-#endif
-
// Added 10/2022
#if BUILDFLAG(IS_ANDROID)
feed::MigrateObsoleteProfilePrefsOct_2022(profile_prefs);
@@ -2533,6 +2475,12 @@
// Added 10/2023.
ClearSyncRequestedPrefAndMaybeMigrate(profile_prefs);
+// Added 10/2023.
+#if BUILDFLAG(IS_CHROMEOS_ASH)
+ profile_prefs->ClearPref(kLastSuccessfulDomainPref);
+ profile_prefs->ClearPref(kShouldAttemptReenable);
+#endif // BUILDFLAG(IS_CHROMEOS_ASH)
+
// Please don't delete the following line. It is used by PRESUBMIT.py.
// END_MIGRATE_OBSOLETE_PROFILE_PREFS