Ignore Messsages With No Timestamp

When calculating oldest local message

Bug: 11520812
Change-Id: I0e70431d57235b5f97a3cd01c35af1b61e3dad7e
diff --git a/src/com/android/email/service/ImapService.java b/src/com/android/email/service/ImapService.java
index 6009845..1cdd326 100644
--- a/src/com/android/email/service/ImapService.java
+++ b/src/com/android/email/service/ImapService.java
@@ -372,10 +372,12 @@
             endDate = System.currentTimeMillis() - FULL_SYNC_WINDOW_MILLIS;
             Cursor localOldestCursor = null;
             try {
+                // b/11520812 Ignore message with timestamp = 0 (which includes NULL)
                 localOldestCursor = resolver.query(EmailContent.Message.CONTENT_URI,
                         OldestTimestampInfo.PROJECTION,
                         EmailContent.MessageColumns.ACCOUNT_KEY + "=?" + " AND " +
-                                MessageColumns.MAILBOX_KEY + "=?",
+                                MessageColumns.MAILBOX_KEY + "=? AND " +
+                                MessageColumns.TIMESTAMP + "!=0",
                         new String[] {String.valueOf(account.mId), String.valueOf(mailbox.mId)},
                         null);
                 if (localOldestCursor != null && localOldestCursor.moveToFirst()) {