summaryrefslogtreecommitdiffstats
path: root/emailcommon
diff options
context:
space:
mode:
authorYu Ping Hu <yph@google.com>2013-10-04 11:37:11 -0700
committerYu Ping Hu <yph@google.com>2013-10-04 14:36:43 -0700
commit3f24a9e2c76af8b772953c8a026d9886321f0044 (patch)
tree875deb533e9b2817e7432392fbb83d222799f987 /emailcommon
parent840408c41cfc95ffa491aaf11f1c3f4075eae9c9 (diff)
downloadandroid_packages_apps_Email-3f24a9e2c76af8b772953c8a026d9886321f0044.tar.gz
android_packages_apps_Email-3f24a9e2c76af8b772953c8a026d9886321f0044.tar.bz2
android_packages_apps_Email-3f24a9e2c76af8b772953c8a026d9886321f0044.zip
Don't push things that haven't performed initial sync.
Also remove the ping kick. Bug: 11081520 Change-Id: I21d5050886b2c352771013f4f3e5b9282482d508
Diffstat (limited to 'emailcommon')
-rwxr-xr-xemailcommon/src/com/android/emailcommon/provider/EmailContent.java4
-rw-r--r--emailcommon/src/com/android/emailcommon/provider/Mailbox.java16
2 files changed, 15 insertions, 5 deletions
diff --git a/emailcommon/src/com/android/emailcommon/provider/EmailContent.java b/emailcommon/src/com/android/emailcommon/provider/EmailContent.java
index 448640b8a..cd6db2655 100755
--- a/emailcommon/src/com/android/emailcommon/provider/EmailContent.java
+++ b/emailcommon/src/com/android/emailcommon/provider/EmailContent.java
@@ -162,6 +162,10 @@ public abstract class EmailContent {
}
}
+ public static boolean isInitialSyncKey(final String syncKey) {
+ return syncKey == null || syncKey.isEmpty() || syncKey.equals("0");
+ }
+
// The Uri is lazily initialized
public Uri getUri() {
if (mUri == null) {
diff --git a/emailcommon/src/com/android/emailcommon/provider/Mailbox.java b/emailcommon/src/com/android/emailcommon/provider/Mailbox.java
index db72662e2..92aa2c49c 100644
--- a/emailcommon/src/com/android/emailcommon/provider/Mailbox.java
+++ b/emailcommon/src/com/android/emailcommon/provider/Mailbox.java
@@ -188,9 +188,14 @@ public class Mailbox extends EmailContent implements MailboxColumns, Parcelable
MailboxColumns.TYPE + "<" + Mailbox.TYPE_NOT_EMAIL +
" AND " + MailboxColumns.FLAG_VISIBLE + "=1";
- /** Selection for all mailboxes that explicitly say they want to sync for an account. */
- private static final String SYNCING_AND_ACCOUNT_SELECTION =
- MailboxColumns.SYNC_INTERVAL + "=1 and " + MailboxColumns.ACCOUNT_KEY + "=?";
+ /**
+ * Selection for mailboxes that should receive push for an account. A mailbox should receive
+ * push if it has a valid, non-initial sync key and is opted in for sync.
+ */
+ private static final String PUSH_MAILBOXES_FOR_ACCOUNT_SELECTION =
+ MailboxColumns.SYNC_KEY + "not null and " + MailboxColumns.SYNC_KEY + "!='' and " +
+ MailboxColumns.SYNC_KEY + "!='0'" + MailboxColumns.SYNC_INTERVAL + "=1 and " +
+ MailboxColumns.ACCOUNT_KEY + "=?";
/** Selection for mailboxes that say they want to sync, plus outbox, for an account. */
private static final String OUTBOX_PLUS_SYNCING_AND_ACCOUNT_SELECTION = "("
@@ -787,14 +792,15 @@ public class Mailbox extends EmailContent implements MailboxColumns, Parcelable
}
/**
- * Get the mailboxes that want to receive push updates for an account.
+ * Get the mailboxes that should receive push updates for an account.
* @param cr The {@link ContentResolver}.
* @param accountId The id for the account that is pushing.
* @return A cursor (suitable for use with {@link #restore}) with all mailboxes we should sync.
*/
public static Cursor getMailboxesForPush(final ContentResolver cr, final long accountId) {
return cr.query(Mailbox.CONTENT_URI, Mailbox.CONTENT_PROJECTION,
- SYNCING_AND_ACCOUNT_SELECTION, new String[] { Long.toString(accountId) }, null);
+ PUSH_MAILBOXES_FOR_ACCOUNT_SELECTION, new String[] { Long.toString(accountId) },
+ null);
}
/**