am 5a0b3230: Merge "Add account type check for invisible sync adapters."

* commit '5a0b3230e2a70c5837b35753fdd2ffd7536946f4':
  Add account type check for invisible sync adapters.
This commit is contained in:
Jean-Baptiste Queru
2012-06-08 08:21:39 -07:00
committed by Android Git Automerger

View File

@@ -79,7 +79,7 @@ public class AccountSyncSettings extends AccountPreferenceBase {
private Account[] mAccounts; private Account[] mAccounts;
private ArrayList<SyncStateCheckBoxPreference> mCheckBoxes = private ArrayList<SyncStateCheckBoxPreference> mCheckBoxes =
new ArrayList<SyncStateCheckBoxPreference>(); new ArrayList<SyncStateCheckBoxPreference>();
private ArrayList<String> mInvisibleAdapters = Lists.newArrayList(); private ArrayList<SyncAdapterType> mInvisibleAdapters = Lists.newArrayList();
@Override @Override
public Dialog onCreateDialog(final int id) { public Dialog onCreateDialog(final int id) {
@@ -321,8 +321,11 @@ public class AccountSyncSettings extends AccountPreferenceBase {
} }
// plus whatever the system needs to sync, e.g., invisible sync adapters // plus whatever the system needs to sync, e.g., invisible sync adapters
if (mAccount != null) { if (mAccount != null) {
for (String authority : mInvisibleAdapters) { for (SyncAdapterType syncAdapter : mInvisibleAdapters) {
requestOrCancelSync(mAccount, authority, startSync); // invisible sync adapters' account type should be same as current account type
if (syncAdapter.accountType.equals(mAccount.type)) {
requestOrCancelSync(mAccount, syncAdapter.authority, startSync);
}
} }
} }
} }
@@ -452,7 +455,7 @@ public class AccountSyncSettings extends AccountPreferenceBase {
} else { } else {
// keep track of invisible sync adapters, so sync now forces // keep track of invisible sync adapters, so sync now forces
// them to sync as well. // them to sync as well.
mInvisibleAdapters.add(sa.authority); mInvisibleAdapters.add(sa);
} }
} }