Fix delay sending mail after tapping "Send outgoing mail" DO NOT MERGE
* Fixes #2317429 * When "Send outgoing messages" is tapped in Outbox MessageList view, we clear the error state for all "stuck" messages * We didn't, however, clear the error state of the Mailbox, which doesn't clear itself until the end of a pingLoop, which can be up to 30 minutes * The fix is in two parts: * We clear the error state of the Outbox when a sync is requested by the UI * We don't set the error state of the mailbox for non-auth errors when sending, because we don't want to block OTHER messages from getting sent. Change-Id: I06d98e54049b01c2156b1bc3ebbccf043e7b93f5
This commit is contained in:
parent
14d3745f95
commit
23a1cfc8a8
@ -46,7 +46,7 @@ public class EasOutboxService extends EasSyncService {
|
||||
|
||||
public static final int SEND_FAILED = 1;
|
||||
public static final String MAILBOX_KEY_AND_NOT_SEND_FAILED =
|
||||
MessageColumns.MAILBOX_KEY + "=? and (" + SyncColumns.SERVER_ID + " is null or " +
|
||||
MessageColumns.MAILBOX_KEY + "=? and (" + SyncColumns.SERVER_ID + " is null or " +
|
||||
SyncColumns.SERVER_ID + "!=" + SEND_FAILED + ')';
|
||||
public static final String[] BODY_SOURCE_PROJECTION =
|
||||
new String[] {BodyColumns.SOURCE_MESSAGE_KEY};
|
||||
@ -150,9 +150,13 @@ public class EasOutboxService extends EasSyncService {
|
||||
ContentValues cv = new ContentValues();
|
||||
cv.put(SyncColumns.SERVER_ID, SEND_FAILED);
|
||||
Message.update(mContext, Message.CONTENT_URI, msgId, cv);
|
||||
result = EmailServiceStatus.REMOTE_EXCEPTION;
|
||||
// We mark the result as SUCCESS on a non-auth failure since the message itself is
|
||||
// already marked failed and we don't want to stop other messages from trying to
|
||||
// send.
|
||||
if (isAuthError(code)) {
|
||||
result = EmailServiceStatus.LOGIN_FAILED;
|
||||
} else {
|
||||
result = EmailServiceStatus.SUCCESS;
|
||||
}
|
||||
sendCallback(msgId, null, result);
|
||||
|
||||
|
@ -290,7 +290,8 @@ public class SyncManager extends Service implements Runnable {
|
||||
cv.put(SyncColumns.SERVER_ID, 0);
|
||||
INSTANCE.getContentResolver().update(Message.CONTENT_URI,
|
||||
cv, WHERE_MAILBOX_KEY, new String[] {Long.toString(mailboxId)});
|
||||
|
||||
// Clear the error state; the Outbox sync will be started from checkMailboxes
|
||||
INSTANCE.mSyncErrorMap.remove(mailboxId);
|
||||
kick("start outbox");
|
||||
// Outbox can't be synced in EAS
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user