Skip to content

Attempt to fix edge case where actionable notifications aren't cleared correctly#6905

Draft
jaydeethree wants to merge 6 commits into
home-assistant:mainfrom
jaydeethree:issue-6705
Draft

Attempt to fix edge case where actionable notifications aren't cleared correctly#6905
jaydeethree wants to merge 6 commits into
home-assistant:mainfrom
jaydeethree:issue-6705

Conversation

@jaydeethree
Copy link
Copy Markdown

Android 16 added some more automatic notification groups ("We’re also force-grouping notifications that come from a single app"):

https://blog.google/products-and-platforms/platforms/android/android-16/

Those new groups are defined here:

https://cs.android.com/android/platform/superproject/+/android-latest-release:frameworks/base/services/core/java/com/android/server/notification/GroupHelper.java;drc=d5d4670d8a245da5468af767b17d1e57ed7c9278;l=2106

And the section names come from here:

https://cs.android.com/android/platform/superproject/+/android-latest-release:frameworks/base/services/core/java/com/android/server/notification/GroupHelper.java;drc=d5d4670d8a245da5468af767b17d1e57ed7c9278;l=195-199

This change makes Home Assistant recognize these new automatic groups and treat them the same as the existing ranker_group.

Full disclosure: I used AI to help me debug this issue. While I am familiar with Java and Kotlin, I do not have experience with Android development.

Summary

Checklist

  • New or updated tests have been added to cover the changes following the testing guidelines. - There are no existing tests for this behavior, so no tests were added/modified
  • The code follows the project's code style and best_practices.
  • The changes have been thoroughly tested, and edge cases have been considered. - I don't have enough experience with Android development to confidently say 'yes' to this, so I'm leaving it unchecked
  • Changes are backward compatible whenever feasible. Any breaking changes are documented in the changelog for users and/or in the code for developers depending on the relevance.

Screenshots

Link to pull request in documentation repositories

User Documentation: home-assistant/companion.home-assistant#

Developer Documentation: home-assistant/developers.home-assistant#

Any other notes

Android 16 added some more automatic notification groups ("We’re also force-grouping notifications that come from a single app"):

https://blog.google/products-and-platforms/platforms/android/android-16/

Those new groups are defined here:

https://cs.android.com/android/platform/superproject/+/android-latest-release:frameworks/base/services/core/java/com/android/server/notification/GroupHelper.java;drc=d5d4670d8a245da5468af767b17d1e57ed7c9278;l=2106

And the section names come from here:

https://cs.android.com/android/platform/superproject/+/android-latest-release:frameworks/base/services/core/java/com/android/server/notification/GroupHelper.java;drc=d5d4670d8a245da5468af767b17d1e57ed7c9278;l=195-199

Full disclosure: I used AI to help me debug this issue. While I am familiar with Java and Kotlin, I do not have experience with Android development.
Copilot AI review requested due to automatic review settings May 26, 2026 17:28
Copy link
Copy Markdown

@home-assistant home-assistant Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @jaydeethree

It seems you haven't yet signed a CLA. Please do so here.

Once you do that we will be able to review and accept this pull request.

Thanks!

@home-assistant home-assistant Bot marked this pull request as draft May 26, 2026 17:29
@home-assistant
Copy link
Copy Markdown

Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍

Learn more about our pull request process.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Updates notification-group cancellation logic to treat additional Android “auto” notification groups as non-custom, preventing unintended group cancellation behavior.

Changes:

  • Expands the set of Android auto-group suffixes that should be ignored when determining whether a group is “custom”.
  • Updates inline comment to reflect multiple Android auto groups.

@jaydeethree jaydeethree marked this pull request as ready for review May 26, 2026 18:29
@home-assistant home-assistant Bot dismissed their stale review May 26, 2026 18:29

Stale

Copy link
Copy Markdown
Member

@TimoPtr TimoPtr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also invite you to update the log

                Timber.d("Notification is in a group ($groupKey), but it is in the auto group. Cancel notification")

to it is in an auto group.

@home-assistant home-assistant Bot marked this pull request as draft May 27, 2026 11:42
@TimoPtr
Copy link
Copy Markdown
Member

TimoPtr commented May 27, 2026

Also update the title of the Pull request and did you manage to test if that fixed the issue properly?

@jaydeethree jaydeethree changed the title Attempt to fix https://github.com/home-assistant/android/issues/6705 Attempt to fix edge case where actionable notifications aren't cleared correctly May 27, 2026
@jaydeethree
Copy link
Copy Markdown
Author

I also invite you to update the log

                Timber.d("Notification is in a group ($groupKey), but it is in the auto group. Cancel notification")

to it is in an auto group.

Done.

Also update the title of the Pull request

Done.

and did you manage to test if that fixed the issue properly?

No - I don't have an Android development environment so I'm unfortunately not able to compile this into an APK for testing.

@jaydeethree jaydeethree marked this pull request as ready for review May 27, 2026 21:29
@home-assistant home-assistant Bot requested a review from TimoPtr May 27, 2026 21:29
@TimoPtr
Copy link
Copy Markdown
Member

TimoPtr commented May 28, 2026

I also invite you to update the log

                Timber.d("Notification is in a group ($groupKey), but it is in the auto group. Cancel notification")

to it is in an auto group.

Done.

Also update the title of the Pull request

Done.

and did you manage to test if that fixed the issue properly?

No - I don't have an Android development environment so I'm unfortunately not able to compile this into an APK for testing.

As per our policy, you need to be able to test this change. We cannot merge this otherwise. I'll ask you to provide a video in the description of the PR to show the behavior before and after the changes.

@TimoPtr TimoPtr marked this pull request as draft May 28, 2026 07:24
"|g:ranker_group",
"|g:Aggregate_AlertingSection",
"|g:Aggregate_SilentSection",
)
Copy link
Copy Markdown
Member

@TimoPtr TimoPtr May 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see in the AOSP code that there is also PeopleSection is this something that is relevant for us?

Even more groups like PromotionsSection, SocialSection, NewsSection, RecsSection

@jpelgrom
Copy link
Copy Markdown
Member

and did you manage to test if that fixed the issue properly?

No - I don't have an Android development environment so I'm unfortunately not able to compile this into an APK for testing.

As per our policy, you need to be able to test this change. We cannot merge this otherwise. I'll ask you to provide a video in the description of the PR to show the behavior before and after the changes.

Note that after building completes on GitHub, you can download an apk file to install a debug version side-by-side with the normal release to test your changes. Just make sure to enable persistent connection in settings to be able to receive notifications.

Click on the 'Checks' tab below your PR title > click on 'Pull Request' on the left > scroll down and download the "APKs" artifact (you must be logged in to GitHub).

@jaydeethree
Copy link
Copy Markdown
Author

As per our policy, you need to be able to test this change. We cannot merge this otherwise.

Understood, and for what it's worth I agree with that policy :) I should have time to test this sometime in the next week, once I do that I'll post an update here. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Actionable Notifications bug - choosing an action does not always clear the notification

5 participants