Skip to content
This repository has been archived by the owner on Nov 15, 2022. It is now read-only.

Commit

Permalink
Merge "Use name and number for SMS delivery reports"
Browse files Browse the repository at this point in the history
  • Loading branch information
Jean-Baptiste Queru authored and android code review committed Feb 23, 2012
2 parents a85ca65 + ac9a5e5 commit 4fbc794
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/com/android/mms/transaction/MessagingNotification.java
Expand Up @@ -340,18 +340,22 @@ private static final MmsSmsDeliveryInfo getSmsNewDeliveryInfo(Context context) {
SMS_STATUS_PROJECTION, NEW_DELIVERY_SM_CONSTRAINT,
null, Sms.DATE);

if (cursor == null)
if (cursor == null) {
return null;
}

try {
if (!cursor.moveToLast())
return null;
if (!cursor.moveToLast()) {
return null;
}

String address = cursor.getString(COLUMN_SMS_ADDRESS);
long timeMillis = 3000;

return new MmsSmsDeliveryInfo(String.format(
context.getString(R.string.delivery_toast_body), address),
Contact contact = Contact.get(address, false);
String name = contact.getNameAndNumber();

return new MmsSmsDeliveryInfo(context.getString(R.string.delivery_toast_body, name),
timeMillis);

} finally {
Expand Down

0 comments on commit 4fbc794

Please sign in to comment.