Keep the Bluetooth adapter pairable only while the panel is open - #8144
Chessing234 wants to merge 2 commits into
Conversation
bt-agent's NoInputNoOutput comment is only safe if Pairable follows the panel, but the panel never wrote adapter.pairable. BlueZ defaults PairableTimeout=0, so the adapter stayed pairable after close and nearby devices could Just Works pair. Write pairable on the same open/close/destruction paths as discovery, and leave it alone when a sibling panel is still open on another monitor.
There was a problem hiding this comment.
Pull request overview
Restricts Bluetooth pairability to periods when a powered adapter’s panel is open.
Changes:
- Synchronizes pairability with panel, power, and destruction events.
- Handles multi-monitor sibling panels.
- Adds lifecycle assertions and model tests.
Tip
If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
shell/plugins/panels/bluetooth/Panel.qml |
Manages adapter pairability throughout panel lifecycle. |
shell/plugins/panels/bluetooth/Model.js |
Computes the desired pairable state. |
test/shell.d/bluetooth-test.sh |
Tests pairability decisions and lifecycle wiring. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| setPairable(Model.wantedPairable(opened, enabled, siblingOpen)) | ||
| } | ||
|
|
||
| onAdapterChanged: applyPairable() |
There was a problem hiding this comment.
good catch — a new bar instance with bar still null couldn't see the open sibling and wrote pairable false. we skip that write until bar is injected, then ask the open sibling to reassert.
|
@dhh @ryanrhughes ready for review |
|
folded into #12114 with the bluetooth alias/status work. |
The Bluetooth panel never wrote
adapter.pairable. BlueZ defaultsPairableTimeout=0, so the adapter stayed pairable forever after a visit to the panel.bt-agent.servicealready documents NoInputNoOutput as safe only while the panel is open and scanning.The panel now sets pairable true while it is open and the adapter is powered, and false when the last panel closes, is destroyed, or Bluetooth is turned off. Multi-monitor popout handoff matches discovery:
openSibling()leaves pairable alone so a panel still open on another monitor can keep pairing.Node assertions in
bluetooth-test.shcover open / close / sibling / power-off / destruction. No live BlueZ adapter here.Fixes #7889