Repository navigation
Improve ringtone selection - #7039
Merged
Merged
Conversation
mahibi
marked this pull request as ready for review
November 12, 2026 15:00
mahibi
marked this pull request as draft
November 12, 2026 17:51
Contributor
📱 QA build
The QA build installs alongside a released Nextcloud app, so you can keep Downloading the file requires a GitHub account, so open this link on the |
mahibi
force-pushed
the
fixCallRingtoneSelection
branch
from
November 17, 2026 10:27
c25621d to
5fa6450
Compare
mahibi
marked this pull request as ready for review
November 17, 2026 10:37
mahibi
marked this pull request as draft
November 17, 2026 10:52
On some OEMs (e.g. Samsung) the system notification channel settings only offer notification sounds for the calls channel, even though it uses USAGE_NOTIFICATION_RINGTONE, so no call ringtone could be selected. Open an in-app ringtone picker with TYPE_RINGTONE instead (as done by Signal). As the sound of an existing channel can't be changed by the app, the calls channel is recreated under a new versioned id (NOTIFICATION_CHANNEL_CALLS_V5__<timestamp>) keeping its other settings. The system channel settings are still opened if the channel is disabled or no ringtone picker is available. Assisted-by: Claude Code:claude-opus-5-5 Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
The app ships its own default sounds ("Librem by feandesign") for calls and
messages. These are app resources, not system sounds, so neither the system
channel settings nor the system ringtone picker offer them. Once a user
picked another call ringtone or message sound, there was no way back to the
bundled default.
Tapping the call or message sound now shows a dialog offering the bundled
default or "Other sound…", which opens the system picker. The picker's
"Default" entry now refers to the phone's default ringtone/notification
sound, so it means the same on all devices.
Message sounds are chosen in-app like call ringtones. As the sound of an
existing channel can't be changed by the app, the messages channel is
recreated under a versioned id (NOTIFICATION_CHANNEL_MESSAGES_V4__<timestamp>)
the same way as the calls channel, sharing the recreation logic.
Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
…ings Copying the old channel's settings into the recreated channel was not reliable: the vibration pattern overwrote the copied vibration flag, and settings like bypassing Do Not Disturb or lock screen visibility are reset by the system when an app creates a channel anyway. As changing the sound is rare, the channel is now simply recreated with the app defaults and the new sound, reusing the existing channel creation code. The new channel is created before the old one is deleted, so there is no moment without a channel, and the newest versioned channel is used if more than one exists. Also avoid crashes when a ringtone can't be resolved for its title, and when the system channel settings can't be opened. Assisted-by: Claude Code:claude-opus-5-5 Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
Some ringtone pickers return RESULT_OK without EXTRA_RINGTONE_PICKED_URI. This was read as "silent" and muted calls or messages although the user never chose silent. Such results are now ignored like a cancel. The system may reject a channel sound the app is not allowed to read with a SecurityException, which crashed the settings screen. Now the old channel is kept, the preference is not changed and an error toast is shown. Assisted-by: Claude Code:claude-opus-5-5 Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
- Catch all runtime exceptions when creating the replacement channel. Some OEMs throw IllegalArgumentException for invalid sounds, and file:// uris from third-party pickers can throw as well, which crashed the settings screen. The old channel is kept and an error toast is shown. - Use one update function per sound for both the picker result and the sound dialog, so both paths can't diverge. - Take the preview's audio usage from NotificationUtils, so the preview plays on the same volume stream as the real notification. - Only refresh the sound labels after a change, instead of re-running the whole setup, which re-registered click listeners and could re-trigger the notification warning blink animation. Assisted-by: Claude Code:claude-opus-5-5 Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
Changing the call or message sound replaces the notification channel under a new id, because Android doesn't let an app change the sound of an existing channel. Until now the new channel started with the app defaults, so any settings the user had changed in the system settings (importance, vibration, lights, badge, lock screen visibility) were lost with every sound change. The settings of the current channel are now copied to the new one, as Signal does. The vibration flag is set after the vibration pattern, because setting the pattern also changes the flag. Some settings may still be ignored by the system for new channels, e.g. bypassing Do Not Disturb without policy access. Assisted-by: Claude Code:claude-opus-5-5 Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
… screen The settings screen was migrated to Compose, so the sound dialog is now a composable and the sound change runs in the SettingsViewModel on a coroutine. The system ringtone picker is opened through an ActivityResultContract, and the system notification settings open the current, versioned channel. Assisted-by: Claude Code:claude-opus-5-5 Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
mahibi
force-pushed
the
fixCallRingtoneSelection
branch
from
November 17, 2026 19:23
5fa6450 to
4316cbd
Compare
mahibi
marked this pull request as ready for review
November 17, 2026 19:23
Contributor
rapterjet2004
approved these changes
Nov 18, 2026
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.
Fixes choosing sounds for calls and messages in Settings → Notifications.
Problem 1
USAGE_NOTIFICATION_RINGTONE, so no real call ringtone can be selected.Problem 2
Solution
The app now lets the user pick the sound itself instead of relying on the system channel settings:
are offered for calls)
everything else.
system channel settings.
Android doesn't let an app change the sound of an existing notification
channel, and a deleted channel recreated with the same id gets its old settings
back. So when the sound changes, a new channel is created under a versioned id
(
<channel>__<timestamp>) and then the old one is deleted. The other settingsof the channel (importance, vibration, lights, badge, lock screen visibility)
are copied to the new channel, so only the sound changes. Signal and Telegram
use the same workaround.
🖼️ Screenshots
🚧 TODO
🏁 Checklist
/backport to stable-xx.x🤖 AI (if applicable)