Skip to content

Forget Device on an Apple Watch does not stop the Watch microphone #20780

Description

@Itaxh1

TL;DR: Forgetting an Apple Watch from Settings disconnects and disposes the WatchTransport, which only cancels timers and closes Dart streams. It never sends stopRecording() to the Watch, so the Watch keeps recording after the phone says the device is forgotten, and the phone no longer consumes that audio. Reproduced on the iOS Simulator with the real DeviceService, AppleWatchDeviceConnection and WatchTransport.

Product impact (see PRODUCT.md and ISSUE_TRIAGE_GUIDE.MD)

  • Primary loop layer: Capture
  • Involves data loss, failed capture, or broken sync/trust. Broken trust: the microphone keeps running after an explicit "forget".

Describe the bug

WatchTransport has a stopRecording() method that does stop the Watch engine; neither disconnect() nor dispose() calls it.

To Reproduce

  1. Pair an Apple Watch and start recording from it.
  2. Phone: Settings → Device → Forget Device → confirm.
  3. The Watch still shows recording; its mic stays on.

Current behavior

Zero stopRecording calls; the Watch stays in recording state.

Expected behavior

Disconnecting or forgetting a Watch stops its recorder first (best effort), then closes the transport.

Screenshots

No screenshot (no Watch on the Simulator). Evidence below.

user ID (can we access the user info to validate the bug?):

Not needed: found in the code and reproduced without a user account (local fixture backend).

Smartphone + device (please complete the following information):

  • Device: iOS Simulator, iPhone 16 (reproduction); the bug is in shared code, so physical iPhones are affected too
  • OS: iOS 18.0 (Simulator)
  • App Version: main at cf8201c (dev flavor)
  • Device version: Apple Watch (omiWatchApp)

Additional context

Root cause. Forget Device goes through DeviceService; AppleWatchDeviceConnection delegates disconnect to the transport. WatchTransport.disconnect and dispose cancel timers and close streams but never call stopRecording(), the only path that reaches WatchAudioRecorderViewModel.stopRecording on the Watch.

Reproduction. Reproduced on the iOS Simulator (iPhone 16, iOS 18.0) with a temporary integration test on main at cf8201c2f5. The test drives the real production classes; only the platform boundary is faked (the WatchRecorderHostAPI pigeon, tracking start/stop calls). Start recording, then DeviceService.forgetDevice:

OMI_FACT:c13-forget-watch-keeps-recording:startRecordingCalls=1
OMI_FACT:c13-forget-watch-keeps-recording:stopRecordingCalls=0
OMI_FACT:c13-forget-watch-keeps-recording:watchStillRecording=true
OMI_FACT:c13-forget-watch-keeps-recording:connectionExists=false
OMI_FACT:c13-forget-watch-keeps-recording:transportDisposed=true
OMI_REPRO:c13-forget-watch-keeps-recording:REPRODUCED

Activity

  1. added
    bug
    flutter
    p1
    on Oct 6, 2026
  2. Aj2280 commented on Oct 6, 2026

    @Aj2280
    Contributor

    I've submitted a fix for this in PR #20818:

    • Added best-effort await stopRecording() to both WatchTransport.disconnect() and WatchTransport.dispose().
    • Added constructor dependency injection for WatchRecorderHostAPI on WatchTransport for hermetic testing.
    • Added comprehensive unit tests in app/test/unit/watch_transport_disconnect_test.dart asserting that WatchTransport.disconnect(), WatchTransport.dispose(), and AppleWatchDeviceConnection.disconnect() all invoke stopRecording() and safely handle communication exceptions.
    • Passed all 22 repo preflight checks (make preflight).
  3. hardik4love-lang commented on Oct 15, 2026

    @hardik4love-lang
    Contributor

    Resolved in PR #21521.

    Overview of Fix

    • Apple Watch Mic Shutdown: Added awaited, best-effort stopRecording() calls to both WatchTransport.disconnect() and WatchTransport.dispose(), ensuring the Watch microphone releases immediately upon Forget Device or disconnect.
    • Dependency Injection Seam: Added constructor DI seam WatchTransport({WatchRecorderHostAPI? hostAPI}) for testability without altering existing production wiring.
    • Hermetic Unit Test Suite: Added 4 unit tests in app/test/unit/watch_transport_disconnect_test.dart asserting disconnect and dispose recording termination and graceful exception handling.
    • Review: Reviewed and validated end-to-end by collaborator @Git-on-my-level.

    @josancamon19 @kodjima33 Proposing $100 bounty under the Omi Contribution Guide for this critical P1 privacy defect resolution.

  4. hardik4love-lang commented on Oct 15, 2026

    @hardik4love-lang
    Contributor

    PR #21521 has been merged by @kodjima33.

    Bounty Claim Details

    Thank you @kodjima33 @josancamon19!

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: Apple Watchbugflutterp1recording

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions