Skip to content

Feature/per room notification channels - #7145

Open
PolynomialDivision wants to merge 7 commits into
element-hq:developfrom
PolynomialDivision:feature/per-room-notification-channels
Open

Feature/per room notification channels#7145
PolynomialDivision wants to merge 7 commits into
element-hq:developfrom
PolynomialDivision:feature/per-room-notification-channels

Conversation

@PolynomialDivision

@PolynomialDivision PolynomialDivision commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Content

Automatically creates a per-room notification channel the first time a room notifies you, grouped under new "Private chats"/"Rooms" categories, so any room can appear as an Android Conversation and be marked Priority.

Motivation and context

You can prioritize certain chats and Element-X is closer integrated in the Android Conversation system.

Screenshots / GIFs

image

Tests

  • Install the updated apk
  • Go to Settings->Apps->Element-X->Notifications
  • Select a Conversation and select it as Priority or similar

Tested devices

  • Physical
  • Emulator
  • OS version(s): GrapheneOS

Checklist

  • I am aware of the etiquette.
  • This PR was made with the help of AI:
    • Yes. In this case, please request a review by Copilot.
    • No.
  • Changes have been tested on an Android device or Android emulator with API 24
  • UI change has been tested on both light and dark themes
  • Accessibility has been taken into account. See https://github.com/element-hq/element-x-android/blob/develop/CONTRIBUTING.md#accessibility
  • Pull request is based on the develop branch
  • Pull request title will be used in the release note, it clearly defines what will change for the user
  • Pull request includes screenshots or videos if containing UI changes
  • You've made a self review of your PR

@CLAassistant

CLAassistant commented Jul 2, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@github-actions github-actions Bot added the Z-Community-PR Issue is solved by a community member's PR label Jul 2, 2026
@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Thank you for your contribution! Here are a few things to check in the PR to ensure it's reviewed as quickly as possible:

  • If your pull request adds a feature or modifies the UI, this should have an equivalent pull request in the Element X iOS repo unless it only affects an Android-only behaviour or is behind a disabled feature flag, since we need parity in both clients to consider a feature done. It will also need to be approved by our product and design teams before being merged, so it's usually a good idea to discuss the changes in a Github issue first and then start working on them once the approach has been validated.
  • Your branch should be based on origin/develop, at least when it was created.
  • The title of the PR will be used for release notes, so it needs to describe the change visible to the user.
  • The test pass locally running ./gradlew test.
  • The code quality check suite pass locally running ./gradlew runQualityChecks.
  • If you modified anything related to the UI, including previews, you'll have to run the Record screenshots GH action in your forked repo: that will generate compatible new screenshots. However, given Github Actions limitations, it will prevent the CI from running temporarily, until you upload a new commit after that one. To do so, just pull the latest changes and push an empty commit.

@PolynomialDivision
PolynomialDivision marked this pull request as ready for review July 4, 2026 07:04
@PolynomialDivision
PolynomialDivision requested a review from a team as a code owner July 4, 2026 07:04
@PolynomialDivision
PolynomialDivision requested review from ganfra and removed request for a team July 4, 2026 07:04
@PolynomialDivision
PolynomialDivision force-pushed the feature/per-room-notification-channels branch from 6767740 to 639cef1 Compare July 4, 2026 07:06
@PolynomialDivision
PolynomialDivision marked this pull request as draft July 4, 2026 15:26
@PolynomialDivision
PolynomialDivision force-pushed the feature/per-room-notification-channels branch from 3d73fe6 to 26c9c3f Compare July 4, 2026 22:50
@PolynomialDivision
PolynomialDivision marked this pull request as ready for review July 5, 2026 07:27
@PolynomialDivision
PolynomialDivision force-pushed the feature/per-room-notification-channels branch 2 times, most recently from 7de8a60 to 5829297 Compare July 7, 2026 21:47
@PolynomialDivision
PolynomialDivision force-pushed the feature/per-room-notification-channels branch 4 times, most recently from 0f6bd80 to f610e94 Compare July 21, 2026 19:19
@PolynomialDivision

Copy link
Copy Markdown
Contributor Author

can someone may approve the workflow runs? maybe @ganfra ?

Add a RoomNotificationChannelManager that creates room-scoped Android
notification channels for noisy room notifications.

