Remove handler callbacks correctly
Use removeCallbacksAndEqualMessages when removing handler callbacks by notification key.
If a notification was updated and then canceled during the DELAY_FORCE_REGROUP_TIME: the callback was not removed because Handler#removeCallbacksMessages would check for reference equality, which would fail because the update would create a new
NotificationRecord with the same key.
Also skip calling GroupHelper#onNotificationPostedWithDelay if the notification was removed during DELAY_FORCE_REGROUP_TIME.
Flag: android.service.notification.notification_force_grouping
Test: atest NotificationManagerServiceTest
Bug: 376222541
Change-Id: I651c6d094558c558153f0a4e667ce4c3874ca398
2 files changed