am 63186a54: Send callback if reloadFolderList fails w/ uninit\'ed account

Merge commit '63186a5442f8310b25602235622c3669a4e5b1ec' into froyo-plus-aosp

* commit '63186a5442f8310b25602235622c3669a4e5b1ec':
  Send callback if reloadFolderList fails w/ uninit'ed account
This commit is contained in:
Marc Blank 2010-04-13 10:48:11 -07:00 committed by Android Git Automerger
commit 14495c05f6
2 changed files with 13 additions and 0 deletions

View File

@ -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;

View File

@ -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;
}