[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/1323720
Reviewed-by: Marc Treib <treib@chromium.org>
Reviewed-by: Jochen Eisinger <jochen@chromium.org>
Commit-Queue: Boris Sazonov <bsazonov@chromium.org>
Cr-Commit-Position: refs/heads/master@{#607222}
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/preferences/SyncAndServicesPreferences.java b/chrome/android/java/src/org/chromium/chrome/browser/preferences/SyncAndServicesPreferences.java
index 14856f0..2476d847 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/preferences/SyncAndServicesPreferences.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/preferences/SyncAndServicesPreferences.java
@@ -696,6 +696,8 @@
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 @@
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);
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/sync/ui/SyncCustomizationFragment.java b/chrome/android/java/src/org/chromium/chrome/browser/sync/ui/SyncCustomizationFragment.java
index 90adce4..6c96e51 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/sync/ui/SyncCustomizationFragment.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/sync/ui/SyncCustomizationFragment.java
@@ -554,13 +554,10 @@
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 @@
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(