Skip to content

fix: drop nfc from scanner pill while polling is off - #2037

Merged
jvsena42 merged 6 commits into
masterfrom
fix/nfc-pill-polling-state
Nov 30, 2026
Merged

jvsena42 merged 6 commits into
masterfrom
fix/nfc-pill-polling-state

Conversation

@jvsena42

@jvsena42 jvsena42 commented Nov 25, 2026 •

Copy link
Copy Markdown
Member

Fixes #2000

The payment scanners' status pill no longer lists NFC while the phone is not polling for NFC: when NFC is switched off while the scanner is open, and on phones that stop NFC polling while a camera is open (Pixel 11 on Android 17).

Description

  • Camera stop. The Pixel's stop comes from AOSP CameraServiceProxy. When the read-only property ro.camera.notify_nfc is above 0, it calls NfcAdapter.setReaderModePollingEnabled(false) when the set of active cameras goes from empty to non-empty, and turns polling back on when it empties. It keys on camera sessions going active or idle, so a capture-session restart sends the stop again. That call sends DISABLE_POLLING_FLAGS = 0x1000, the flags 4096 / tech_mask = 00 seen in the issue. The scanner reads that property with getprop (a successful read is cached; a failed or timed-out read counts as unset and is retried the next time the scanner opens; a value already read is used without waiting for a new read) and watches camera availability (CameraManager.AvailabilityCallback). CameraNfcStopTracker treats polling as stopped while any present camera is unavailable, whatever NFC toggles happened meanwhile. This errs toward hiding NFC: an NFC toggle can drop the system's stop without apps seeing it, and a session restart can bring it back without any availability callback. The camera watcher runs whenever the property is set, independent of NFC, so NFC turned on with a camera already open stays hidden. When the scanner opens, the pill lists NFC until its camera opens. That is accurate: CameraServiceProxy only stops polling once a camera session is active (CAMERA_STATE_ACTIVE), and the availability callback fires when the camera opens, slightly earlier. Camera IDs missing from cameraIdList (a removed camera) are ignored, and the set is reconciled against that list on resume; if cameraIdList cannot be read, the camera counts as present and the reconcile is skipped. While the tracker says polling is off, NearbyScanSources.isNfcStoppedByCamera is true and NFC is dropped from the pill.
  • Adapter off/on. rememberNfcState used to refresh only on resume, and pulling down quick settings does not pause the activity. It now also listens for NfcAdapter.ACTION_ADAPTER_STATE_CHANGED. Because NFC state now follows the adapter, the reader effect is also disabled and enabled again with it. The receiver is exported because the NFC service, not the system server, sends that protected broadcast. rememberNfcState is shared, so Receive's NFC emitter (rememberCanEmitNfc) now also stops and starts with the adapter instead of waiting for a resume.
  • Pill. The pill falls back to the existing strings: "Scanning QR & Bluetooth" or "Scanning QR". Bluetooth status is unchanged. When the adapter is off, the existing Enable NFC button still appears. No new strings or icons.
  • Debug-only seam. NfcDevOverride lives in the debug source set, with a no-op copy in release. It is set over adb through a new DevToolsProvider method overrideNfc, so an emulator, which has no NFC, can show the pill states. It runs outside the LDK queue so it does not wait behind node work.

What is and is not detectable

  • No public API reports whether polling is on. I checked NfcAdapter on API 34, 35, 36 and 37.0 (android.jar diff and api-versions.xml). Reader mode gets no callback or exception when polling stops.
  • Calling enableReaderMode again does not bring polling back. In NfcService.setReaderMode (packages/modules/Nfc, main), an app's request is dropped while a polling-disable request is registered: it logs setReaderMode: active polling is forced to disable now and returns. So this PR reports the stop instead of fighting it.
  • Apps can read the property. ro.camera.notify_nfc has the SELinux context camera_config_prop. system/sepolicy grants get_prop(coredomain, camera_config_prop), and untrusted_app is in coredomain.
  • Limits:
    • The signal is the property plus "a camera is open". It does not observe polling itself.
    • A vendor that stops polling by some other route would not be detected.
    • "Camera unavailable" (from AvailabilityCallback) is broader than CameraServiceProxy's "camera active": it re-enables polling when a camera goes idle. An idle camera held open by another app therefore hides NFC from the pill although polling runs. The scanner's own camera is active while it shows a preview.
    • NFC turned off and on while a camera stays open: the pill keeps NFC out until the camera closes. NfcService.disableInternal clears the polling-disable list, so in that window a tap may still read until the camera session restarts and the stop is sent again; apps cannot see which state applies.
    • Hidden system cameras: a privileged client such as face unlock on a camera hidden from apps stops polling, but apps get no availability callback for it, so the pill still lists NFC then.
    • A camera opened but never streaming counts as unavailable for the pill, while CameraServiceProxy only stops polling for active sessions.
    • getprop is read with a 2 s timeout; on a timeout or failure the property counts as unset for that scanner visit and is read again on the next one.
    • Not checked on the Pixel: the Pixel was unavailable for this change.

