diff options
author | Jorge Ruesga <jorge@ruesga.com> | 2015-04-04 20:42:30 +0200 |
---|---|---|
committer | Michael Bestas <mikeioannina@gmail.com> | 2016-12-30 20:15:18 +0200 |
commit | b9a4a7385f9a85f08b8df39640a9a5427baa914f (patch) | |
tree | 9e160d3b753a334e96db79368420aa98fd81eb84 /emailcommon | |
parent | c1f42968dc1b15f81bb2adab2c6a2862813f594f (diff) | |
download | android_packages_apps_Email-b9a4a7385f9a85f08b8df39640a9a5427baa914f.tar.gz android_packages_apps_Email-b9a4a7385f9a85f08b8df39640a9a5427baa914f.tar.bz2 android_packages_apps_Email-b9a4a7385f9a85f08b8df39640a9a5427baa914f.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.java | 17 | ||||
-rw-r--r-- | emailcommon/src/com/android/emailcommon/service/SyncWindow.java | 2 |
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; } } } |