Skip to content

fix(chat): let the voice message notification go right after a pause - #6932

Open
ToteMeiSter wants to merge 1 commit into
masterfrom
fix/voice-message-notification-timeout
Open

ToteMeiSter wants to merge 1 commit into
masterfrom
fix/voice-message-notification-timeout

Conversation

@ToteMeiSter

@ToteMeiSter ToteMeiSter commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Lets the notification of a voice message be swiped away right after the message is paused or ends.

After a pause or the end of a voice message the notification stays for about 10 minutes and cannot be swiped away. Media3 keeps a MediaSessionService in the foreground for DEFAULT_FOREGROUND_SERVICE_TIMEOUT_MS (600000 ms) after the player stops, and the notification of a foreground service cannot be dismissed. VoiceMessageMediaService does not change the timeout (media3 1.11.1).

The change is setForegroundServiceTimeoutMs(0) in VoiceMessageMediaService.onCreate. The service leaves the foreground as soon as the playback stops; while a message plays it stays in the foreground, so playback in the background is not affected.

To test: play a voice message and let it end, or pause it. The notification can be swiped away at once (before: after about 10 minutes). Play a message and leave the chat: it keeps playing in the background with the notification.

Unit test: VoiceMessageMediaServiceForegroundTest reads the timeout of the notification manager of the real service (reflection, there is no getter) and fails without the change. It checks the setting, not a live notification.

Tested on: Huawei DEL-LX9 (Android 12), on a develop build of the fork that includes this fix.

Overlaps with #6840: both change VoiceMessageMediaService.kt.

🖼️ Screenshots

No UI change.

🚧 TODO

  • Nothing left

🏁 Checklist

  • ⛑️ Tests (unit and/or integration) are included or not needed
  • 🔖 Capability is checked or not needed
  • 🔙 Backport requests are created or not needed: /backport to stable-xx.x
  • 📅 Milestone is set
  • 🌸 PR title is meaningful (if it should be in the changelog: is it meaningful to users?)

🤖 AI (if applicable)

  • The content of this PR was partly or fully generated using AI

🤖 Generated with Claude Code

Media3 keeps a media service in the foreground for 10 minutes after the player pauses or the message ends (DEFAULT_FOREGROUND_SERVICE_TIMEOUT_MS), and the notification of a foreground service cannot be swiped away. Set the timeout to 0, so that the service leaves the foreground as soon as playback stops.

Assisted-by: Claude-Code:claude-sonnet-5-5
Signed-off-by: Krainov Gleb <krajnov.g@kontentplus.ru>
@github-actions

Copy link
Copy Markdown
Contributor

📱 QA build

Download app-qa-debug.apk
QR code Open the QR code for this download
Commit eaaee8a
Version 6932
Available until 7 days after this build

The QA build installs alongside a released Nextcloud app, so you can keep
using your existing install while testing.

Downloading the file requires a GitHub account, so open this link on the
device you want to test on, or transfer the APK to it.

@github-actions

Copy link
Copy Markdown
Contributor

Codacy

Lint

TypemasterPR
Warnings138138
Errors1515

SpotBugs

CategoryBaseNew
Bad practice77
Correctness88
Dodgy code4040
Internationalization33
Malicious code vulnerability33
Performance88
Security1111
Total8080

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.

2 participants