Commit 4d73a39a authored by Tanmoy Mollik's avatar Tanmoy Mollik Committed by Chromium LUCI CQ

[Android] Remove sign-out option for unicorn accounts in ManageSyncSettings page

If MOBILE_IDENTITY_CONSISTENCY is enabled, users are able to sign out
from ManageSyncSettings page. But unicorn account (child accounts)
should not be able to sign out from there. This cl checks for child
accounts before showing the sign out button in ManageSyncSettings page.

Also for child accounts sync should always be on. This cl also makes
sure that sync is not toggled off when all data types are toggled off
in ManageSyncSettings page.

Bug: 1159410
Change-Id: Iee7b79af72dc3313ebbccc4ea9850d9e937c625b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2595409Reviewed-by: default avatarBoris Sazonov <bsazonov@chromium.org>
Commit-Queue: Tanmoy Mollik <triploblastic@chromium.org>
Cr-Commit-Position: refs/heads/master@{#838008}
parent 74422a89
......@@ -205,9 +205,11 @@ public class ManageSyncSettings extends PreferenceFragmentCompat
mTurnOffSync.setOnPreferenceClickListener(
SyncSettingsUtils.toOnClickListener(this, this::onTurnOffSyncClicked));
Profile profile = Profile.getLastUsedRegularProfile();
if (ChromeFeatureList.isEnabled(ChromeFeatureList.MOBILE_IDENTITY_CONSISTENCY)
&& !mIsFromSigninScreen) {
mTurnOffSync.setVisible(true);
// Child profiles should not be able to sign out.
mTurnOffSync.setVisible(!profile.isChild());
findPreference(PREF_ADVANCED_CATEGORY).setVisible(true);
/**
......@@ -239,7 +241,6 @@ public class ManageSyncSettings extends PreferenceFragmentCompat
type.setOnPreferenceChangeListener(this);
}
Profile profile = Profile.getLastUsedRegularProfile();
if (profile.isChild()) {
mGoogleActivityControls.setSummary(
R.string.sign_in_google_activity_controls_summary_child_account);
......@@ -392,7 +393,9 @@ public class ManageSyncSettings extends PreferenceFragmentCompat
PersonalDataManager.setPaymentsIntegrationEnabled(mSyncEverything.isChecked()
|| (mSyncPaymentsIntegration.isChecked() && mSyncAutofill.isChecked()));
if (ChromeFeatureList.isEnabled(ChromeFeatureList.MOBILE_IDENTITY_CONSISTENCY)) {
// For child profiles sync should always be on.
if (ChromeFeatureList.isEnabled(ChromeFeatureList.MOBILE_IDENTITY_CONSISTENCY)
&& !Profile.getLastUsedRegularProfile().isChild()) {
boolean atLeastOneDataTypeEnabled =
mSyncEverything.isChecked() || selectedModelTypes.size() > 0;
if (mProfileSyncService.isSyncRequested() && !atLeastOneDataTypeEnabled) {
......
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