From 48a3a1c51c11e3a752d7178e5c12c6caec842526 Mon Sep 17 00:00:00 2001 From: Ben Komalo Date: Fri, 22 Jul 2011 13:29:48 -0700 Subject: [PATCH] Ignore notifications for unloaded messages Seems like POP envelopes could get into the database and tickle the NotificationController even before we got the full subject/sender. Just ignore those things until the basic info is loaded. Bug: 5061271 Change-Id: Iadfbff8a1615d2644880f5cae3727768f4f9549a --- src/com/android/email/NotificationController.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/com/android/email/NotificationController.java b/src/com/android/email/NotificationController.java index 80bc6b1c4..ea56fb911 100644 --- a/src/com/android/email/NotificationController.java +++ b/src/com/android/email/NotificationController.java @@ -110,7 +110,7 @@ public class NotificationController { * several notifications consecutively, it can be pretty overwhelming to get a barrage of * notification sounds. Throttle them using this value. */ - private static final long MIN_SOUND_INTERVAL = 15 * 1000; // 15 seconds + private static final long MIN_SOUND_INTERVAL_MS = 15 * 1000; // 15 seconds /** Constructor */ @VisibleForTesting @@ -428,7 +428,7 @@ public class NotificationController { } long now = mClock.getTime(); - boolean enableAudio = (now - mLastMessageNotifyTime) > MIN_SOUND_INTERVAL; + boolean enableAudio = (now - mLastMessageNotifyTime) > MIN_SOUND_INTERVAL_MS; Notification notification = createAccountNotification( account, title.toString(), title, text, intent, largeIcon, number, enableAudio); @@ -600,8 +600,10 @@ public class NotificationController { private static class MessageContentObserver extends ContentObserver { /** A selection to get messages the user hasn't seen before */ private final static String MESSAGE_SELECTION = - MessageColumns.MAILBOX_KEY + "=? AND " + MessageColumns.ID + ">? AND " - + MessageColumns.FLAG_READ + "=0"; + MessageColumns.MAILBOX_KEY + "=? AND " + + MessageColumns.ID + ">? AND " + + MessageColumns.FLAG_READ + "=0 AND " + + Message.FLAG_LOADED_SELECTION; private final Context mContext; private final long mMailboxId; private final long mAccountId;