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)
This commit is contained in:
mvp76 2017-02-28 22:24:26 +01:00
parent a8509ae833
commit 1418a419ea

View File

@ -87,10 +87,15 @@ class NotificationHelper {
appUpdateStatusManager.clearAllInstalled(); appUpdateStatusManager.clearAllInstalled();
break; break;
case BROADCAST_NOTIFICATIONS_UPDATE_CLEARED: 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; break;
case BROADCAST_NOTIFICATIONS_INSTALLED_CLEARED: case BROADCAST_NOTIFICATIONS_INSTALLED_CLEARED:
String key = intent.getStringExtra(EXTRA_NOTIFICATION_KEY); appUpdateStatusManager.removeApk(intent.getStringExtra(EXTRA_NOTIFICATION_KEY));
appUpdateStatusManager.removeApk(key);
break; break;
} }
} }