Out of Scope

  • ui/screens/scanner: a way to read NFC on affected phones without leaving the scanner (camera-unbinding control or NFC-only state). The issue's decision was to only make the pill truthful.
  • After the camera closes, CameraServiceProxy's re-enable call clears the app's reader mode params (mReaderModeParams = null). Reader mode then stays off until the scanner resumes. This is unchanged here.

Design

N/A — no design available. The pill reuses the existing status strings.

Preview

Emulator, debug build at 424f74a. Left to right: open (reading) → camera stop → stop ended → adapter off → adapter on → camera stop again.

Scanner pill states

nfc-pill.mp4

QA Notes

Setup

  • Build: just build (devDebug) from this branch, adb install -r over an existing to.bitkit.dev wallet.
  • Pixel 11 (Android 17) or another phone where adb shell getprop ro.camera.notify_nfc prints 1. Xiaomi 22031116BG (Android 13) or another phone where it prints nothing.
  • An NFC tag or a second phone on Receive holding a payment request.
  • Emulator only: rooted image (google_apis). Run adb root && adb shell setprop ro.camera.notify_nfc 1 && adb unroot, then grant camera permission and open the scanner. Fake the adapter state with adb shell content call --uri content://to.bitkit.dev.devtools --method overrideNfc --arg "'{\"adapterState\":\"ON\"}'". "OFF" fakes the adapter off, "cameraStopsPolling":false ends the camera stop, and '{}' clears the overrides.

Journeys

N/A — not drivable; see Manual Tests.

Manual Tests

  • 1. Pixel 11: open the main scanner and the Send recipient scanner with camera permission granted → the pill does not list NFC. Bitkit's log shows Read camera stops NFC polling 'true' and Detected NFC polling stopped by an open camera — needs NFC hardware.
  • 2. Pixel 11: deny camera permission and open the scanner → no pill is shown (only "Scan to pay" and the camera button), and a tap reads the request — needs NFC hardware. (Wording corrected after the phone run; the expected read is unchanged.)
  • 3. Xiaomi: open the scanner with the camera on → the pill lists NFC, and a tag or phone tap reads the request — needs NFC hardware.
  • 4. Both phones: with the scanner open and the camera on, turn NFC off from quick settings → NFC leaves the pill and Enable NFC appears. Turn it on → on the Xiaomi NFC returns to the pill and a tap reads; on the Pixel NFC stays out of the pill until the camera closes (a tap may still read in that window, see Limits) — needs NFC hardware. (Expectation changed at 25f8123 and back to this wording at e09b53c; no results were recorded against either wording.)
  • 5. Both phones: Bluetooth part of the pill stays as before through cases 1–4 — needs NFC hardware.
  • 6. Both phones: open Receive with an invoice, turn NFC off from quick settings, then on again without leaving Receive → a tap from the other phone's scanner reads the request — needs NFC hardware.

Automated Checks

  • added NfcPollingTest.kt — ro.camera.notify_nfc parsed as CameraServiceProxy does ("1" stops polling; empty, 0 and true do not); CameraNfcStopTracker stops while any present camera is unavailable, handles a camera reported unavailable twice and an available event for an unseen camera, ignores or drops cameras missing from the camera list, keeps the stop across an NFC off/on toggle with a camera open, and counts a camera as present when the camera list cannot be read
  • updated NearbyScanSourcesTest.kt — NFC drops from the status during a camera stop or with the adapter off, Bluetooth stays, NFC returns when the stop ends

