When several chats have pending notifications, ONE new message makes Android show heads-up banners for OTHER chats that received nothing. Reading one chat does the same.
MEASURED (adb, reproduced on demand with two bots)
One new message -> 2 banners: the receiving chat plus an unrelated one. Reading one chat -> 2 banners, both unrelated.
All banners were group CHILD notifications (isSummary=false).
showExtraNotifications() re-publishes the whole stack on every change: 8 notifications in 0.083 s. Re-posts keep the same mCreationTimeMs: updates, not re-creations.
No notification carries FLAG_ONLY_ALERT_ONCE; setOnlyAlertOnce never appears in NotificationsController.java.
WHY IT IS APP-SIDE
Children already carry GROUP_ALERT_SUMMARY (NotificationsController.java:5618), so the alerting notification is the group summary. SystemUI transfers its heads-up to a child (HeadsUpCoordinator.findBestTransferChild). Repetition is gated by shouldHunAgain(): !entry.hasInterrupted() || (flags and FLAG_ONLY_ALERT_ONCE) == 0. Without the flag this is always true, so every re-post re-alerts on stock Android too - one banner there, one per chat on ColorOS, which also ignores GROUP_ALERT_SUMMARY for children.
SUGGESTED FIX
Set FLAG_ONLY_ALERT_ONCE on the group summary when the rebuild is not caused by a new incoming message (read/dismiss/refresh), and leave it off when a message actually arrives.
ALSO
While 2+ chats are pending, per-chat notifications move to the internal Other channel, so users cannot suppress repeats per chat; blocking it is auto-reverted by checkOtherNotificationsChannel().
repeat_messages defaults to 60 min, so from 11:00 to 22:00 the whole stack re-posts and re-alerts hourly while one personal message stays unread.
Steps to reproduce
On Android, keep notifications for private chats enabled (default).
Receive messages in 4-5 different chats and leave them all unread, so several Telegram notifications are pending at the same time. Two or more is enough: grouping (useSummaryNotification) turns on from two chats.
Leave the phone unlocked on the home screen and wait for ONE new message to arrive in one of those chats.
Observe: a heads-up banner appears for the chat that received the message AND for at least one other chat that received nothing new.
Now open Telegram and read one of the pending chats.
Observe: heads-up banners appear again for the remaining chats, showing old content that has not changed.
With only one pending chat the bug does not happen - grouping is not used, and the notification behaves normally.
I debugged beta 13.2.0 (7287) on Find N6 (ColorOS 17). It seems to include only part of PR DrKLO/Telegram#2251. dumpsys notification with 2 chats:
- Children are still in Other3 (importance 3), with groupAlertBehavior=SUMMARY. - The summary is groupAlertBehavior=ALL, in the last chat’s channel, so it plays the sound. - ONLY_ALERT_ONCE is set correctly on old children, so that part works.
Result: of 6 messages, only the first (single chat, importance 4) showed a heads-up. ColorOS shows none for a summary, and children can’t at importance 3.
Still missing from the PR: 1. The new message’s child stays in its own chat channel, with GROUP_ALERT_CHILDREN. 2. The summary uses GROUP_ALERT_CHILDREN. 3. Other children keep their current channel. 4. The summary uses the loudest child’s channel, not Silent.
Note: my PR build was tested with Keep-Alive and Background Connection, as self-signed builds get no FCM token, so please verify the FCM path with the full patch.
I saw that the code already has platform-specific checks, for example XiaomiUtilities.isMIUI(), which reads the ro.miui.ui.version.name system property. Following the same approach, I limited the fix to ColorOS 16+ by checking ro.build.version.oplusrom, so other devices keep the current behaviour, except that reposted children get setOnlyAlertOnce(true) on Android 8+.
PR updated and tested on ColorOS 17 (Oppo Find N6)
Original reporter here (Find X9 Ultra, ColorOS 17.0.0.101, Android 17, Telegram 13.2.0 (72809)).
Since August I have logged every Telegram notification post on this phone. A few findings that may matter for the fix:
1. The first post of a message is built from the push: MessagingStyle text is cut to ~200 chars (seen 199, 205, 216, 225, 227, 240) and the message time differs from the real one by 1-5 s. At the next re-post of the stack the same message has the full text (623-3903 chars) and the real time. With two bots I checked that the push text is an exact prefix of the full text. From outside the app this cannot be told from a new message, so it is shown again as new. Keeping the message date from the push would avoid it. 2. Re-posts are not limited to active notifications: a message 14 h old was posted again although its notification was no longer shown. 3. Other3 is shared by chat children and service notifications (MusicPlayerService, VideoEncodingService, VoIPService "call ended", LocationSharingService). Users who enable sound or banners on Other3 to get chat banners back also hear it at the start of voice/video notes and when sending a video. Moving children to their own chat channel fixes this too. 4. Android 15+: apps that read notifications get redacted copies of notifications marked sensitive (any digits, e.g. "2500"), and the message time in the copy is the current time on every re-post. So each re-post of unchanged children looks like a new message to them. 5. ColorOS shows heads-up for group children despite GROUP_ALERT_SUMMARY (AOSP suppresses it in HunGroupAlertBehaviorSuppressor). Reported to OPPO: community.oppo.com/thread/2201289459662585860
If you install Telegram from the link, all notifications and banners will be turned off by default. This is a ColorOS policy, so you'll need to enable them manually.
How to enable them: Receive at least one notification of each type you want to enable. The corresponding notification group only appears in your phone's notification settings after that. Turn on banners for: Private chats Group chats Channels (only if you also want to test notifications and banners there) Turn on Keep Alive and Background Activity in the notification settings. Without them, notifications won't work properly.
Tested build 122 (13.2.2, 72929) on Find X9 Ultra, ColorOS 17.0.0.101, Android 17, fresh install, default settings. - 2 bots, 2 pending chats, 8 messages: 8 heads-up banners, one per message, each from the chat that got the message, ~0.4 s after sending. No banners for unrelated chats. Two messages in a row to one chat: one banner each. - Reading one chat while another is pending: no banners. - dumpsys: summary groupAlertBehavior=CHILDREN; new message's child CHILDREN; older child SUMMARY + ONLY_ALERT_ONCE; all in the chat channel (importance 4), not Other3. - Only oddity: the very first message after install was posted 14 s late, together with the second one. Not repeated. Fixed on my device, thank you!
One thing the fix does not cover: the stack is still re-posted on every change. A notification listener on the same phone got 2 posts per new message (the new child plus an unchanged re-post of the other chat's child), and reading one chat re-posted the other one. ONLY_ALERT_ONCE only affects the system's own alerting; listener apps (e.g. wearable companions) receive every post and show it as new. Updating only the child that changed would avoid this. Would you like this tracked here, or should it be a separate card? If you prefer a separate one, I will open it.
dumpsys notification with 2 chats:
- Children are still in Other3 (importance 3), with groupAlertBehavior=SUMMARY.
- The summary is groupAlertBehavior=ALL, in the last chat’s channel, so it plays the sound.
- ONLY_ALERT_ONCE is set correctly on old children, so that part works.
Result: of 6 messages, only the first (single chat, importance 4) showed a heads-up. ColorOS shows none for a summary, and children can’t at importance 3.
Still missing from the PR:
1. The new message’s child stays in its own chat channel, with GROUP_ALERT_CHILDREN.
2. The summary uses GROUP_ALERT_CHILDREN.
3. Other children keep their current channel.
4. The summary uses the loudest child’s channel, not Silent.
Note: my PR build was tested with Keep-Alive and Background Connection, as self-signed builds get no FCM token, so please verify the FCM path with the full patch.
PR updated and tested on ColorOS 17 (Oppo Find N6)
Do you need a video? Or should i debug it?
Since August I have logged every Telegram notification post on this phone. A few findings
that may matter for the fix:
1. The first post of a message is built from the push: MessagingStyle text is cut to ~200 chars
(seen 199, 205, 216, 225, 227, 240) and the message time differs from the real one by 1-5 s.
At the next re-post of the stack the same message has the full text (623-3903 chars) and the
real time. With two bots I checked that the push text is an exact prefix of the full text.
From outside the app this cannot be told from a new message, so it is shown again as new.
Keeping the message date from the push would avoid it.
2. Re-posts are not limited to active notifications: a message 14 h old was posted again although
its notification was no longer shown.
3. Other3 is shared by chat children and service notifications (MusicPlayerService,
VideoEncodingService, VoIPService "call ended", LocationSharingService). Users who enable sound or
banners on Other3 to get chat banners back also hear it at the start of voice/video notes and when
sending a video. Moving children to their own chat channel fixes this too.
4. Android 15+: apps that read notifications get redacted copies of notifications marked sensitive
(any digits, e.g. "2500"), and the message time in the copy is the current time on every re-post.
So each re-post of unchanged children looks like a new message to them.
5. ColorOS shows heads-up for group children despite GROUP_ALERT_SUMMARY (AOSP suppresses it in
HunGroupAlertBehaviorSuppressor). Reported to OPPO: community.oppo.com/thread/2201289459662585860
If you install Telegram from the link, all notifications and banners will be turned off by default. This is a ColorOS policy, so you'll need to enable them manually.
How to enable them:
Receive at least one notification of each type you want to enable. The corresponding notification group only appears in your phone's notification settings after that.
Turn on banners for:
Private chats
Group chats
Channels (only if you also want to test notifications and banners there)
Turn on Keep Alive and Background Activity in the notification settings. Without them, notifications won't work properly.
Bluetooth headset connected during a call is ne... #67630
I already fixed that and checked.
- 2 bots, 2 pending chats, 8 messages: 8 heads-up banners, one per message, each from the chat that got
the message, ~0.4 s after sending. No banners for unrelated chats. Two messages in a row to one chat: one banner each.
- Reading one chat while another is pending: no banners.
- dumpsys: summary groupAlertBehavior=CHILDREN; new message's child CHILDREN; older child SUMMARY + ONLY_ALERT_ONCE;
all in the chat channel (importance 4), not Other3.
- Only oddity: the very first message after install was posted 14 s late, together with the second one. Not repeated.
Fixed on my device, thank you!
One thing the fix does not cover: the stack is still re-posted on every change. A notification listener on the same
phone got 2 posts per new message (the new child plus an unchanged re-post of the other chat's child), and reading
one chat re-posted the other one. ONLY_ALERT_ONCE only affects the system's own alerting; listener apps (e.g. wearable
companions) receive every post and show it as new. Updating only the child that changed would avoid this.
Would you like this tracked here, or should it be a separate card? If you prefer a separate one, I will open it.