element-hq / element-hq/element-x-android

Allow opting out of Android conversation notifications (they bypass Do Not Disturb with no in-app control)

Open
#7,471 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
Kotlin
Stars
2.4k
Forks
624
Avg merge
1d 14h
Merged PRs (30d)
149

Description

### Your use case

#### What would you like to do?

Choose whether Element X publishes room notifications as Android *conversations* — either app-wide or per room.

#### Why would you like to do it?

A conversation notification is exempt from Do Not Disturb whenever the system DND policy allows conversations from anyone. Element X calls `setShortcutId(...)` on every room notification ([`NotificationCreator.kt`](https://github.com/element-hq/element-x-android/blob/develop/libraries/push/impl/src/main/kotlin/io/element/android/libraries/push/impl/notifications/factories/NotificationCreator.kt)), so *every* room is a conversation and *nothing* can be silenced by DND. There is no in-app way to change this, and on OEM ROMs that removed the system conversation UI there is no system-side way either.

Real example, measured with `adb` on the device while DND was active (room ids and account redacted):

```
mZenMode=ZEN_MODE_IMPORTANT_INTERRUPTIONS
mConsolidatedPolicy=NotificationManager.Policy[priorityCategories=...,PRIORITY_CATEGORY_MESSAGES,
PRIORITY_CATEGORY_CONVERSATIONS, priorityMessageSenders=PRIORITY_SENDERS_STARRED,
priorityConvSenders=anyone, ...]

Zen Log:
not_intercepted: io.element.android.x|404891|, new:conversationAnyone
intercepted: io.element.android.x|404890|null, new:!audienceMatches
```

The channel itself does not request a bypass — `DEFAULT_NOISY_NOTIFICATION_CHANNEL_ID_V2_v1` has `mImportance=3, mBypassDnd=false`, and there is no `setBypassDnd` call anywhere in the repository. The exemption comes purely from conversation status. The only Element X notification DND did silence was the group summary, which carries no shortcut.

For comparison on the same device, Telegram publishes shortcuts for only some chats (4 of 8 live notification records), so DND silences the rest. Element X had a shortcut on 4 of 5 records — every room. In practice Element X is the one messaging app on this phone that can never be silenced by Do Not Disturb.

My use case is bot rooms: automation agents post status messages, several of them between 05:00 and 06:20. They must not make sound at night, but I do want them audible during the day — which is exactly what Do Not Disturb is for.

#### How would you like to achieve it?

A notification setting, **on by default** so nothing changes for existing users: *"Use conversation notifications"*. When switched off, skip `setShortcutId(...)` and do not publish the shortcut. A per-room toggle would be even better, but a single global switch already solves the problem.

### Have you considered any alternatives?

- **Muting the room in Element** — works, but it is all-or-nothing. The silent channel is `IMPORTANCE_LOW`, so the room then makes no sound at any time of day, not only at night. What I want is "silent at night, audible during the day", which is a Do Not Disturb concern, not a per-room mute concern.
- **System conversation settings** (Default / Priority / Silent) — the correct place for this, and it works on stock Android. My device has no conversation section in the notification shade, no conversation section in the app's notification settings (only the channel list), and the AOSP screen `Settings$ZenModeSettingsActivity` opens as an empty window.
- **Tightening the DND policy** so conversations are no longer allowed — the ROM exposes no such control (its DND exceptions cover calls only: All / All contacts / Favourites / Custom), and `cmd notification` cannot set policy categories over adb.

### Additional context

I am aware this behaviour is deliberate and wanted by other users: #1547 asked for conversation notifications, and #7056 reports their loss as a regression, explicitly valuing *"custom sounds, popup settings, and bypassing Do Not Disturb"*. That is exactly why I am asking for a switch rather than a change of default — the current behaviour should stay the default, it just needs an escape hatch for people who want DND to keep working.

Device: Xiaomi 23090RA98G, HyperOS 1.0, Android 14 (SDK 34). Element X 26.08.0 from Google Play. Self-hosted Synapse.

### Are you willing to provide a PR?

No

Contributor guide

Open the contributing guide

Research direction

Start with libraries/push/impl/src/main/kotlin/io/element/android/libraries/push/impl/notifications/factories/NotificationCreator.kt and trace where setShortcutId(...) is applied to room notifications. Determine how an app-wide notification setting is stored and exposed, then make the opt-out prevent conversation shortcuts while keeping the default enabled. Done means users can disable conversation notifications and existing default behavior remains unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, kotlin
Domain
mobile
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.