Skip to content

fix: don't request Bluetooth permission for USB-connected RNodes#494

Merged
torlando-tech merged 2 commits intomainfrom
fix/rnode-usb-no-bluetooth-permission
Feb 19, 2026
Merged

fix: don't request Bluetooth permission for USB-connected RNodes#494
torlando-tech merged 2 commits intomainfrom
fix/rnode-usb-no-bluetooth-permission

Conversation

@torlando-tech
Copy link
Copy Markdown
Owner

Summary

  • RNode USB interfaces use Android USB Host API, not Bluetooth
  • requiresBluetooth() only excluded connection_mode == "tcp", so USB RNodes incorrectly triggered Bluetooth permission requests on every app start
  • Adds "usb" to the exclusion check alongside "tcp"

Closes #487

Test plan

  • Configure an RNode via USB (no BLE/classic RNode or AndroidBLE interfaces enabled)
  • Cold-start the app — verify no Bluetooth permission prompt appears
  • Toggle the USB RNode interface off/on — verify no Bluetooth permission prompt
  • Enable an AndroidBLE interface — verify Bluetooth permission prompt does appear
  • 2 new unit tests added, all 17 InterfaceDaoTest tests pass

🤖 Generated with Claude Code

torlando-tech and others added 2 commits February 17, 2026 21:52
…-scrollable

fix: make announce filter dialog scrollable on short displays
RNode USB interfaces use Android USB Host API, not Bluetooth.
The requiresBluetooth() check only excluded TCP mode, so USB RNodes
incorrectly triggered Bluetooth permission requests on every app start.

Closes #487

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@sentry
Copy link
Copy Markdown
Contributor

sentry bot commented Feb 18, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Feb 18, 2026

Greptile Summary

Fixed a bug where USB-connected RNodes incorrectly triggered Bluetooth permission requests. The fix adds "usb" to the exclusion check in requiresBluetooth() alongside the existing "tcp" check.

  • Updated InterfaceDao.kt:200 to exclude both "tcp" and "usb" connection modes from requiring Bluetooth
  • Added 2 new unit tests covering USB RNode scenarios (single USB RNode, combined USB+TCP RNodes)
  • Updated documentation comment to clarify that both USB and TCP connections don't need Bluetooth
  • Minor formatting improvements (expression body syntax)

The logic change is correct: USB RNodes use the Android USB Host API, not Bluetooth, so they should not trigger permission requests.

Confidence Score: 5/5

  • Safe to merge - straightforward bug fix with comprehensive test coverage
  • Single-line logic fix addresses the root cause correctly, all existing tests pass, new tests provide complete coverage of USB scenarios, and the change is well-documented
  • No files require special attention

Important Files Changed

Filename Overview
app/src/main/java/com/lxmf/messenger/data/database/dao/InterfaceDao.kt Added "usb" to requiresBluetooth() exclusion check, fixing incorrect Bluetooth permission requests for USB-connected RNodes
app/src/test/java/com/lxmf/messenger/data/database/dao/InterfaceDaoTest.kt Added 2 comprehensive tests for USB RNode behavior, verifying no Bluetooth permission required for USB connections

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    Start[Interface enabled?] -->|Yes| CheckType{Interface Type?}
    Start -->|No| NoPermission[No Bluetooth needed]
    
    CheckType -->|AndroidBLE| NeedBT[Requires Bluetooth]
    CheckType -->|RNode| ParseJSON[Parse connection_mode from JSON]
    CheckType -->|Other| NoPermission
    
    ParseJSON -->|JSON Error| NeedBT
    ParseJSON -->|Success| CheckMode{connection_mode value?}
    
    CheckMode -->|tcp| NoPermission
    CheckMode -->|usb| NoPermission
    CheckMode -->|classic| NeedBT
    CheckMode -->|ble| NeedBT
    CheckMode -->|missing/empty| NeedBT
    
    style NeedBT fill:#ffcccc
    style NoPermission fill:#ccffcc
    style CheckMode stroke:#ff6600,stroke-width:3px
Loading

Last reviewed commit: 99e533b

@torlando-tech torlando-tech merged commit 10a5474 into main Feb 19, 2026
23 of 25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Do not ask for Bluetooth permission when RNode USB interface is added and enabled

1 participant