Skip to content

fix(nfc): suppress physical tag NDEF dispatch while HCE sharing is active#2

Merged
duhow merged 5 commits into
mainfrom
copilot/when-sharing-do-not-write-to-tags
Jul 5, 2026
Merged

fix(nfc): suppress physical tag NDEF dispatch while HCE sharing is active#2
duhow merged 5 commits into
mainfrom
copilot/when-sharing-do-not-write-to-tags

Conversation

Copilot AI commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

enableReaderMode was called with only FLAG_READER_NO_PLATFORM_SOUNDS and no technology flags. Without at least one FLAG_READER_NFC_* flag, the NFC stack never enters reader mode for any technology — tag discoveries still flow through normal OS NDEF dispatch, causing URLs on physical Mifare/NDEF tags to open while sharing is active.

Fix

Add all four technology flags plus FLAG_READER_SKIP_NDEF_CHECK to the enableReaderMode call:

adapter?.enableReaderMode(
    activity,
    { /* physical tag discovered during sharing – intentionally ignored */ },
    NfcAdapter.FLAG_READER_NFC_A or
    NfcAdapter.FLAG_READER_NFC_B or
    NfcAdapter.FLAG_READER_NFC_F or
    NfcAdapter.FLAG_READER_NFC_V or
    NfcAdapter.FLAG_READER_SKIP_NDEF_CHECK or
    NfcAdapter.FLAG_READER_NO_PLATFORM_SOUNDS,
    null,
)

With all tech flags set, any physical tag (Mifare, NTAG2xx, ISO-DEP, FeliCa, ISO 15693) discovered during sharing is routed to the no-op callback — NDEF_DISCOVERED/TAG_DISCOVERED intents are never dispatched. FLAG_READER_SKIP_NDEF_CHECK avoids the unnecessary NDEF compatibility check on tags we discard anyway. HCE card emulation is unaffected; it runs on an independent path in the NFC controller.

Copilot AI changed the title feat(nfc): replace tag writing with HCE Type 4 Tag emulation fix(nfc): suppress physical tag polling during HCE emulation Jul 5, 2026
Copilot finished work on behalf of duhow July 5, 2026 10:33
Copilot AI changed the title fix(nfc): suppress physical tag polling during HCE emulation fix(nfc): suppress physical tag NDEF dispatch while HCE sharing is active Jul 5, 2026
Copilot finished work on behalf of duhow July 5, 2026 10:44
@github-actions

github-actions Bot commented Jul 5, 2026

Copy link
Copy Markdown

✅ Debug APK artifact is ready for commit ba3f9cc .
💾 Download APK artifact here.
Workflow run: https://github.com/duhow/openbeam/actions/runs/28738123510

@duhow duhow marked this pull request as ready for review July 5, 2026 10:46
@duhow duhow merged commit fd8270a into main Jul 5, 2026
1 check passed
@duhow duhow deleted the copilot/when-sharing-do-not-write-to-tags branch July 5, 2026 10:46
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.

2 participants