Skip to content

fix(call): end push to talk on ACTION_CANCEL - #6547

Open
tareko wants to merge 1 commit into
masterfrom
fix/ptt-action-cancel-hot-mic
Open

fix(call): end push to talk on ACTION_CANCEL#6547
tareko wants to merge 1 commit into
masterfrom
fix/ptt-action-cancel-hot-mic

Conversation

@tareko

@tareko tareko commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

fix(call): end push to talk on ACTION_CANCEL

Description

The microphone button's touch listener only released push to talk on ACTION_UP. When the long-press ended with MotionEvent.ACTION_CANCEL instead — finger dragged into the system back-gesture edge or navigation bar, notification shade pulled while holding, or any other touch interception — the release branch never ran:

  • isPushToTalkActive stayed true
  • the WebRTC audio track stayed enabled
  • the device kept transmitting room audio indefinitely while the button showed "muted"

A hot-mic privacy bug, and a source of "they hear me although I'm muted" reports.

The release logic is extracted into stopPushToTalk() and now runs for both ACTION_UP and ACTION_CANCEL, pinned by unit tests.

Steps to reproduce / How to test

  1. Join a call, microphone muted
  2. Long-press the mic button (push to talk activates)
  3. End the gesture so it produces ACTION_CANCEL — e.g. drag the finger into the back-gesture edge or pull down the notification shade while holding
  4. Ask a remote participant whether they can still hear you

Without this PR: remote keeps hearing you; the button shows "muted".
With this PR: the mic is muted as soon as the gesture ends, regardless of how it ends.

Also verify regular PTT behavior is unchanged: long-press to talk, release to mute; tap toggles mute as before.

  • ⛑️ Tests are included (CallActivityPushToTalkTest)
  • 🔖 Capability is checked or not needed
  • 🔙 Backport requests or not needed
  • 📅 Milestone is set
  • 🌸 PR title is meaningful

Note: This PR was developed with AI assistance (opencode / Kimi-K3).

The microphone button's touch listener only released push to talk on
ACTION_UP. When the long-press ended with ACTION_CANCEL instead (finger
dragged into a system gesture edge, notification shade pulled), the
release branch never ran: isPushToTalkActive stayed true, the WebRTC
audio track stayed enabled, and the device kept transmitting room audio
while the button showed "muted" - a hot-mic privacy bug.

The release logic is extracted into stopPushToTalk() and now runs for
both ACTION_UP and ACTION_CANCEL.

Assisted-by: opencode:ox-alpha
Signed-off-by: Tarek Loubani <tarek@tarek.org>
@github-actions

Copy link
Copy Markdown
Contributor

APK file: https://github.com/nextcloud/talk-android/actions/runs/32628493666/artifacts/9490447059
To test this change/fix you can simply download above APK file and install and test it in parallel to your existing Nextcloud app.
qrcode (please click on link to get QR code displayed)

@AndyScherzinger AndyScherzinger added the 3. to review Waiting for reviews label Aug 23, 2026
@AndyScherzinger
AndyScherzinger requested review from mahibi and a lite review from Copilot August 23, 2026 10:22

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Fixes a privacy-critical push-to-talk edge case in CallActivity where touch sequences ending in MotionEvent.ACTION_CANCEL could leave the microphone transmitting indefinitely while the UI appeared muted.

Changes:

  • Treat ACTION_CANCEL the same as ACTION_UP for push-to-talk release detection.
  • Extract push-to-talk release logic into stopPushToTalk() for reuse and clarity.
  • Add unit tests covering push-to-talk release detection (ACTION_UP, ACTION_CANCEL, and non-release actions).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
app/src/main/java/com/nextcloud/talk/activities/CallActivity.kt Adds a shared stop helper and ends PTT on both ACTION_UP and ACTION_CANCEL.
app/src/test/java/com/nextcloud/talk/activities/CallActivityPushToTalkTest.kt Adds unit tests to pin expected release-action behavior.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

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

Labels

3. to review Waiting for reviews AI assisted

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants