Merge "Re-enable the ping kick." into jb-ub-mail-ur10
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index ed6aa7e..6ff8a34 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -17,7 +17,7 @@
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.exchange"
- android:versionCode="500056" >
+ android:versionCode="500057" >
<uses-permission
android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
diff --git a/src/com/android/exchange/Exchange.java b/src/com/android/exchange/Exchange.java
index 8a66185..2b2a468 100644
--- a/src/com/android/exchange/Exchange.java
+++ b/src/com/android/exchange/Exchange.java
@@ -18,10 +18,20 @@
import android.app.Application;
+import com.android.emailcommon.provider.EmailContent;
+import com.android.emailcommon.provider.MailboxUtilities;
import com.android.mail.utils.LogTag;
public class Exchange extends Application {
static {
LogTag.setLogTag(Eas.LOG_TAG);
}
+
+ @Override
+ public void onCreate() {
+ super.onCreate();
+ EmailContent.init(this);
+ getContentResolver().call(EmailContent.CONTENT_URI, MailboxUtilities.FIX_PARENT_KEYS_METHOD,
+ "", null);
+ }
}
diff --git a/src/com/android/exchange/eas/EasMoveItems.java b/src/com/android/exchange/eas/EasMoveItems.java
index a9c5c3f..8ddb747 100644
--- a/src/com/android/exchange/eas/EasMoveItems.java
+++ b/src/com/android/exchange/eas/EasMoveItems.java
@@ -30,6 +30,7 @@
/** Result code indicating that no moved messages were found for this account. */
public final static int RESULT_NO_MESSAGES = 0;
public final static int RESULT_OK = 1;
+ public final static int RESULT_EMPTY_RESPONSE = 2;
private static class MoveResponse {
public final String sourceMessageId;
@@ -69,6 +70,9 @@
status = mResponse.moveStatus;
} else {
// TODO: Perhaps not all errors should be retried?
+ // Notably, if the server returns 200 with an empty response, we retry. This is
+ // how the previous version worked, and I can't find documentation about what this
+ // response state really means.
status = MoveItemsParser.STATUS_CODE_RETRY;
}
final int index = status - 1;
@@ -112,8 +116,9 @@
final String newMessageId = parser.getNewServerId();
final int status = parser.getStatusCode();
mResponse = new MoveResponse(sourceMessageId, newMessageId, status);
+ return RESULT_OK;
}
- return RESULT_OK;
+ return RESULT_EMPTY_RESPONSE;
}
private void processResponse(final MessageMove request, final MoveResponse response) {
diff --git a/src/com/android/exchange/service/EmailSyncAdapterService.java b/src/com/android/exchange/service/EmailSyncAdapterService.java
index ea9e58b..b88ffe6 100644
--- a/src/com/android/exchange/service/EmailSyncAdapterService.java
+++ b/src/com/android/exchange/service/EmailSyncAdapterService.java
@@ -672,7 +672,7 @@
syncMailbox(context, cr, acct, account, mailboxId, extras, syncResult, null,
true);
}
- } else if (accountOnly) {
+ } else if (!accountOnly) {
// We have to sync multiple folders.
final Cursor c;
if (isFullSync) {
@@ -741,6 +741,15 @@
return false;
}
+ if (mailbox.mType == Mailbox.TYPE_DRAFTS) {
+ // TODO: Because we don't have bidirectional sync working, trying to downsync
+ // the drafts folder is confusing. b/11158759
+ // For now, just disable all syncing of DRAFTS type folders.
+ // Automatic syncing should always be disabled, but we also stop it here to ensure
+ // that we won't sync even if the user attempts to force a sync from the UI.
+ LogUtils.d(TAG, "Skipping sync of DRAFTS folder");
+ return false;
+ }
final boolean success;
// Non-mailbox syncs are whole account syncs initiated by the AccountManager and are
// treated as background syncs.
@@ -748,7 +757,6 @@
final ContentValues cv = new ContentValues(2);
updateMailbox(context, mailbox, cv, isMailboxSync ?
EmailContent.SYNC_STATUS_USER : EmailContent.SYNC_STATUS_BACKGROUND);
-
if (mailbox.mType == Mailbox.TYPE_OUTBOX) {
final EasOutboxSyncHandler outboxSyncHandler =
new EasOutboxSyncHandler(context, account, mailbox);