Repository navigation
fix(android): fail closed when Background Mode has no native BLE route - #8353
Conversation
Partial mitigation for BasedHardware#7548. Background Mode now validates that a connected device has a native BLE audio route before accepting the enable request. Devices without a native route (Apple Watch, Bee, Fieldy, Frame, Limitless, Plaud) or with an empty device ID (stale sentinel) will be rejected, and the toggle in the UI will be disabled with a warning message. Changes: - CaptureProvider.setBackgroundModeEnabled(bool): gate enable behind hasNativeBleAudioRoute predicate; disable clears all prefs and stale nativeBleStreamConfig; rejected enable defensively clears stale state - CaptureProvider.hasNativeBleAudioRoute: new @VisibleForTesting predicate requiring device != null, device.id.isNotEmpty, and _nativeBleAudioTarget(device) != null - CaptureProvider.setBatchMode: only re-enable native streaming when turning batch OFF AND a concrete device with native route is connected - CaptureProvider._saveNativeBleStreamConfig: when audioTarget is null, also clear backgroundModeEnabled and remove stale config - Profile._showBackgroundModeSheet: delegates to CaptureProvider.setBackgroundModeEnabled; shows warning when route is unavailable; disables switch when no route - l10n: add backgroundModeUnavailable string to all 49 locale ARBs - Tests: 34 new tests covering route matrix, empty-id sentinel, rejected enable, stale reconciliation, enable/disable cycle, batch interaction, device switching
|
Bro how do you work i mean what you process of ideation to production |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1f313a10e0
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Fixed the CI Dart formatting failure by running the same Flutter/Dart formatter used by CI via Verification: |
There was a problem hiding this comment.
39 issues found and verified against the latest diff
Confidence score: 3/5
- In
app/lib/pages/settings/profile.dart, the Background Mode toggle is effectively locked when OFF, so users may be unable to enable the feature at all; merging as-is risks a direct settings regression for anyone trying to turn it on — update the enable/disable gating to depend on route availability (while still allowing OFF when currently ON) and add a quick UI/state test before merging. - The new localization key is still English across multiple locale files (
app/lib/l10n/app_da.arb,app/lib/l10n/app_fi.arb,app/lib/l10n/app_fr.arb,app/lib/l10n/app_tl.arb,app/lib/l10n/app_pl.arb,app/lib/l10n/app_ta.arb,app/lib/l10n/app_vi.arb,app/lib/l10n/app_cs.arb,app/lib/l10n/app_ms.arb), which will ship mixed-language UI and reduce polish for non-English users — fill in those translations (or temporarily fall back explicitly) before merging.
You’re at about 94% of the monthly reviewed-line limit. You may want to disable incremental reviews to conserve quota. Reviews will continue until that limit is exceeded. If you need help avoiding interruptions, please contact [email protected].
Tip: instead of fixing issues one by one fix them all with cubic
Partial review: This PR has more than 50 files, so cubic reviewed the highest-priority files first. During the trial, paid plans get a higher file limit.
You can try an ultrareview to bypass the file limit, comment @cubic-dev-ai ultrareview. Learn more.
Re-trigger cubic
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 00aee19e08
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Addressed the first Codex review round on #8353. Fixes:
Verification: Targeted |
|
Addressed the follow-up Codex findings and the Cubic stale localization/switch threads. Fixes:
Verification: Targeted Flutter tests still cannot complete in the local container because |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 65f9da1631
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Addressed the latest #8353 Codex findings. Fixes:
Verification: |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 288c76def8
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Addressed the latest foreground-ready review. Fix:
Verification: |
|
Addressed the latest foreground-ready review comment. Fix:
Verification: I also attempted the targeted Flutter test for the new case, but the current |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9bf2e9460b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Addressed the accepted-enable test setup feedback. Fix:
Verification: |
|
Addressed the test setup review comment. Fix:
Verification: |
Summary
Partial mitigation for #7548 — fail-closed guardrail only, no new device protocol support.
Background Mode now validates that the currently-connected device has a concrete native BLE audio route before accepting the enable request. This prevents users from enabling Background Mode when no compatible device can actually stream audio in the background, which would silently fail and leave them with non-functional recording.
What this changes
setBackgroundModeEnabled(bool)method owns all Background Mode state. Enable is gated behindhasNativeBleAudioRoutepredicate. Disable clearsbackgroundModeEnabled,nativeBleStreamingEnabled,nativeBleForegroundReady, and removes stalenativeBleStreamConfig.hasNativeBleAudioRoutepredicate: requiresdevice != null,device.id.isNotEmpty, and_nativeBleAudioTarget(device) != null. Rejects empty-id Omi sentinel entries that may linger from stale state.setBatchModenow only re-enables native streaming when turning batch OFF and a concrete device with a native route is connected._saveNativeBleStreamConfig: whenaudioTargetis null (device has no native route), also clearsbackgroundModeEnabledand removes stale config._showBackgroundModeSheetdelegates toCaptureProvider.setBackgroundModeEnabled()instead of writing prefs directly. Switch is disabled when no route is available, with a warning banner explaining why.backgroundModeUnavailablestring to all 49 locale ARB files.Available native BLE routes
Only these device types have a native BLE audio target:
DeviceType.omi)DeviceType.openglass)DeviceType.friendPendant)All others (Apple Watch, Bee, Fieldy, Frame, Limitless, Plaud) return
nullfrom_nativeBleAudioTargetand are correctly blocked.What this does NOT do
Testing
dart format --line-length 120passes on all 3 modified Dart files.flutter testcannot run in this environment (Flutter SDK not installed), but 34 new unit tests have been added covering all specified matrix cases.Refs #7548