From 1f035a9696cb78bc207e96d1d48e7ee63e03842f Mon Sep 17 00:00:00 2001 From: Peter Serwylo Date: Fri, 7 Apr 2017 14:46:47 +1000 Subject: [PATCH] Don't re-use existing pending intents. When dismissing an "X installed successfully" intent, it should also dismiss the relevant item from the "Updates" screen. This was not happening. Upon investigation, I noticed that when I dismissed a notification, it was passing through the Apk which I installed over a day ago. This is because it was reusing a previous pending intent rather than creating a new one. --- .../java/org/fdroid/fdroid/NotificationHelper.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/org/fdroid/fdroid/NotificationHelper.java b/app/src/main/java/org/fdroid/fdroid/NotificationHelper.java index 59313f8eb..ffd9303cb 100644 --- a/app/src/main/java/org/fdroid/fdroid/NotificationHelper.java +++ b/app/src/main/java/org/fdroid/fdroid/NotificationHelper.java @@ -371,7 +371,7 @@ class NotificationHelper { Intent intentDeleted = new Intent(BROADCAST_NOTIFICATIONS_UPDATE_CLEARED); intentDeleted.putExtra(EXTRA_NOTIFICATION_KEY, entry.getUniqueKey()); - PendingIntent piDeleted = PendingIntent.getBroadcast(context, 0, intentDeleted, 0); + PendingIntent piDeleted = PendingIntent.getBroadcast(context, 0, intentDeleted, PendingIntent.FLAG_UPDATE_CURRENT); builder.setDeleteIntent(piDeleted); return builder.build(); } @@ -429,7 +429,7 @@ class NotificationHelper { } Intent intentDeleted = new Intent(BROADCAST_NOTIFICATIONS_ALL_UPDATES_CLEARED); - PendingIntent piDeleted = PendingIntent.getBroadcast(context, 0, intentDeleted, 0); + PendingIntent piDeleted = PendingIntent.getBroadcast(context, 0, intentDeleted, PendingIntent.FLAG_UPDATE_CURRENT); builder.setDeleteIntent(piDeleted); return builder.build(); } @@ -456,7 +456,7 @@ class NotificationHelper { Intent intentDeleted = new Intent(BROADCAST_NOTIFICATIONS_INSTALLED_CLEARED); intentDeleted.putExtra(EXTRA_NOTIFICATION_KEY, entry.getUniqueKey()); - PendingIntent piDeleted = PendingIntent.getBroadcast(context, 0, intentDeleted, 0); + PendingIntent piDeleted = PendingIntent.getBroadcast(context, 0, intentDeleted, PendingIntent.FLAG_UPDATE_CURRENT); builder.setDeleteIntent(piDeleted); return builder.build(); } @@ -484,7 +484,7 @@ class NotificationHelper { // Intent to open main app list Intent intentObject = new Intent(context, MainActivity.class); - PendingIntent piAction = PendingIntent.getActivity(context, 0, intentObject, 0); + PendingIntent piAction = PendingIntent.getActivity(context, 0, intentObject, PendingIntent.FLAG_UPDATE_CURRENT); NotificationCompat.Builder builder = new NotificationCompat.Builder(context) @@ -501,7 +501,7 @@ class NotificationHelper { .setGroupSummary(true); } Intent intentDeleted = new Intent(BROADCAST_NOTIFICATIONS_ALL_INSTALLED_CLEARED); - PendingIntent piDeleted = PendingIntent.getBroadcast(context, 0, intentDeleted, 0); + PendingIntent piDeleted = PendingIntent.getBroadcast(context, 0, intentDeleted, PendingIntent.FLAG_UPDATE_CURRENT); builder.setDeleteIntent(piDeleted); return builder.build(); }