Evidence

  • Emulator Gate_Root_API35 (API 35, google_apis, rooted, -read-only), devDebug at 424f74a, with ro.camera.notify_nfc=1 set by setprop:
    • Real read path: the app logged Read camera stops NFC polling 'true' from its own process.
    • The camera stop came from the real availability callback with the scanner's camera open; the app logged Detected NFC polling stopped by an open camera.
    • The adapter state was faked with overrideNfc.
    • Pill text read with android layout:
      • open with no camera stop: SCANNING QR, NFC & BLUETOOTH
      • camera stop: SCANNING QR & BLUETOOTH
      • stop ended: SCANNING QR, NFC & BLUETOOTH
      • adapter off: SCANNING QR & BLUETOOTH plus the Enable NFC button
      • adapter on: SCANNING QR, NFC & BLUETOOTH
      • camera stop again: SCANNING QR & BLUETOOTH
    • Screenshots and recording above.
  • Xiaomi (before the change, from the shell and from run-as to.bitkit.dev): getprop ro.camera.notify_nfc is empty, so the camera-stop path stays off there.
  • Local checks at ed8f13c:
    • testDevDebugUnitTest: 6652 tests, 0 failures.
    • detekt and lintDevDebug: pass.
    • assembleDevDebug and compileDevReleaseKotlin: pass.
  • Checks at 424f74a (DevToolsProvider-only change): assembleDevDebug and detekt pass.
  • Checks at 25f8123 (review fixes: camera-stop tracker, camera list reconcile, getprop timeout):
    • testDevDebugUnitTest: 6658 tests, 0 failures.
    • compileDevReleaseKotlin, detekt and lintDevDebug: pass.
    • With onNfcOff and the camera-list checks reverted, 3 of the 6 CameraNfcStopTracker tests fail.
    • No device or emulator run at this revision; the pill states above were recorded at 424f74a.
  • Checks at e09b53c (second review: camera stop kept across NFC toggles, getprop caches only a successful read):
    • testDevDebugUnitTest: 6658 tests, 0 failures.
    • compileDevReleaseKotlin, detekt and lintDevDebug: pass.
    • With the tracker swapped for an open-camera counter without the camera-list checks, 4 of the 6 CameraNfcStopTracker tests fail.
    • No device or emulator run at this revision.
  • Checks at ca7133c (third review: camera watcher independent of NFC, cached property used without a new read, unreadable camera list counts as present):
    • testDevDebugUnitTest: 6661 tests, 0 failures (9 in CameraNfcStopTracker).
    • compileDevReleaseKotlin, detekt and lintDevDebug: pass.
    • Mutation run: in CameraNfcStopTracker, clearing the camera set on NFC off and treating an unreadable camera list as empty makes the two new tests for those cases fail. This checks the tracker, not the fix itself: the fix is the effect key in NfcEffects.kt (rememberCameraNfcStopTracker(enabled = cameraStopsPolling), which no longer includes the NFC state). Putting the NFC state back into that key would clear the tracker on NFC off, and no unit test would catch it. Manual test 4 covers it on the Pixel.
    • Emulator re-check at ca7133c (Gate_Root_API35, API 35 google_apis, read-only, ro.camera.notify_nfc=1 set by setprop, NFC adapter faked with overrideNfc, Bluetooth on):
      • Scanner open, camera on: SCANNING QR & BLUETOOTH. The log shows Read camera stops NFC polling 'true' and Detected NFC polling stopped by an open camera.
      • NFC off with the camera open: SCANNING QR & BLUETOOTH plus Enable NFC. NFC back on with the camera open: still SCANNING QR & BLUETOOTH, no Enable NFC.
      • Scanner reopened: the pill reads SCANNING QR, NFC & BLUETOOTH for about 0.9 s over the black area before the preview appears, then SCANNING QR & BLUETOOTH. The polling stop only starts once the camera session is active, so this is expected.
      • Control (cameraStopsPolling:false): SCANNING QR, NFC & BLUETOOTH.
      • Camera permission denied: no pill (the permission view shows instead), and no stop logged.
      • & BLUETOOTH stays in every pill. With Bluetooth off, the pill reads SCANNING QR and NFC stays hidden with the camera open.
      • Run by another agent from a runbook; the emulator's system_server restarted once mid-run and case 2 was redone afterwards.