Channels are grouped as Private chats or Rooms, skip silent notifications,
respect PIN privacy by falling back to the shared channel, and preserve the
shared noisy channel sound. The manager also prunes stale unmodified
channels.
Route notification creation through RoomNotificationChannelManager.

Reuse the existing conversation lifecycle hooks to delete room channels when
rooms or sessions disappear, and to clear them when PIN privacy is enabled.
Refresh a room shortcut when the first incoming non-thread notification is
received, not only when the user sends a message.

This gives room channels an Android conversation shortcut, icon, and avatar
before the user replies.
Split conversation updates into sent and received paths.

Sent text and attachment messages refresh the shortcut and create a room
channel only when the room notification mode is ALL_MESSAGES. Received
messages still only refresh the shortcut; notification creation handles
their per-event noisiness.
Add a room notification settings intent provider that opens the
Android channel settings for a Matrix room. Use the conversation id
on Android 11 and newer, fall back to channel settings on
Android 8-10, and app settings before channels exist.

Expose the entry point from the room notification settings screen
and cover the API-level intent behavior with focused tests.
Publish the room shortcut before opening Android notification settings
so the platform can resolve the conversation name and icon. Propagate
room avatar metadata into shortcuts, add fallback icons, and keep
shortcut and locus IDs aligned on room notifications.
Mark room channel creation as API 26-only so lint accepts the guarded NotificationChannel access.

Remove stale preview exceptions from the Konsist test list.
@PolynomialDivision
PolynomialDivision force-pushed the feature/per-room-notification-channels branch from f610e94 to 8bb5e49 Compare July 22, 2026 13:36
@jmartinesp

Copy link
Copy Markdown
Member

Thanks for the contribution. I do personally like the the way you've grouped rooms and DMs and added options to create and customise conversations for rooms, but I'm not sure if we want the whole 'everything that receives a notification is now a conversation, but up to a max of X', which also adds extra complexity since we now have to track which channels are new/old or were modified. Also, the fact that this seems heavily vibe-coded makes me a bit uneasy.


@mxandreas this PR seems promising, although I'm not sure if we want to keep the whole logic.

To explain this a bit, this has the following pros:

  1. Allows us to create notification channel 'groups' for both rooms and DMs separately, so the users can customise in the OS settings the default behaviour they want for those (e.g. I want DMs to always have this sound, or rooms to always be silent or only have vibration but no sound, etc., or even fully disable notifications just for rooms or DMs).
  2. Adds an 'Android notification settings' shortcut item in the room notification settings so you can quickly access the notification settings for the room/DM in the OS and perform these changes instead of having to long press on an existing notification and modifying the behaviour or manually navigate to these settings in the OS settings app.
  3. Adds an easy way to treat a room as a 'conversation' on Android, allowing the customisations explained above and giving it preferential screen state when a notification is received.

And, at least in my opinion, a big con:

For each notification you receive for a room you haven't been notified in before, a new notification channel is created, and it's marked as a conversation.

This could flood the OS notification settings of the app with lots of conversations (at least on my Android 15 device I have now 10 conversations basically filling the whole screen space until I scroll down), and having them being added so easily feels a bit wrong. Also, it makes us need to have lots of logic to track which conversations/channels are outdated and should be replaced, which ones have been modified and we shouldn't touch, etc. I also think it's using the wrong storage location for that (a preferences text file instead of a proper database).

I think we'd be interested in these changes, but instead of automatically adding the rooms as conversations as soon as you receive something, maybe we could have some toggle on the room notification settings screen to manually mark the room as a conversation on Android, and allow this customisation and prioritisation. I think it should be fairly easy with the code added in this PR. What do you think?

This is an example of what could be customised, and how it works in this PR:

Screen_recording_20260722_162641.mp4

@mxandreas

Copy link
Copy Markdown
Member

Unfortunately, I currently do not have time to do a deep dive into this and give a more specific answer. However, at the conceptual level, the issue is that notifications overall aren't yet stable enough - we have seen challenges in various areas and levels - issues related to Android OS, issues related to the app notification settings, issues related to push rules complexity, issues specific to air-gapped networks, etc. Therefore, I think we should not yet introduce more options and flexibility into this area.

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

Labels

Z-Community-PR Issue is solved by a community member's PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants