Merge "Cancel NotificationTimeout alarms when canceling notification" am: 9e7ac57a6c am: c60c7a1a4a am: f82ddac1f5 am: 3dd61f2dc9

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1695745

Change-Id: Ie4311cd56ae91a4cbe3c30f531e24b8b87f42cfb
This commit is contained in:
Treehugger Robot
2021-05-06 15:31:26 +00:00
committed by Automerger Merge Worker

View File

@@ -8312,6 +8312,21 @@ public class NotificationManagerService extends SystemService {
int rank, int count, boolean wasPosted, String listenerName) {
final String canceledKey = r.getKey();
// Get pending intent used to create alarm, use FLAG_NO_CREATE if PendingIntent
// does not already exist, then null will be returned.
final PendingIntent pi = PendingIntent.getBroadcast(getContext(),
REQUEST_CODE_TIMEOUT,
new Intent(ACTION_NOTIFICATION_TIMEOUT)
.setData(new Uri.Builder().scheme(SCHEME_TIMEOUT)
.appendPath(r.getKey()).build())
.addFlags(Intent.FLAG_RECEIVER_FOREGROUND),
PendingIntent.FLAG_NO_CREATE | PendingIntent.FLAG_IMMUTABLE);
// Cancel alarm corresponding to pi.
if (pi != null) {
mAlarmManager.cancel(pi);
}
// Record caller.
recordCallerLocked(r);