Camera on: NFC absent

NFC off and on with the camera open: NFC stays absent

Reopen: pill frames every 0.1 s, NFC listed until the preview starts

3-reopen.mp4
  • Phone run at ca7133c (2026-11-26, devDebug installed with adb install -r on both phones; Pixel 11 Android 17 with ro.camera.notify_nfc=1, Xiaomi 22031116BG Android 13 with it empty; tag holds a 12 000 sat lightning: invoice; no payment confirmed, balances unchanged):
Case Phone Result Pill / behaviour
1 main + Send scanner Pixel pass SCANNING QR & BLUETOOTH in every sample, NFC never listed; tag held 5 s on Send: no read. Detected NFC polling stopped by an open camera once per open
2 camera denied Pixel pass no pill (permission view); a tap of the Xiaomi's Receive read the request on the second hold; no Detected line
3 main + Send scanner Xiaomi pass ESCANEANDO QR, NFC E BLUETOOTH with the camera open; tag read from both scanners (Confirm 12 000)
4 NFC off/on, camera open Pixel pass off: pill unchanged, Enable NFC shown; on: pill unchanged (NFC not re-listed), Enable NFC gone; tap in that window: no read
4 NFC off/on, camera open Xiaomi pass off: ESCANEANDO QR E BLUETOOTH + Enable NFC (2.9 s); on: NFC back (3.0 s); tag read afterwards
5 Bluetooth part both pass Bluetooth part present in every state; with Bluetooth off it drops and Enable Bluetooth shows
6a Receive, Pixel emits both pass Xiaomi read the Pixel's Receive before and after NFC off/on on the Pixel
6b Receive, Xiaomi emits both pass Pixel read the Xiaomi's Receive after NFC off/on on the Xiaomi

No NFC or camera warnings or errors, no crashes. Outside the scanner, the Xiaomi showed the system app chooser twice for an NFC tap on its home screen; that is system dispatch, not this change.

Pixel: NFC turned back on with the camera open, NFC stays out of the pill

Xiaomi: pill lists NFC with the camera open

Xiaomi: tag read from the scanner

c1-px.mp4

Gaps

  • Pill state at scanner open on the phones: the emulator showed NFC listed for about 0.9 s until the camera session starts. The phone run sampled the pill 3–6 s after open, so that window was not measured on the Pixel (c1-px.mp4 in the run folder was not examined frame by frame).
  • Case 2 needed a second, slower hold on the Pixel before the read; the first 90 s hold read nothing. The read came with the camera denied, so this is tap positioning, not the change.

Models used

  • Planning/scoping: claude-opus-5-5 (reasoning: Not exposed)
  • Implementation: claude-opus-5-5 (reasoning: Not exposed)
  • Review: claude-opus-5-5 (reasoning: Unknown)
  • Review rounds: 4

Metadata note: the session reports the model ID; it does not expose a reasoning-effort setting. The review model was reported by the coordinating session; its effort was not.

🤖 Generated with Claude Code

jvsena42 and others added 2 commits November 25, 2026 11:20
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jvsena42 jvsena42 self-assigned this Nov 25, 2026
@github-actions

github-actions Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Regtest APK

Built from e9bad3c (run).

Download bitkit-dev-debug universal APK (expires in 30 days).

jvsena42 and others added 3 commits November 25, 2026 13:08
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jvsena42
jvsena42 marked this pull request as ready for review November 26, 2026 12:18
@jvsena42
jvsena42 requested review from a team, ovitrif and piotr-iohk and removed request for a team November 26, 2026 12:19
@greptile-apps

greptile-apps Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5 · The PR appears safe to merge; no blocking issues remain.RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no blocking issues remain.

Summary

The scanner hides NFC from its status pill when the adapter is off or a camera is expected to stop polling.

  • Payment scanner pills leave out NFC when a camera stops polling.
  • Scanner and Receive screens react as soon as NFC changes state.
  • Debug builds can simulate NFC states through an ADB command.

Reviews (2) · Last reviewed commit: "fix: do not cache nfc property read when..." · Reviewed by Greptile

