From 466eb2dcd2660bf0e5d8d1440db598a30ca184f3 Mon Sep 17 00:00:00 2001 From: Martin Hibdon Date: Wed, 28 Aug 2013 15:07:57 -0700 Subject: [PATCH] Prevent simultaneous imap and pop syncs b/10527550 I'm not yet sure why we're getting this started in multiple threads, but the methods where the sync occurs are now synchronized so they can't happen at the same time. Change-Id: Icf7afd336ed056bb42df84b8634117afa8f31213 --- src/com/android/email/service/ImapService.java | 6 +++--- src/com/android/email/service/Pop3Service.java | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/com/android/email/service/ImapService.java b/src/com/android/email/service/ImapService.java index 0c73acd1c..0b06a3e70 100644 --- a/src/com/android/email/service/ImapService.java +++ b/src/com/android/email/service/ImapService.java @@ -172,7 +172,7 @@ public class ImapService extends Service { nc.cancelLoginFailedNotification(account.mId); } catch (MessagingException e) { if (Logging.LOGD) { - LogUtils.v(Logging.LOG_TAG, "synchronizeMailboxSynchronous", e); + LogUtils.d(Logging.LOG_TAG, "synchronizeMailboxSynchronous", e); } if (e instanceof AuthenticationFailedException) { // Generate authentication notification @@ -342,11 +342,11 @@ public class ImapService extends Service { * @return results of the sync pass * @throws MessagingException */ - private static void synchronizeMailboxGeneric(final Context context, final Account account, + private synchronized static void synchronizeMailboxGeneric(final Context context, final Account account, final Mailbox mailbox, final boolean loadMore, final boolean uiRefresh) throws MessagingException { - LogUtils.v(Logging.LOG_TAG, "synchronizeMailboxGeneric " + account + " " + mailbox + " " + LogUtils.d(Logging.LOG_TAG, "synchronizeMailboxGeneric " + account + " " + mailbox + " " + loadMore + " " + uiRefresh); final ArrayList unseenMessages = new ArrayList(); diff --git a/src/com/android/email/service/Pop3Service.java b/src/com/android/email/service/Pop3Service.java index 50edb68fd..4fdacfb71 100644 --- a/src/com/android/email/service/Pop3Service.java +++ b/src/com/android/email/service/Pop3Service.java @@ -233,7 +233,7 @@ public class Pop3Service extends Service { * @param deltaMessageCount the requested change to number of messages to sync * @throws MessagingException */ - private static void synchronizePop3Mailbox(final Context context, final Account account, + private synchronized static void synchronizePop3Mailbox(final Context context, final Account account, final Mailbox mailbox, final int deltaMessageCount) throws MessagingException { // TODO Break this into smaller pieces ContentResolver resolver = context.getContentResolver();