Fix 2026451 (folder list update callback not being made)
* Make sure updateFolderList service call stops the account mailbox sync
* Make sure SyncManager is kicked so that it will restart (and thus do
a folder list sync)
diff --git a/src/com/android/exchange/EasSyncService.java b/src/com/android/exchange/EasSyncService.java
index 8c481d4..91b105f 100644
--- a/src/com/android/exchange/EasSyncService.java
+++ b/src/com/android/exchange/EasSyncService.java
@@ -426,7 +426,7 @@
* @throws IOException
* @throws EasParserException
*/
- public void runMain() throws IOException, EasParserException {
+ public void runAccountMailbox() throws IOException, EasParserException {
// Initialize exit status to success
mExitStatus = EmailServiceStatus.SUCCESS;
try {
@@ -882,11 +882,14 @@
// Make sure account and mailbox are always the latest from the database
mAccount = Account.restoreAccountWithId(mContext, mAccount.mId);
mMailbox = Mailbox.restoreMailboxWithId(mContext, mMailbox.mId);
+ // Whether or not we're the account mailbox
+ boolean accountMailbox = false;
try {
if (mMailbox == null || mAccount == null) {
return;
} else if (mMailbox.mServerId.equals(Eas.ACCOUNT_MAILBOX)) {
- runMain();
+ accountMailbox = true;
+ runAccountMailbox();
} else {
EasSyncAdapter target;
mAccount = Account.restoreAccountWithId(mContext, mAccount.mId);
@@ -916,7 +919,12 @@
} finally {
userLog(mMailbox.mDisplayName + ": sync finished");
SyncManager.done(this);
-
+ // If this is the account mailbox, wake up SyncManager
+ // Because this box has a "push" interval, it will be restarted immediately
+ // which will cause the folder list to be reloaded...
+ if (accountMailbox) {
+ SyncManager.kick();
+ }
try {
int status;
switch (mExitStatus) {
diff --git a/src/com/android/exchange/SyncManager.java b/src/com/android/exchange/SyncManager.java
index 86529ee..183c394 100644
--- a/src/com/android/exchange/SyncManager.java
+++ b/src/com/android/exchange/SyncManager.java
@@ -184,8 +184,9 @@
synchronized(mSyncToken) {
AbstractSyncService svc =
INSTANCE.mServiceMap.get(c.getLong(Mailbox.CONTENT_ID_COLUMN));
- // TODO See if this is sufficient. Low priority since there is no
- // user-driven "update folder list" in the UI
+ // Tell the service we're done
+ svc.stop();
+ // Interrupt it so that it can stop
svc.mThread.interrupt();
}
}