From 6700000ad14145637a482679d5c1436885ac0a16 Mon Sep 17 00:00:00 2001 From: Martin Hibdon Date: Fri, 4 Oct 2013 15:30:22 -0700 Subject: [PATCH] On initial sync, do inbox first b/11081520 This improves perceived performance, the inbox messages will come in before contacts and calendar Change-Id: Icd9630d9cd2fb79a54d0ed2c11702a1a3091ed7e --- .../src/com/android/emailcommon/provider/Mailbox.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/emailcommon/src/com/android/emailcommon/provider/Mailbox.java b/emailcommon/src/com/android/emailcommon/provider/Mailbox.java index b84b10c8a..ae686e429 100644 --- a/emailcommon/src/com/android/emailcommon/provider/Mailbox.java +++ b/emailcommon/src/com/android/emailcommon/provider/Mailbox.java @@ -810,9 +810,12 @@ public class Mailbox extends EmailContent implements MailboxColumns, Parcelable * @return A cursor (with one column, containing ids) with all mailbox ids we should sync. */ public static Cursor getMailboxIdsForSync(final ContentResolver cr, final long accountId) { + // We're sorting by mailbox type. The reason is that the inbox is type 0, other types + // (e.g. Calendar and Contacts) are all higher numbers. Upon initial sync, we'd like to + // sync the inbox first to improve perceived performance. return cr.query(Mailbox.CONTENT_URI, Mailbox.ID_PROJECTION, OUTBOX_PLUS_SYNCING_AND_ACCOUNT_SELECTION, - new String[] { Long.toString(accountId) }, null); + new String[] { Long.toString(accountId) }, MailboxColumns.TYPE + " ASC"); } /**