From fc906340f9a3ef0246f4d693f0a2afc15af8cd6c Mon Sep 17 00:00:00 2001 From: Tony Mantler Date: Tue, 10 Sep 2013 14:25:28 -0700 Subject: [PATCH] Notify combined account when individual accounts change b/10610684 Change-Id: I675a5b2dfd9ccdb412f2746f5785c8f1141f6a76 --- src/com/android/email/provider/EmailProvider.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/com/android/email/provider/EmailProvider.java b/src/com/android/email/provider/EmailProvider.java index 49c940451..74e276db1 100644 --- a/src/com/android/email/provider/EmailProvider.java +++ b/src/com/android/email/provider/EmailProvider.java @@ -3240,6 +3240,10 @@ public class EmailProvider extends ContentProvider { mc.addRow(row); row = getVirtualMailboxRow(COMBINED_ACCOUNT_ID, Mailbox.TYPE_UNREAD); mc.addRow(row); + + final Uri notifyUri = + UIPROVIDER_FOLDERLIST_NOTIFIER.buildUpon().appendEncodedPath(id).build(); + mc.setNotificationUri(context.getContentResolver(), notifyUri); return mc; } else { Cursor c = db.rawQuery(genQueryAccountMailboxes(uiProjection), new String[] {id}); @@ -3709,6 +3713,7 @@ public class EmailProvider extends ContentProvider { mailboxId = Long.parseLong(id); if (isVirtualMailbox(mailboxId)) { c = getVirtualMailboxCursor(mailboxId); + notifyUri = UIPROVIDER_FOLDER_NOTIFIER.buildUpon().appendPath(id).build(); } else { c = db.rawQuery(genQueryMailbox(uiProjection, id), new String[]{id}); final List projectionList = Arrays.asList(uiProjection); @@ -4515,6 +4520,12 @@ public class EmailProvider extends ContentProvider { if (accountId != Account.NO_ACCOUNT) { notifyUI(UIPROVIDER_FOLDERLIST_NOTIFIER, accountId); } + + // Notify for combined account too + // TODO: might be nice to only notify when an inbox changes + notifyUI(UIPROVIDER_FOLDER_NOTIFIER, + getVirtualMailboxId(COMBINED_ACCOUNT_ID, Mailbox.TYPE_INBOX)); + notifyUI(UIPROVIDER_FOLDERLIST_NOTIFIER, COMBINED_ACCOUNT_ID); } private void notifyUIFolder(final long folderId, final long accountId) {