@talosmachina talosmachina left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No findings. Drops NFC from the scanner pill while a camera stop (ro.camera.notify_nfc) or the adapter being off means the phone is not polling, and makes rememberNfcState follow ACTION_ADAPTER_STATE_CHANGED instead of only resume. Reviewed ca7133c, full tier, statically: per this repo's track rules the branch was not built here, so this rests on the code and CI.

What I checked, and 5 candidates I ruled out

Read in full: NfcPolling.kt, NfcEffects.kt (all of rememberNfcState, rememberNfcStoppedByCamera, rememberCameraNfcStopTracker, NfcReaderEffect), NearbyScanSources.kt, both NfcDevOverride.kt copies, the DevToolsProvider.kt change
Call sites traced: rememberNfcState (scanner sources and rememberCanEmitNfc through offerPaymentNearby), isNfcActive into scannerStatusText
CI: build-and-test, build, lint, detekt, compose-ui green at this head; e2e shards still running

Ruled out

  • Exported receiver can be spoofed: ACTION_ADAPTER_STATE_CHANGED is a protected broadcast, and onReceive only re-reads context.nfcState(), so even a forged intent changes nothing.
  • Camera already open when the tracker registers is missed: registerAvailabilityCallback reports the current state of every camera on registration, so the scanner's own open camera lands in the set.
  • Release build referencing NfcDevOverride.set: only the debug DevToolsProvider calls it, and the release copy exposes the two flows the main source set reads.
  • Tracker state surviving a disable: onDispose clears it whenever enabled flips, and the key no longer carries the NFC state, so an NFC off/on keeps the stop as the body intends.
  • getprop on the main thread: it runs in produceState under Dispatchers.IO, with the cached value used for the first frame.

Merge confidence: 4/5, the tracker is unit tested but the effect key that keeps the stop across an NFC toggle has no test (the body says so), and the branch was not built here.

Reviewer model: claude-opus-5-5
Reasoning effort: Unknown (the session does not report it)

@piotr-iohk piotr-iohk left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

QA review

Scope: full PR diff against its merge base, at ca7133c86.

No new actionable code findings.

No new actionable code findings were identified in this pass across the ro.camera.notify_nfc property reader and CameraNfcStopTracker, the Compose NFC state/camera-availability effects (NfcEffects.kt) and their scanner/Receive callers (NearbyScanSources.kt, QrScanningScreen.kt, SendRecipientScreen.kt, UsdtSendContent.kt, NearbyEffects.kt), the debug-only DevToolsProvider/NfcDevOverride seam and its release no-op counterpart, or the unit tests and changelog fragment.

Existing external review concern: Greptile's unresolved review thread on NfcPolling.kt:54 remains open at ca7133c86. Verified against pinned source: readSystemProperty waits for getprop exit and merges stderr into stdout, but does not verify process.exitValue() == 0; if getprop terminates with a non-zero exit status, the read is treated as successful, parsed as false, and cached for the process lifetime instead of taking the documented retry path.

Validation and limitations: Local Gradle execution could not run in this environment because the Android SDK (ANDROID_HOME) is not installed. At ca7133c86, CI passed build-and-test, compose-ui / ui-tests, lint, and detekt, while the e2e-tests-local shards (run 45818511444) were still in progress. Unit tests cover cameraStopsNfcPolling, CameraNfcStopTracker, and NearbyScanSources/scannerStatusText, while the Compose effect wiring in NfcEffects.kt (ACTION_ADAPTER_STATE_CHANGED receiver and keying rememberCameraNfcStopTracker solely on cameraStopsPolling) is not covered by automated unit tests and relies on device/emulator verification.

iOS comparison: Compared against synonymdev/bitkit-ios Bitkit/Components/Scanner.swift at edce3cdee. iOS starts CoreNFC reads explicitly via the system reader sheet rather than passively polling alongside the camera and has no user NFC adapter toggle or ro.camera.notify_nfc camera-stop behavior, so this change is Android-specific while keeping the shared four-state scanner status pill vocabulary.

Recommended before device testing

  • Address or resolve Greptile's open thread on NfcPolling.kt:54 (check process.exitValue() == 0 so non-zero getprop exits retry rather than caching false).
  • Wait for the in-progress e2e-tests-local CI run (run 45818511444) to complete.
  • Emulator setup note: DevToolsProvider's overrideNfc overwrites both fields on each call (null clears), so ending the camera stop on an emulator without NFC hardware requires passing {"adapterState":"ON","cameraStopsPolling":false} rather than {"cameraStopsPolling":false} alone.

