Fix cursor logic for multiple notifications; close cursor
Change-Id: I0b2a46d1a89f9d4704929580324ee25f5c19185e
This commit is contained in:
parent
6fb157c90c
commit
cf1a862526
@ -499,8 +499,8 @@ public class NotificationController {
|
|||||||
EmailContent.MAILBOX_NOTIFICATION_URI, mailbox.mAccountKey),
|
EmailContent.MAILBOX_NOTIFICATION_URI, mailbox.mAccountKey),
|
||||||
EmailContent.NOTIFICATION_PROJECTION, null, null, null);
|
EmailContent.NOTIFICATION_PROJECTION, null, null, null);
|
||||||
|
|
||||||
if (messageCursor != null && messageCursor.getCount() > 0) {
|
|
||||||
try {
|
try {
|
||||||
|
if (messageCursor != null && messageCursor.getCount() > 0) {
|
||||||
final int maxNumDigestItems = mContext.getResources().getInteger(
|
final int maxNumDigestItems = mContext.getResources().getInteger(
|
||||||
R.integer.max_num_notification_digest_items);
|
R.integer.max_num_notification_digest_items);
|
||||||
// The body of the notification is the account name, or the label name.
|
// The body of the notification is the account name, or the label name.
|
||||||
@ -513,6 +513,7 @@ public class NotificationController {
|
|||||||
int numDigestItems = 0;
|
int numDigestItems = 0;
|
||||||
// We can assume that the current position of the cursor is on the
|
// We can assume that the current position of the cursor is on the
|
||||||
// newest message
|
// newest message
|
||||||
|
messageCursor.moveToFirst();
|
||||||
do {
|
do {
|
||||||
final long messageId =
|
final long messageId =
|
||||||
messageCursor.getLong(EmailContent.ID_PROJECTION_COLUMN);
|
messageCursor.getLong(EmailContent.ID_PROJECTION_COLUMN);
|
||||||
@ -533,7 +534,9 @@ public class NotificationController {
|
|||||||
// same string was set in as the subtext, we don't want to show a
|
// same string was set in as the subtext, we don't want to show a
|
||||||
// duplicate string.
|
// duplicate string.
|
||||||
builder.setContentText(null);
|
builder.setContentText(null);
|
||||||
|
}
|
||||||
} finally {
|
} finally {
|
||||||
|
if (messageCursor != null) {
|
||||||
messageCursor.close();
|
messageCursor.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user