Notify the folder list in addition to the specific folder.

We might be dropping updates to the FolderListFragment since updates
to individual folders do not currently update the top-level
folder-list URI.

Bug: 7487632 EmailProvider doesn't notify on the folder list URI

Change-Id: I7c673eefd2d9cbaf01a5ca3098f7c4728f841f40
This commit is contained in:
Vikram Aggarwal 2012-09-24 16:24:21 -07:00
parent 9479110829
commit 2fbe5abcac

View File

@ -768,6 +768,7 @@ public class EmailProvider extends ContentProvider {
resolver.notifyChange(UIPROVIDER_ALL_ACCOUNTS_NOTIFIER, null); resolver.notifyChange(UIPROVIDER_ALL_ACCOUNTS_NOTIFIER, null);
} else if (match == MAILBOX_ID) { } else if (match == MAILBOX_ID) {
notifyUI(UIPROVIDER_FOLDER_NOTIFIER, id); notifyUI(UIPROVIDER_FOLDER_NOTIFIER, id);
notifyUI(UIPROVIDER_FOLDERLIST_NOTIFIER, id);
} else if (match == ATTACHMENT_ID) { } else if (match == ATTACHMENT_ID) {
notifyUI(UIPROVIDER_ATTACHMENT_NOTIFIER, id); notifyUI(UIPROVIDER_ATTACHMENT_NOTIFIER, id);
} }
@ -897,6 +898,8 @@ public class EmailProvider extends ContentProvider {
Uri.parse("content://" + UIProvider.AUTHORITY + "/uimessages"); Uri.parse("content://" + UIProvider.AUTHORITY + "/uimessages");
private static final Uri UIPROVIDER_FOLDER_NOTIFIER = private static final Uri UIPROVIDER_FOLDER_NOTIFIER =
Uri.parse("content://" + UIProvider.AUTHORITY + "/uifolder"); Uri.parse("content://" + UIProvider.AUTHORITY + "/uifolder");
private static final Uri UIPROVIDER_FOLDERLIST_NOTIFIER =
Uri.parse("content://" + UIProvider.AUTHORITY + "/uifolders");
private static final Uri UIPROVIDER_ACCOUNT_NOTIFIER = private static final Uri UIPROVIDER_ACCOUNT_NOTIFIER =
Uri.parse("content://" + UIProvider.AUTHORITY + "/uiaccount"); Uri.parse("content://" + UIProvider.AUTHORITY + "/uiaccount");
public static final Uri UIPROVIDER_SETTINGS_NOTIFIER = public static final Uri UIPROVIDER_SETTINGS_NOTIFIER =
@ -1829,6 +1832,7 @@ outer:
} }
} else if (match == MAILBOX_ID && values.containsKey(Mailbox.UI_SYNC_STATUS)) { } else if (match == MAILBOX_ID && values.containsKey(Mailbox.UI_SYNC_STATUS)) {
notifyUI(UIPROVIDER_FOLDER_NOTIFIER, id); notifyUI(UIPROVIDER_FOLDER_NOTIFIER, id);
notifyUI(UIPROVIDER_FOLDERLIST_NOTIFIER, id);
} else if (match == ACCOUNT_ID) { } else if (match == ACCOUNT_ID) {
// Notify individual account and "all accounts" // Notify individual account and "all accounts"
notifyUI(UIPROVIDER_ACCOUNT_NOTIFIER, id); notifyUI(UIPROVIDER_ACCOUNT_NOTIFIER, id);
@ -4109,6 +4113,7 @@ outer:
// We actually delete these, including attachments // We actually delete these, including attachments
AttachmentUtilities.deleteAllAttachmentFiles(context, msg.mAccountKey, msg.mId); AttachmentUtilities.deleteAllAttachmentFiles(context, msg.mAccountKey, msg.mId);
notifyUI(UIPROVIDER_FOLDER_NOTIFIER, mailbox.mId); notifyUI(UIPROVIDER_FOLDER_NOTIFIER, mailbox.mId);
notifyUI(UIPROVIDER_FOLDERLIST_NOTIFIER, mailbox.mAccountKey);
return context.getContentResolver().delete( return context.getContentResolver().delete(
ContentUris.withAppendedId(Message.SYNCED_CONTENT_URI, msg.mId), null, null); ContentUris.withAppendedId(Message.SYNCED_CONTENT_URI, msg.mId), null, null);
} }
@ -4120,6 +4125,7 @@ outer:
ContentValues values = new ContentValues(); ContentValues values = new ContentValues();
values.put(MessageColumns.MAILBOX_KEY, trashMailbox.mId); values.put(MessageColumns.MAILBOX_KEY, trashMailbox.mId);
notifyUI(UIPROVIDER_FOLDER_NOTIFIER, mailbox.mId); notifyUI(UIPROVIDER_FOLDER_NOTIFIER, mailbox.mId);
notifyUI(UIPROVIDER_FOLDERLIST_NOTIFIER, mailbox.mId);
return uiUpdateMessage(uri, values, true); return uiUpdateMessage(uri, values, true);
} }
@ -4176,6 +4182,7 @@ outer:
ContentResolver resolver = getContext().getContentResolver(); ContentResolver resolver = getContext().getContentResolver();
resolver.notifyChange(UIPROVIDER_CONVERSATION_NOTIFIER, null); resolver.notifyChange(UIPROVIDER_CONVERSATION_NOTIFIER, null);
resolver.notifyChange(UIPROVIDER_FOLDER_NOTIFIER, null); resolver.notifyChange(UIPROVIDER_FOLDER_NOTIFIER, null);
resolver.notifyChange(UIPROVIDER_FOLDERLIST_NOTIFIER, null);
return c; return c;
} catch (OperationApplicationException e) { } catch (OperationApplicationException e) {
} }
@ -4339,6 +4346,7 @@ outer:
mSearchParams, searchMailboxId); mSearchParams, searchMailboxId);
//Log.d(TAG, "TotalCount to UI: " + mSearchParams.mTotalCount); //Log.d(TAG, "TotalCount to UI: " + mSearchParams.mTotalCount);
notifyUI(UIPROVIDER_FOLDER_NOTIFIER, searchMailboxId); notifyUI(UIPROVIDER_FOLDER_NOTIFIER, searchMailboxId);
notifyUI(UIPROVIDER_FOLDERLIST_NOTIFIER, accountId);
} catch (RemoteException e) { } catch (RemoteException e) {
Log.e("searchMessages", "RemoteException", e); Log.e("searchMessages", "RemoteException", e);
} }