Suggested additional test cases

  • Android (Pixel 11 / ro.camera.notify_nfc=1, camera permission granted, NFC and Bluetooth on): open Send -> USDT to display the embedded UsdtScanner (UsdtSendContent.kt, which passes readsNearby = true) and verify its status pill omits NFC (Scanning QR & Bluetooth) while keeping Bluetooth.

Device testing: not performed in this review. The author reports emulator and physical Pixel 11 / Xiaomi verification at ca7133c86 in the PR description.

Reviewer model: gemini-4-neon
Reasoning effort: high

@jvsena42
jvsena42 enabled auto-merge November 26, 2026 13:15

@ovi-reviewer ovi-reviewer Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: ⚠️ Not verified — the additional USDT scanner device case remains unrun.

Findings: None new. The existing failed-property-read retry thread remains open.

QA for ca7133c:

Build the dev app and release Kotlin sources ✅ Both build targets completed.

Ran assembleDevDebug and compileDevReleaseKotlin at the reviewed head.

NFC polling tracker and scanner status tests ✅ The focused tests passed.

Ran testDevDebugUnitTest filtered to NfcPollingTest, CameraNfcStopTrackerTest and NearbyScanSourcesTest; checked the generated XML reports for execution, failures and skips.

Check: shared scanner and Receive state wiring ✅ Verified in source, including the embedded USDT scanner.

Traced the main and Send scanners, UsdtSendContent, adapter-driven reader/emitter effects and the camera tracker lifetime. git diff --check passed.

USDT scanner reflects the camera polling stop ⏭️ The emulator setup could not reach the scanner.

Tried fresh Android 15/API 35 and Android 9/API 28 emulators. The first did not finish startup. The fallback produced System UI/Google service failures before Bitkit launched; after installation succeeded, Bitkit remained on its splash screen and showed a startup ANR. Android CLI could not retrieve the app UI; the fallback dump confirmed the startup ANR dialog. The case was not driven, and these observations do not establish a PR defect.

Physical NFC, adapter-toggle, Bluetooth and Receive cases 1–6, including 6a/6b, were not repeated; relied on the same-head phone and emulator report. No scanner or Receive flow was independently driven in this session. The additional USDT case came from the QA review.

Coverage: the full ten-file PR diff, 747926f…ca7133c, and its scanner/Receive callers. Receiver and Compose effect wiring was checked in source; device behavior relies on the linked reports.

Twin: none. Compared NfcReader.swift in synonymdev/bitkit-ios#1302; it uses explicit CoreNFC read sessions.

Gemini's run records expose its model ID but no reasoning-effort setting.


Reviewed by gpt-6.1-sol-high

@jvsena42
jvsena42 marked this pull request as draft November 26, 2026 16:08
auto-merge was automatically disabled November 26, 2026 16:08

Pull request was converted to draft

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jvsena42
jvsena42 marked this pull request as ready for review November 26, 2026 17:18
@jvsena42
jvsena42 enabled auto-merge November 26, 2026 17:18
@jvsena42
jvsena42 requested a review from piotr-iohk November 26, 2026 17:18

@ovi-reviewer ovi-reviewer Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: ⚠️ Not verified — draft PR; review and testing skipped.

Findings: No completed review. The draft rule in AGENTS.md at the base requires AI reviewers to skip drafts and wait until ready for review.

QA for e9bad3c:

Build the dev app at the reviewed head ⏭️ Not started while the PR is a draft.

No build was run.

Reject failed property reads and preserve successful reads ⏭️ Not started while the PR is a draft.

The two new command exit-status tests were not run.

USDT scanner reflects the camera polling stop ⏭️ Not started while the PR is a draft.

The additional case from the QA review remains unrun; no device case was driven.

The prior review at ca7133c and phone report for manual cases 1–6 were read. They are historical evidence, not verification of this head.

Coverage: preliminary inspection of the two-file delta ca7133c…e9bad3c and its property-read caller only; the review stopped after confirming draft status. The existing failed-read thread was not resolved.

Twin: none; this delta changes Android's getprop handling only.


Reviewed by gpt-6.1-sol-high

@piotr-iohk piotr-iohk left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

