From f086deac70a5ee893ebd14be9d0502132e0fa988 Mon Sep 17 00:00:00 2001 From: Tony Mantler Date: Thu, 3 Oct 2013 13:26:55 -0700 Subject: [PATCH] Change notification code to key off android.accounts.Account b/11023774 Change-Id: I6dd267591148378265b0f12c7ea6d74b450a0f3d --- src/com/android/email/NotificationController.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/com/android/email/NotificationController.java b/src/com/android/email/NotificationController.java index 3fdb4de2a..b3fb7cc94 100644 --- a/src/com/android/email/NotificationController.java +++ b/src/com/android/email/NotificationController.java @@ -514,7 +514,7 @@ public class NotificationController { * as well as special login/security notifications. */ public static void cancelNotifications(final Context context, final Account account) { - NotificationUtils.clearAccountNotifications(context, account.mEmailAddress); + NotificationUtils.clearAccountNotifications(context, account.mAmAccount); final NotificationManager notificationManager = getInstance(context).mNotificationManager; @@ -559,6 +559,12 @@ public class NotificationController { accountCursor.close(); } + if (account == null) { + LogUtils.d(LOG_TAG, "Tried to create a notification for a missing account %d", + mAccountId); + return; + } + final Cursor mailboxCursor = contentResolver.query( ContentUris.withAppendedId(EmailContent.MAILBOX_NOTIFICATION_URI, mAccountId), null, null, null, null); @@ -678,6 +684,7 @@ public class NotificationController { try { mLock.wait(); } catch (InterruptedException ex) { + // Loop around and wait again } } }