Fix delay sending stuck mail after tapping "Send outgoing mail"
* 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: I768138b6f31eb696811aa94f621b6fa758ec1a5e
This commit is contained in:
parent
9b83870a09
commit
caf5644360
@ -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