Repository navigation
fix(notifications): stop grouping chat notifications - #1536
Merged
Merged
Conversation
A chat push with a group key posts the chat's notification and a group summary under groupKey.hashCode(). The summary has no title or text; the system only folds it away while it has a child. dismissNotifications cancelled chatId.hashCode() and nothing else, so opening the chat in the app or tapping Mark as read left the summary on screen as an empty notification. The next push in that group gave it a child again, which is when it turned into the group chat notification. dismissNotifications now reads the active notifications and also cancels the group's summary when the dismissed chat was its last child. planNotificationDismissal holds that rule and finds the summary by FLAG_GROUP_SUMMARY rather than recomputing its id, so it does not depend on how NotificationService numbers summaries.
Each chat posted its notification under its own group key, plus a group summary with no title or text. That group only ever held one child, and Android 16 force-groups that shape: it cancels the summary and moves the child into a system group. Every new message moved the child back out for about three seconds, and during that window the empty summary showed on its own before turning into the chat notification. Chat notifications are now posted with no group and no summary. planNotificationGroup makes the call; non-chat pushes such as CONTACT_JOIN keep the payload's key, since they post a new notification each time. The Reply and Mark as read actions no longer carry the group key. This drops the summary cancel from dismissNotifications that the previous commit added: with no chat summaries posted, there is nothing for it to cancel.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Group chat pushes sometimes showed an empty Flipcash notification that turned into the chat notification a few seconds later. This happened even with the app sitting on the chat list, so nothing was being dismissed.
Each chat posts one notification under
chatId.hashCode()and folds new messages into it. When the payload has a group key, it also posts a summary undergroupKey.hashCode()with no title or text. That group only ever holds one child. On a Seeker running Android 16,device_confighasnotification_force_groupingandnotification_force_group_singletonson, and the notification dump lists the Flipcash summaries as cancelled by GroupHelper while every chat notification sits in the system'sAggregate_AlertingSectiongroup. The event log shows the same cycle on each push: the app posts the chat notification and its summary, the chat notification is pulled out of the system group, and about three seconds later it is put back. The summary is visible on its own in that window.Chat notifications are now posted with no group and no summary.
planNotificationGroupmakes that decision andNotificationGroupPlannerTestcovers it. Non-chat pushes such asCONTACT_JOINkeep the payload's group key, because they post a new notification each time and several can share one group. The Reply and Mark as read actions no longer pass the group key, since nothing reads it.The first commit on this branch cancelled a group's summary when its last chat notification was dismissed. The second commit removes that, because no chat summaries are posted any more.