am ff0c1f63
: Merge change Ic2d782c1 into eclair-mr2
Merge commit 'ff0c1f631348f0cdfa6733b37e2a65202a434923' into eclair-mr2-plus-aosp * commit 'ff0c1f631348f0cdfa6733b37e2a65202a434923': Add checks to prevent duplicate service starts (fixes #2099830)
This commit is contained in:
commit
f9191a955a
@ -1285,7 +1285,9 @@ public class SyncManager extends Service implements Runnable {
|
|||||||
synchronized (sSyncToken) {
|
synchronized (sSyncToken) {
|
||||||
Account acct = Account.restoreAccountWithId(this, m.mAccountKey);
|
Account acct = Account.restoreAccountWithId(this, m.mAccountKey);
|
||||||
if (acct != null) {
|
if (acct != null) {
|
||||||
AbstractSyncService service;
|
// Always make sure there's not a running instance of this service
|
||||||
|
AbstractSyncService service = mServiceMap.get(m.mId);
|
||||||
|
if (service == null) {
|
||||||
service = new EasSyncService(this, m);
|
service = new EasSyncService(this, m);
|
||||||
service.mSyncReason = reason;
|
service.mSyncReason = reason;
|
||||||
if (req != null) {
|
if (req != null) {
|
||||||
@ -1295,6 +1297,7 @@ public class SyncManager extends Service implements Runnable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void stopServices() {
|
private void stopServices() {
|
||||||
synchronized (sSyncToken) {
|
synchronized (sSyncToken) {
|
||||||
@ -1480,7 +1483,6 @@ public class SyncManager extends Service implements Runnable {
|
|||||||
deletedMailboxes.add(mailboxId);
|
deletedMailboxes.add(mailboxId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
// If so, stop them or remove them from the map
|
// If so, stop them or remove them from the map
|
||||||
for (Long mailboxId: deletedMailboxes) {
|
for (Long mailboxId: deletedMailboxes) {
|
||||||
AbstractSyncService svc = mServiceMap.get(mailboxId);
|
AbstractSyncService svc = mServiceMap.get(mailboxId);
|
||||||
@ -1495,6 +1497,7 @@ public class SyncManager extends Service implements Runnable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
long nextWait = SYNC_MANAGER_HEARTBEAT_TIME;
|
long nextWait = SYNC_MANAGER_HEARTBEAT_TIME;
|
||||||
long now = System.currentTimeMillis();
|
long now = System.currentTimeMillis();
|
||||||
@ -1507,7 +1510,10 @@ public class SyncManager extends Service implements Runnable {
|
|||||||
try {
|
try {
|
||||||
while (c.moveToNext()) {
|
while (c.moveToNext()) {
|
||||||
long mid = c.getLong(Mailbox.CONTENT_ID_COLUMN);
|
long mid = c.getLong(Mailbox.CONTENT_ID_COLUMN);
|
||||||
AbstractSyncService service = mServiceMap.get(mid);
|
AbstractSyncService service = null;
|
||||||
|
synchronized (sSyncToken) {
|
||||||
|
service = mServiceMap.get(mid);
|
||||||
|
}
|
||||||
if (service == null) {
|
if (service == null) {
|
||||||
// Check whether we're in a hold (temporary or permanent)
|
// Check whether we're in a hold (temporary or permanent)
|
||||||
SyncError syncError = mSyncErrorMap.get(mid);
|
SyncError syncError = mSyncErrorMap.get(mid);
|
||||||
|
Loading…
Reference in New Issue
Block a user