From 1418a419eab3dbcf04776cf6a450d7bbfe1bc128 Mon Sep 17 00:00:00 2001 From: mvp76 Date: Tue, 28 Feb 2017 22:24:26 +0100 Subject: [PATCH] Remove "InstallError" entries when clearing notification I.e. either the user "swiped" the notification away or clicked on it to view the error message (and thus the notification was auto canceled) --- .../main/java/org/fdroid/fdroid/NotificationHelper.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/org/fdroid/fdroid/NotificationHelper.java b/app/src/main/java/org/fdroid/fdroid/NotificationHelper.java index 6b1a2ca87..c3273d0ee 100644 --- a/app/src/main/java/org/fdroid/fdroid/NotificationHelper.java +++ b/app/src/main/java/org/fdroid/fdroid/NotificationHelper.java @@ -87,10 +87,15 @@ class NotificationHelper { appUpdateStatusManager.clearAllInstalled(); break; case BROADCAST_NOTIFICATIONS_UPDATE_CLEARED: + // If clearing apps in state "InstallError" (like when auto-cancelling) we + // remove them from the status manager entirely. + AppUpdateStatusManager.AppUpdateStatus appUpdateStatus = appUpdateStatusManager.get(intent.getStringExtra(EXTRA_NOTIFICATION_KEY)); + if (appUpdateStatus != null && appUpdateStatus.status == AppUpdateStatusManager.Status.InstallError) { + appUpdateStatusManager.removeApk(intent.getStringExtra(EXTRA_NOTIFICATION_KEY)); + } break; case BROADCAST_NOTIFICATIONS_INSTALLED_CLEARED: - String key = intent.getStringExtra(EXTRA_NOTIFICATION_KEY); - appUpdateStatusManager.removeApk(key); + appUpdateStatusManager.removeApk(intent.getStringExtra(EXTRA_NOTIFICATION_KEY)); break; } }