private void updateDataTypeState(){
  boolean isSyncEnabled=mSyncSwitchPreference.isChecked();
  boolean syncEverything=mSyncEverything.isChecked();
  boolean passwordSyncConfigurable=mProfileSyncService.isSyncInitialized() && mProfileSyncService.isCryptographerReady();
  for (  CheckBoxPreference pref : mAllTypes) {
    boolean canSyncType=pref != mSyncPasswords || passwordSyncConfigurable;
    if (!isSyncEnabled) {
      pref.setChecked(true);
    }
 else     if (syncEverything) {
      pref.setChecked(canSyncType);
    }
    pref.setEnabled(isSyncEnabled && !syncEverything && canSyncType);
  }
  if (isSyncEnabled && !syncEverything) {
    Set<Integer> syncTypes=mProfileSyncService.getPreferredDataTypes();
    mSyncAutofill.setChecked(syncTypes.contains(ModelType.AUTOFILL));
    mSyncBookmarks.setChecked(syncTypes.contains(ModelType.BOOKMARKS));
    mSyncOmnibox.setChecked(syncTypes.contains(ModelType.TYPED_URLS));
    mSyncPasswords.setChecked(passwordSyncConfigurable && syncTypes.contains(ModelType.PASSWORDS));
    mSyncRecentTabs.setChecked(syncTypes.contains(ModelType.PROXY_TABS));
    mSyncSettings.setChecked(syncTypes.contains(ModelType.PRIORITY_PREFERENCES));
  }
}

private void updateDataTypeState ( ) { boolean isSyncEnabled = mSyncSwitchPreference . isChecked ( ) ; boolean syncEverything = mSyncEverything . isChecked ( ) ; boolean passwordSyncConfigurable = mProfileSyncService . isSyncInitialized ( ) && mProfileSyncService . isCryptographerReady ( ) ; for ( CheckBoxPreference pref : mAllTypes ) { boolean canSyncType = pref != mSyncPasswords || passwordSyncConfigurable ; if ( ! isSyncEnabled ) { pref . setChecked ( true ) ; } else if ( syncEverything ) { pref . setChecked ( canSyncType ) ; } pref . setEnabled ( isSyncEnabled && ! syncEverything && canSyncType ) ; } if ( isSyncEnabled && ! syncEverything ) { Set < Integer > syncTypes = mProfileSyncService . getPreferredDataTypes ( ) ; mSyncAutofill . setChecked ( syncTypes . contains ( ModelType . AUTOFILL ) ) ; mSyncBookmarks . setChecked ( syncTypes . contains ( ModelType . BOOKMARKS ) ) ; mSyncOmnibox . setChecked ( syncTypes . contains ( ModelType . TYPED_URLS ) ) ; mSyncPasswords . setChecked ( passwordSyncConfigurable && syncTypes . contains ( ModelType . PASSWORDS ) ) ; mSyncRecentTabs . setChecked ( syncTypes . contains ( ModelType . PROXY_TABS ) ) ; mSyncSettings . setChecked ( syncTypes . contains ( ModelType . PRIORITY_PREFERENCES ) ) ; } }
update the data type switch state . if sync is on , load the prefs from native . otherwise , all data types are disabled and checked . note that the password data type will be shown as disabled and unchecked between sync being turned on and the backend initialization completing .
