Remove failed icon bindings on subsequent success

Flag: ACONFIG com.android.systemui.notifications_icon_container_refactor DEVELOPMENT
Bug: 278765923
Test: manual - test on AOD, status bar, and shelf, verify no crashes
Change-Id: I815e7945fbadaa3951b9b74e55e08401a395aff9
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/icon/ui/viewbinder/NotificationIconContainerViewBinder.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/icon/ui/viewbinder/NotificationIconContainerViewBinder.kt
index a85c440..b1e52af 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/icon/ui/viewbinder/NotificationIconContainerViewBinder.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/icon/ui/viewbinder/NotificationIconContainerViewBinder.kt
@@ -244,7 +244,7 @@
                 }
 
                 // Add and bind.
-                val toAdd: Sequence<String> = iconsDiff.added.asSequence() + failedBindings
+                val toAdd: Sequence<String> = iconsDiff.added.asSequence() + failedBindings.toList()
                 for ((idx, notifKey) in toAdd.withIndex()) {
                     // Lookup the StatusBarIconView from the store.
                     val sbiv = viewStore.iconView(notifKey)
@@ -252,6 +252,7 @@
                         failedBindings.add(notifKey)
                         continue
                     }
+                    failedBindings.remove(notifKey)
                     // The view might still be transiently added if it was just removed and added
                     // again
                     view.removeTransientView(sbiv)