Commit 230c20ad authored by Tanmoy Mollik's avatar Tanmoy Mollik Committed by Chromium LUCI CQ

[Android] Clear chosen data types from UI when sync is off

If MOBILE_IDENTITY_CONSISTENCY is not enabled sync data type states are
retained even if the user toggles 'Sync your Chrome data' off in
SyncAndServicesSettings page.
This leads to an UI error when the user is migrated while in this state
that shows that all data types are enabled to sync even though sync is
shown as turned off in ManageSyncSettings page.

This state is impossible to reach if MOBILE_IDENTITY_CONSISTENCY is enabled.
This cl creates a fix to migrate existing users who are in that state.

Recording of the faulty behavior can be found on the bug.

Bug: 1151853
Change-Id: I9716a5ac001da9048e7fa6e46f789fb3e5116709
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2581929
Commit-Queue: Tanmoy Mollik <triploblastic@chromium.org>
Reviewed-by: default avatarMarc Treib <treib@chromium.org>
Cr-Commit-Position: refs/heads/master@{#836101}
parent e0742468
......@@ -209,6 +209,19 @@ public class ManageSyncSettings extends PreferenceFragmentCompat
&& !mIsFromSigninScreen) {
mTurnOffSync.setVisible(true);
findPreference(PREF_ADVANCED_CATEGORY).setVisible(true);
/**
* If MOBILE_IDENTITY_CONSISTENCY is disabled, sync data type states are retained even
* if the user toggles 'Sync your Chrome data' off in {@link SyncAndServicesSettings}
* page. This leads to an UI error that shows that all data types are enabled to sync
* even though sync is shown as turned off in {@link ManageSyncSettings} page.
* This state is impossible to reach if MOBILE_IDENTITY_CONSISTENCY is enabled.
* TODO(https://crbug.com/1065029): This code will be removed after
* MOBILE_IDENTITY_CONSISTENCY has been rolled out and existing users have been migrated
*/
if (!ProfileSyncService.get().isSyncRequested()) {
ProfileSyncService.get().setChosenDataTypes(false, new HashSet<>());
}
}
mGoogleActivityControls = findPreference(PREF_GOOGLE_ACTIVITY_CONTROLS);
......
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