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

Merge commit '14495c05f69db71311002b077280782ed4154fc4' into kraken

* commit '14495c05f69db71311002b077280782ed4154fc4':
  Send callback if reloadFolderList fails w/ uninit'ed account
This commit is contained in:
Marc Blank 2010-04-13 11:54:26 -07:00 committed by Android Git Automerger
commit 4621489f99
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;
}