Merge "Remove notifications while we still know what type of account this is" into jb-ub-mail-ur10

This commit is contained in:
Tony Mantler 2013-10-04 20:28:42 +00:00 committed by Android (Google) Code Review
commit 7c24f48a37
2 changed files with 11 additions and 4 deletions

View File

@ -515,9 +515,15 @@ public class NotificationController {
* as well as special login/security notifications.
*/
public static void cancelNotifications(final Context context, final Account account) {
final EmailServiceUtils.EmailServiceInfo serviceInfo
= EmailServiceUtils.getServiceInfoForAccount(context, account.mId);
if (serviceInfo == null) {
LogUtils.d(LOG_TAG, "Can't cancel notification for missing account %d", account.mId);
return;
}
final android.accounts.Account notifAccount
= account.getAccountManagerAccount(
EmailServiceUtils.getServiceInfoForAccount(context, account.mId).accountType);
= account.getAccountManagerAccount(serviceInfo.accountType);
NotificationUtils.clearAccountNotifications(context, notifAccount);
final NotificationManager notificationManager = getInstance(context).mNotificationManager;

View File

@ -177,11 +177,12 @@ public class AccountReconciler {
context.getString(R.string.protocol_eas))) {
exchangeAccountDeleted = true;
}
// Cancel all notifications for this account
NotificationController.cancelNotifications(context, providerAccount);
context.getContentResolver().delete(
EmailProvider.uiUri("uiaccount", providerAccount.mId), null, null);
// Cancel all notifications for this account
NotificationController.cancelNotifications(context, providerAccount);
accountDeleted = true;
}