Fix NotificationEntry mismatch crashes when tapping notification.
The root of these problems is holding onto a NotificationEntry instance and performing a dismiss or end to lifetime extension after a delay, during which apps or the system may cancel and re-post the given notification. The original fix to this by lifetime extending these notifications worked in the case where this closure around a NotificationEntry perfectly matched lifetime extension, but this was becoming a whack-a-mole of finding all the ways we might need to extend these notifications. Moreover, there was a bug in the implementation that used notification keys as the keys for the lifetime extension map, rather than NotificationEntry instances themselves, which caused b/227254780. This CL introduces the concept of reporting future dismissals to the NotifCollection (via OnUserInteractionCallback) which allows the NotifCollection to respond to system server's notification removal events by preventing the eventual dismissal call from crashing. This design is not the ideal end-game (see b/232260346) but rather preserves the existing call order into NotifCollection while also bailing out before any calls are made that would cause a crash. Test: atest ExpandableNotificationRowTest StatusBarNotificationActivityStarterTest NotifCollectionTest Fixes: 230540148 Fixes: 227254780 Bug: 232260346 Change-Id: Ia66ae5ade3fbfdd0436d54dcbeef720618622716
Loading
Please register or sign in to comment