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
This commit is contained in:
parent
ccb70fcad9
commit
48a3a1c51c
@ -110,7 +110,7 @@ public class NotificationController {
|
|||||||
* several notifications consecutively, it can be pretty overwhelming to get a barrage of
|
* several notifications consecutively, it can be pretty overwhelming to get a barrage of
|
||||||
* notification sounds. Throttle them using this value.
|
* 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 */
|
/** Constructor */
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
@ -428,7 +428,7 @@ public class NotificationController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
long now = mClock.getTime();
|
long now = mClock.getTime();
|
||||||
boolean enableAudio = (now - mLastMessageNotifyTime) > MIN_SOUND_INTERVAL;
|
boolean enableAudio = (now - mLastMessageNotifyTime) > MIN_SOUND_INTERVAL_MS;
|
||||||
Notification notification = createAccountNotification(
|
Notification notification = createAccountNotification(
|
||||||
account, title.toString(), title, text,
|
account, title.toString(), title, text,
|
||||||
intent, largeIcon, number, enableAudio);
|
intent, largeIcon, number, enableAudio);
|
||||||
@ -600,8 +600,10 @@ public class NotificationController {
|
|||||||
private static class MessageContentObserver extends ContentObserver {
|
private static class MessageContentObserver extends ContentObserver {
|
||||||
/** A selection to get messages the user hasn't seen before */
|
/** A selection to get messages the user hasn't seen before */
|
||||||
private final static String MESSAGE_SELECTION =
|
private final static String MESSAGE_SELECTION =
|
||||||
MessageColumns.MAILBOX_KEY + "=? AND " + MessageColumns.ID + ">? AND "
|
MessageColumns.MAILBOX_KEY + "=? AND "
|
||||||
+ MessageColumns.FLAG_READ + "=0";
|
+ MessageColumns.ID + ">? AND "
|
||||||
|
+ MessageColumns.FLAG_READ + "=0 AND "
|
||||||
|
+ Message.FLAG_LOADED_SELECTION;
|
||||||
private final Context mContext;
|
private final Context mContext;
|
||||||
private final long mMailboxId;
|
private final long mMailboxId;
|
||||||
private final long mAccountId;
|
private final long mAccountId;
|
||||||
|
Loading…
Reference in New Issue
Block a user