Permalink
Browse files

- fx a bug where an account was marked as syncable if

  the only enabled sync adapter was marked as not syncable
  http://b/2441374

- allow one shot syncing even if the specific sync adapter
  doesn't have sync enabled. http://b/2403633
  • Loading branch information...
1 parent 6a10580 commit 5ae238080c1a48bd755858332bdae649e3a85231 @fredquintana fredquintana committed Feb 17, 2010
@@ -174,7 +174,7 @@ public void onCreate(Bundle icicle) {
updateAuthDescriptions();
onAccountsUpdated(AccountManager.get(this).getAccounts());
}
-
+
@Override
protected void onDestroy() {
super.onDestroy();
@@ -239,11 +239,7 @@ public boolean onPreferenceTreeClick(PreferenceScreen preferences, Preference pr
Account account = syncPref.getAccount();
boolean syncAutomatically = ContentResolver.getSyncAutomatically(account, authority);
if (syncPref.isOneTimeSyncMode()) {
- if (syncAutomatically) {
- requestOrCancelSync(account, authority, true);
- } else {
- showDialog(CANT_DO_ONETIME_SYNC_DIALOG);
- }
+ requestOrCancelSync(account, authority, true);
} else {
boolean syncOn = syncPref.isChecked();
boolean oldSyncState = syncAutomatically;
@@ -366,8 +362,9 @@ protected void onSyncStateUpdated() {
(ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
final boolean masterSyncAutomatically = ContentResolver.getMasterSyncAutomatically();
final boolean backgroundDataEnabled = connManager.getBackgroundDataSetting();
- syncPref.setOneTimeSyncMode(!masterSyncAutomatically || !backgroundDataEnabled);
- syncPref.setChecked(syncEnabled);
+ final boolean oneTimeSyncMode = !masterSyncAutomatically || !backgroundDataEnabled;
+ syncPref.setOneTimeSyncMode(oneTimeSyncMode);
+ syncPref.setChecked(oneTimeSyncMode || syncEnabled);
}
mErrorInfoView.setVisibility(syncIsFailing ? View.VISIBLE : View.GONE);
}
@@ -191,7 +191,8 @@ protected void onSyncStateUpdated() {
SyncStatusInfo status = ContentResolver.getSyncStatus(account, authority);
boolean syncEnabled = ContentResolver.getSyncAutomatically(account, authority)
&& masterSyncAutomatically
- && backgroundDataSetting;
+ && backgroundDataSetting
+ && (ContentResolver.getIsSyncable(account, authority) > 0);
boolean authorityIsPending = ContentResolver.isSyncPending(account, authority);
boolean activelySyncing = activeSyncValues != null
&& activeSyncValues.authority.equals(authority)

0 comments on commit 5ae2380

Please sign in to comment.