QA review

Scope: changes since ca7133c86, including affected code paths and prior findings, at e9bad3caa. Baseline: prior QA review (unchanged Compose NFC/camera effects, scanner status pill wiring, and debug override seam inherited).

No new actionable code findings.

No new actionable code findings in the follow-up.

Prior concern verified fixed: Greptile's review thread on NfcPolling.kt:54 is marked resolved and verified fixed in source at e9bad3caa. readCommandOutput (app/src/main/java/to/bitkit/nfc/NfcPolling.kt) now enforces process.exitValue() == 0 after the timeout check, so non-zero getprop exits throw IllegalStateException into deviceCameraStopsNfcPolling()'s runCatching, log a warning, return false without updating cachedCameraStopsNfcPolling, and retry on the next scanner visit. Normal exit-0 reads (including unset properties) continue to cache as before, and NfcPollingTest.kt adds unit tests covering both non-zero and zero exit codes.

Validation and limitations: Local :app:detekt passed at e9bad3caa; local Gradle unit test execution could not run because the Android SDK is not installed in this environment. At e9bad3caa, CI passed build-and-test (including testDevDebugUnitTest), compose-ui / ui-tests, lint, and detekt, while two e2e-tests-local shards (send and onchain_boost_receive_widgets) were still in progress. NfcPollingTest.kt exercises readCommandOutput directly via sh; deviceCameraStopsNfcPolling()'s retry-after-failure caching path itself is verified by source inspection.

iOS comparison: This follow-up changes Android getprop process exit handling only, which has no iOS equivalent (checked synonymdev/bitkit-ios master at 3623e527d, where NFC uses explicit CoreNFC reader sessions).

Recommended before device testing

Suggested additional test cases

  • Android (Pixel 11 / ro.camera.notify_nfc=1, camera permission granted, NFC and Bluetooth on): open Send -> USDT to display the embedded UsdtScanner (UsdtSendContent.kt, which passes readsNearby = true) and verify its status pill omits NFC (Scanning QR & Bluetooth) while keeping Bluetooth. (Remains unrun after emulator startup issues in prior bot QA run at ca7133c.)

Device testing: not performed in this review. The author's emulator and physical Pixel 11 / Xiaomi manual test results in the PR description were recorded at ca7133c86; the intervening delta at e9bad3caa only rejects non-zero getprop exit codes and does not change normal exit-0 scanner or Receive behavior, though no device run has been recorded on e9bad3caa.

Reviewer model: gemini-4-neon
Reasoning effort: high

@piotr-iohk piotr-iohk left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Device QA on e9bad3ca.

  • PASS · Android emulator control. Opened the embedded Send USDT scanner from the USDT wallet on Android 13. The camera was active and Bluetooth access was enabled. With the PR’s debug adapter set to ON, the pill changed from Scanning QR, NFC & Bluetooth to Scanning QR & Bluetooth when the simulated camera polling stop was enabled. Clearing the stop restored NFC to the pill.
  • BLOCKED · Pixel 11 hardware check. The available emulator has no NFC hardware. No physical Pixel 11 was connected to exercise the real camera-triggered polling stop.

The scanner indicator behavior passed under the debug override. The physical check remains open.

@piotr-iohk piotr-iohk left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PASS · Physical camera-stop follow-up at e9bad3ca. Tested on a Samsung Galaxy S22 (SM-S901B, Android 16), where ro.camera.notify_nfc=1.

  • Opened the embedded Send USDT scanner with NFC and Bluetooth enabled. The active camera was visible in Android’s service dump, and the scanner showed Scanning QR & Bluetooth.
  • The app logged the native camera-stop property as true. Samsung’s NFC service independently logged active polling is forced to disable now. The main scanner showed the same pill when opened.
  • The hardware run used the regtest APK with the exact PR source and the native Samsung camera/NFC behavior. It used no debug override or NFC tag exchange.

This covers the camera-stop case that was open after the emulator check. All required checks passed.

@jvsena42
jvsena42 merged commit f15b7ca into master Nov 30, 2026
40 checks passed
@jvsena42
jvsena42 deleted the fix/nfc-pill-polling-state branch November 30, 2026 08:08
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.

Scanner: NFC reading on phones that stop polling while the camera is open

3 participants