summaryrefslogtreecommitdiff
path: root/src/com/android/dialer
diff options
context:
space:
mode:
authorSailesh Nepal <sail@google.com>2016-06-01 10:57:44 -0700
committerSailesh Nepal <sail@google.com>2016-06-01 18:41:25 +0000
commit30371b9022d0b3740c74523208a9126b9890dab4 (patch)
treeec18c5da40d0c657ed4c0f61cc751dbfa34f61fc /src/com/android/dialer
parent8646f14a5881b0a7c475f1f3954a5daa71763b70 (diff)
Fix missed call notification dialing wrong number
This CL fixes a bug where clicking the "callback" button on the missed call notification would dial the previous missed call. To reproduce the bug you had to do the following: - get a missed call from Party A - clear the missed call count by launching dialer and navigating to the call log then pressing home. Clearing the missed call count by swipping away the notification should also work. - get a missed call from Party B - click "callback" on the new missed call notification Previously this would result in Party A getting called back. The problem was that we were using the wrong pending intent flags: - Flag 0: before ag/925201 we were using 0 which meant that the pending intent with Party A was being used. - FLAG_ONE_SHOT: after ag/925201 we were using FLAG_ONE_SHOT which meant that the pending intent would be cancelled after the first use (after the user clicked callback on Party A). If the user never clicked callback on Party A then the intent would be re-used. Fix was to use FLAG_UPDATE_CURRENT instead. This ensured that the pending intent was always updated with the last missed call number. Bug: 29065901 Change-Id: I8515e82d178348235d775b7a110e662652b3385b (cherry picked from commit e5b24ecbe50bd79d2ce7ad8a284ac17ad1284d83)
Diffstat (limited to 'src/com/android/dialer')
-rw-r--r--src/com/android/dialer/calllog/MissedCallNotifier.java10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/com/android/dialer/calllog/MissedCallNotifier.java b/src/com/android/dialer/calllog/MissedCallNotifier.java
index 20fc5d551..f6830168b 100644
--- a/src/com/android/dialer/calllog/MissedCallNotifier.java
+++ b/src/com/android/dialer/calllog/MissedCallNotifier.java
@@ -254,8 +254,9 @@ public class MissedCallNotifier {
intent.setAction(
CallLogNotificationsService.ACTION_CALL_BACK_FROM_MISSED_CALL_NOTIFICATION);
intent.putExtra(CallLogNotificationsService.EXTRA_MISSED_CALL_NUMBER, number);
- // Use FLAG_ONE_SHOT to avoid reusing previous PendingIntent with different number.
- return PendingIntent.getService(mContext, 0, intent, PendingIntent.FLAG_ONE_SHOT);
+ // Use FLAG_UPDATE_CURRENT to make sure any previous pending intent is updated with the new
+ // extra.
+ return PendingIntent.getService(mContext, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
}
private PendingIntent createSendSmsFromNotificationPendingIntent(String number) {
@@ -263,8 +264,9 @@ public class MissedCallNotifier {
intent.setAction(
CallLogNotificationsService.ACTION_SEND_SMS_FROM_MISSED_CALL_NOTIFICATION);
intent.putExtra(CallLogNotificationsService.EXTRA_MISSED_CALL_NUMBER, number);
- // Use FLAG_ONE_SHOT to avoid reusing previous PendingIntent with different number.
- return PendingIntent.getService(mContext, 0, intent, PendingIntent.FLAG_ONE_SHOT);
+ // Use FLAG_UPDATE_CURRENT to make sure any previous pending intent is updated with the new
+ // extra.
+ return PendingIntent.getService(mContext, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
}
/**