summaryrefslogtreecommitdiff
path: root/src/com/android/dialer
diff options
context:
space:
mode:
authorQi Wang <wangqi@google.com>2016-04-12 12:20:43 -0700
committerQi Wang <wangqi@google.com>2016-04-12 12:20:43 -0700
commitc05f58c6fd8a2d740a53034629b8a6af6d4e1b53 (patch)
tree7925137d4b2f472db77e1510614f62a319ea22d1 /src/com/android/dialer
parent215e1f189805fbc3dd30e084b715d5e219852902 (diff)
Call correct number from missing call notification.
Change-Id: I9daa0fd75fdeb201f5d7973a1431579ec7251bf7 Fix: 28068914
Diffstat (limited to 'src/com/android/dialer')
-rw-r--r--src/com/android/dialer/calllog/MissedCallNotifier.java19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/com/android/dialer/calllog/MissedCallNotifier.java b/src/com/android/dialer/calllog/MissedCallNotifier.java
index 98d02d095..3afc112b2 100644
--- a/src/com/android/dialer/calllog/MissedCallNotifier.java
+++ b/src/com/android/dialer/calllog/MissedCallNotifier.java
@@ -96,6 +96,7 @@ public class MissedCallNotifier {
boolean useCallLog = newCalls != null && newCalls.size() == count;
NewCall newestCall = useCallLog ? newCalls.get(0) : null;
long timeMs = useCallLog ? newestCall.dateMs : System.currentTimeMillis();
+ String missedNumber = useCallLog ? newestCall.number : number;
Notification.Builder builder = new Notification.Builder(mContext);
// Display the first line of the notification:
@@ -104,7 +105,7 @@ public class MissedCallNotifier {
if (count == 1) {
//TODO: look up caller ID that is not in contacts.
ContactInfo contactInfo = CallLogNotificationsHelper.getInstance(mContext)
- .getContactInfo(useCallLog ? newestCall.number : number,
+ .getContactInfo(missedNumber,
useCallLog ? newestCall.numberPresentation
: Calls.PRESENTATION_ALLOWED,
useCallLog ? newestCall.countryIso : null);
@@ -156,17 +157,17 @@ public class MissedCallNotifier {
// Add additional actions when there is only 1 missed call and the user isn't locked
if (UserManagerCompat.isUserUnlocked(mContext) && count == 1) {
- if (!TextUtils.isEmpty(number)
+ if (!TextUtils.isEmpty(missedNumber)
&& !TextUtils.equals(
- number, mContext.getString(R.string.handle_restricted))) {
+ missedNumber, mContext.getString(R.string.handle_restricted))) {
builder.addAction(R.drawable.ic_phone_24dp,
mContext.getString(R.string.notification_missedCall_call_back),
- createCallBackPendingIntent(number));
+ createCallBackPendingIntent(missedNumber));
- if (!PhoneNumberHelper.isUriNumber(number)) {
+ if (!PhoneNumberHelper.isUriNumber(missedNumber)) {
builder.addAction(R.drawable.ic_message_24dp,
mContext.getString(R.string.notification_missedCall_message),
- createSendSmsFromNotificationPendingIntent(number));
+ createSendSmsFromNotificationPendingIntent(missedNumber));
}
}
}
@@ -254,7 +255,8 @@ public class MissedCallNotifier {
intent.setAction(
CallLogNotificationsService.ACTION_CALL_BACK_FROM_MISSED_CALL_NOTIFICATION);
intent.putExtra(CallLogNotificationsService.EXTRA_MISSED_CALL_NUMBER, number);
- return PendingIntent.getService(mContext, 0, intent, 0);
+ // Use FLAG_ONE_SHOT to avoid reusing previous PendingIntent with different number.
+ return PendingIntent.getService(mContext, 0, intent, PendingIntent.FLAG_ONE_SHOT);
}
private PendingIntent createSendSmsFromNotificationPendingIntent(String number) {
@@ -262,7 +264,8 @@ public class MissedCallNotifier {
intent.setAction(
CallLogNotificationsService.ACTION_SEND_SMS_FROM_MISSED_CALL_NOTIFICATION);
intent.putExtra(CallLogNotificationsService.EXTRA_MISSED_CALL_NUMBER, number);
- return PendingIntent.getService(mContext, 0, intent, 0);
+ // Use FLAG_ONE_SHOT to avoid reusing previous PendingIntent with different number.
+ return PendingIntent.getService(mContext, 0, intent, PendingIntent.FLAG_ONE_SHOT);
}
/**