Commit 46ebe889 authored by Boris Sazonov's avatar Boris Sazonov Committed by Commit Bot

[Android] Don't disable passwords checkbox in SyncAndServicesPreferences

This CL removes passwords checkbox enabled state dependency on
ProfileSyncService::IsCryptographerReady(). This datatype can be
configured without cryptographer being ready (that's what other
platforms do) and removing this dependency fixes issues when this
checkbox was spontaneously becoming disabled.

Bug: 902880
Change-Id: I58f8b1b0375bc2bdfb77c1db1cf3f998020b935d
Reviewed-on: https://chromium-review.googlesource.com/c/1323720Reviewed-by: default avatarMarc Treib <treib@chromium.org>
Reviewed-by: default avatarJochen Eisinger <jochen@chromium.org>
Commit-Queue: Boris Sazonov <bsazonov@chromium.org>
Cr-Commit-Position: refs/heads/master@{#607222}
parent 4939a281
......@@ -696,6 +696,8 @@ public class SyncAndServicesPreferences extends PreferenceFragment
mSyncBookmarks.setEnabled(true);
mSyncHistory.setChecked(syncTypes.contains(ModelType.TYPED_URLS));
mSyncHistory.setEnabled(true);
mSyncPasswords.setChecked(syncTypes.contains(ModelType.PASSWORDS));
mSyncPasswords.setEnabled(true);
mSyncRecentTabs.setChecked(syncTypes.contains(ModelType.PROXY_TABS));
mSyncRecentTabs.setEnabled(true);
mSyncSettings.setChecked(syncTypes.contains(ModelType.PREFERENCES));
......@@ -707,11 +709,6 @@ public class SyncAndServicesPreferences extends PreferenceFragment
syncAutofill && PersonalDataManager.isPaymentsIntegrationEnabled());
mSyncPaymentsIntegration.setEnabled(syncAutofill);
boolean passwordsConfigurable = mProfileSyncService.isEngineInitialized()
&& mProfileSyncService.isCryptographerReady();
mSyncPasswords.setChecked(passwordsConfigurable && syncTypes.contains(ModelType.PASSWORDS));
mSyncPasswords.setEnabled(passwordsConfigurable);
// USER_EVENTS sync type doesn't work with custom passphrase and needs history sync
boolean userEventsConfigurable =
!hasCustomPassphrase() && syncTypes.contains(ModelType.TYPED_URLS);
......
......@@ -554,13 +554,10 @@ public class SyncCustomizationFragment extends PreferenceFragment
private void updateDataTypeState() {
boolean isSyncEnabled = mSyncSwitchPreference.isChecked();
boolean syncEverything = mSyncEverything.isChecked();
boolean passwordSyncConfigurable = mProfileSyncService.isEngineInitialized()
&& mProfileSyncService.isCryptographerReady();
Set<Integer> syncTypes = mProfileSyncService.getPreferredDataTypes();
boolean syncAutofill = syncTypes.contains(ModelType.AUTOFILL);
for (CheckBoxPreference pref : mAllTypes) {
boolean canSyncType = true;
if (pref == mSyncPasswords) canSyncType = passwordSyncConfigurable;
if (pref == mPaymentsIntegration) {
canSyncType = syncAutofill || syncEverything;
}
......@@ -577,8 +574,7 @@ public class SyncCustomizationFragment extends PreferenceFragment
mSyncAutofill.setChecked(syncAutofill);
mSyncBookmarks.setChecked(syncTypes.contains(ModelType.BOOKMARKS));
mSyncOmnibox.setChecked(syncTypes.contains(ModelType.TYPED_URLS));
mSyncPasswords.setChecked(passwordSyncConfigurable
&& syncTypes.contains(ModelType.PASSWORDS));
mSyncPasswords.setChecked(syncTypes.contains(ModelType.PASSWORDS));
mSyncRecentTabs.setChecked(syncTypes.contains(ModelType.PROXY_TABS));
mSyncSettings.setChecked(syncTypes.contains(ModelType.PREFERENCES));
mPaymentsIntegration.setChecked(
......
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