am a2496548: am c901810f: Start sync ASAP when calendar is re-enabled

Merge commit 'a2496548c6ed07cb6cb3820c9922a0e96ca2b8a4' into kraken

* commit 'a2496548c6ed07cb6cb3820c9922a0e96ca2b8a4':
  Start sync ASAP when calendar is re-enabled
This commit is contained in:
Marc Blank 2010-05-10 09:49:51 -07:00 committed by Android Git Automerger
commit c98be369ec

View File

@ -760,6 +760,9 @@ public class SyncManager extends Service implements Runnable {
mResolver.delete(eventsAsSyncAdapter, WHERE_CALENDAR_ID,
new String[] {Long.toString(mCalendarId)});
} else {
// If we're in a ping, stop it so that calendar sync can
// start right away
stopPing(mAccountId);
kick("calendar sync changed");
}
@ -1702,15 +1705,17 @@ public class SyncManager extends Service implements Runnable {
*/
private void stopPing(long accountId) {
// Go through our active mailboxes looking for the right one
for (long mailboxId: mServiceMap.keySet()) {
Mailbox m = Mailbox.restoreMailboxWithId(this, mailboxId);
if (m != null) {
String serverId = m.mServerId;
if (m.mAccountKey == accountId && serverId != null &&
serverId.startsWith(Eas.ACCOUNT_MAILBOX_PREFIX)) {
// Here's our account mailbox; reset him (stopping pings)
AbstractSyncService svc = mServiceMap.get(mailboxId);
svc.reset();
synchronized (sSyncLock) {
for (long mailboxId: mServiceMap.keySet()) {
Mailbox m = Mailbox.restoreMailboxWithId(this, mailboxId);
if (m != null) {
String serverId = m.mServerId;
if (m.mAccountKey == accountId && serverId != null &&
serverId.startsWith(Eas.ACCOUNT_MAILBOX_PREFIX)) {
// Here's our account mailbox; reset him (stopping pings)
AbstractSyncService svc = mServiceMap.get(mailboxId);
svc.reset();
}
}
}
}