summaryrefslogtreecommitdiffstats
path: root/emailcommon
diff options
context:
space:
mode:
authorJorge Ruesga <jorge@ruesga.com>2015-04-04 20:42:30 +0200
committerSteve Kondik <steve@cyngn.com>2015-10-18 14:03:22 -0700
commit598a070c27d44959e4238c3a16c9b7620d8e852d (patch)
tree170030904b9ba2b57039512827410482b6c099c6 /emailcommon
parent8b1818d4a89912768bd6b1c94ff6eec25b072087 (diff)
downloadandroid_packages_apps_Email-598a070c27d44959e4238c3a16c9b7620d8e852d.tar.gz
android_packages_apps_Email-598a070c27d44959e4238c3a16c9b7620d8e852d.tar.bz2
android_packages_apps_Email-598a070c27d44959e4238c3a16c9b7620d8e852d.zip
email: support for auto-sync multiple IMAP folders
This enables to auto-sync multiple IMAP folders, not only Inbox. Default to Inbox only. This changes relays in the syncloopback attribute to configure the folders to add to sync process. Change-Id: I8973cfd6ddec33446256bc8b48418558e27596b5 Signed-off-by: Jorge Ruesga <jorge@ruesga.com>
Diffstat (limited to 'emailcommon')
-rw-r--r--emailcommon/src/com/android/emailcommon/provider/Mailbox.java17
-rw-r--r--emailcommon/src/com/android/emailcommon/service/SyncWindow.java2
2 files changed, 18 insertions, 1 deletions
diff --git a/emailcommon/src/com/android/emailcommon/provider/Mailbox.java b/emailcommon/src/com/android/emailcommon/provider/Mailbox.java
index 952a73147..c726b94c3 100644
--- a/emailcommon/src/com/android/emailcommon/provider/Mailbox.java
+++ b/emailcommon/src/com/android/emailcommon/provider/Mailbox.java
@@ -299,6 +299,10 @@ public class Mailbox extends EmailContent implements EmailContent.MailboxColumns
MailboxColumns.SYNC_INTERVAL + "=1 and " + MailboxColumns.TYPE + "=? and " +
MailboxColumns.ACCOUNT_KEY + "=?";
+ /** Selection for mailboxes that are configured for sync for an account. */
+ private static final String SYNCING_MAILBOXES_FOR_ACCOUNT_SELECTION =
+ MailboxColumns.SYNC_INTERVAL + "=1 and " + MailboxColumns.ACCOUNT_KEY + "=?";
+
// Types of mailboxes. The list is ordered to match a typical UI presentation, e.g.
// placing the inbox at the top.
// Arrays of "special_mailbox_display_names" and "special_mailbox_icons" are depends on
@@ -911,6 +915,19 @@ public class Mailbox extends EmailContent implements EmailContent.MailboxColumns
}
/**
+ * Get the mailbox ids for an account that are configured for sync by the user.
+ * @param cr The {@link ContentResolver}.
+ * @param accountId The id for the account that is syncing.
+ * @return A cursor (with one column, containing ids) with all mailbox ids that match.
+ */
+ public static Cursor getLoopBackMailboxIdsForSync(final ContentResolver cr,
+ final long accountId) {
+ return cr.query(Mailbox.CONTENT_URI, Mailbox.ID_PROJECTION,
+ SYNCING_MAILBOXES_FOR_ACCOUNT_SELECTION,
+ new String[] {Long.toString(accountId) }, null);
+ }
+
+ /**
* Get the account id for a mailbox.
* @param context The {@link Context}.
* @param mailboxId The id of the mailbox we're interested in, as a {@link String}.
diff --git a/emailcommon/src/com/android/emailcommon/service/SyncWindow.java b/emailcommon/src/com/android/emailcommon/service/SyncWindow.java
index 8dfe4ad2e..af1edea7d 100644
--- a/emailcommon/src/com/android/emailcommon/service/SyncWindow.java
+++ b/emailcommon/src/com/android/emailcommon/service/SyncWindow.java
@@ -42,7 +42,7 @@ public class SyncWindow {
return 365*10;
case SYNC_WINDOW_ACCOUNT:
default:
- return 14;
+ return 7;
}
}
}