From 63186a5442f8310b25602235622c3669a4e5b1ec Mon Sep 17 00:00:00 2001 From: Marc Blank Date: Tue, 13 Apr 2010 10:17:54 -0700 Subject: [PATCH] Send callback if reloadFolderList fails w/ uninit'ed account Bug: 2585159 Change-Id: I12d9dd84090d10675e3d403124e28dbb6bede3d8 --- .../android/email/service/EmailServiceStatus.java | 1 + src/com/android/exchange/SyncManager.java | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/src/com/android/email/service/EmailServiceStatus.java b/src/com/android/email/service/EmailServiceStatus.java index f5e7eba67..135797637 100644 --- a/src/com/android/email/service/EmailServiceStatus.java +++ b/src/com/android/email/service/EmailServiceStatus.java @@ -32,6 +32,7 @@ public interface EmailServiceStatus { public static final int REMOTE_EXCEPTION = 0x15; public static final int LOGIN_FAILED = 0x16; public static final int SECURITY_FAILURE = 0x17; + public static final int ACCOUNT_UNINITIALIZED = 0x18; // Maybe we should automatically retry these? public static final int CONNECTION_ERROR = 0x20; diff --git a/src/com/android/exchange/SyncManager.java b/src/com/android/exchange/SyncManager.java index 9772515d7..3f7918cd5 100644 --- a/src/com/android/exchange/SyncManager.java +++ b/src/com/android/exchange/SyncManager.java @@ -31,6 +31,7 @@ import com.android.email.provider.EmailContent.Mailbox; import com.android.email.provider.EmailContent.MailboxColumns; import com.android.email.provider.EmailContent.Message; import com.android.email.provider.EmailContent.SyncColumns; +import com.android.email.service.EmailServiceStatus; import com.android.email.service.IEmailService; import com.android.email.service.IEmailServiceCallback; import com.android.exchange.adapter.CalendarSyncAdapter; @@ -1177,6 +1178,15 @@ public class SyncManager extends Service implements Runnable { } } + static private void reloadFolderListFailed(long accountId) { + try { + callback().syncMailboxListStatus(accountId, + EmailServiceStatus.ACCOUNT_UNINITIALIZED, 0); + } catch (RemoteException e1) { + // Don't care if this fails + } + } + static public void reloadFolderList(Context context, long accountId, boolean force) { SyncManager syncManager = INSTANCE; if (syncManager == null) return; @@ -1191,11 +1201,13 @@ public class SyncManager extends Service implements Runnable { Mailbox m = new Mailbox().restore(c); Account acct = Account.restoreAccountWithId(context, accountId); if (acct == null) { + reloadFolderListFailed(accountId); return; } String syncKey = acct.mSyncKey; // No need to reload the list if we don't have one if (!force && (syncKey == null || syncKey.equals("0"))) { + reloadFolderListFailed(accountId); return; }