Clear notifications when deleting accounts

* Quick fix for the bug that notifications may be stale after
  and account is deleted.

Bug: 2202317
Change-Id: I950d173d20dee443b03b40ee04618afb98a95f38
This commit is contained in:
Andrew Stadler 2010-03-17 16:14:17 -07:00
parent 0d91d886a9
commit cb98193f85

View File

@ -32,6 +32,7 @@ import com.android.email.provider.EmailContent.Mailbox;
import com.android.email.provider.EmailContent.MailboxColumns; import com.android.email.provider.EmailContent.MailboxColumns;
import com.android.email.provider.EmailContent.Message; import com.android.email.provider.EmailContent.Message;
import com.android.email.provider.EmailContent.MessageColumns; import com.android.email.provider.EmailContent.MessageColumns;
import com.android.email.service.MailService;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.app.Dialog; import android.app.Dialog;
@ -415,6 +416,10 @@ public class AccountFolderList extends ListActivity implements OnItemClickListen
public void onClick(DialogInterface dialog, int whichButton) { public void onClick(DialogInterface dialog, int whichButton) {
dismissDialog(DIALOG_REMOVE_ACCOUNT); dismissDialog(DIALOG_REMOVE_ACCOUNT);
try { try {
// Clear notifications, which may become stale here
NotificationManager notificationManager = (NotificationManager)
getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.cancel(MailService.NOTIFICATION_ID_NEW_MESSAGES);
// Delete Remote store at first. // Delete Remote store at first.
Store.getInstance( Store.getInstance(
mSelectedContextAccount.getStoreUri(AccountFolderList.this), mSelectedContextAccount.getStoreUri(AccountFolderList.this),