Skip to content

Map Android barcode bounds into the visible scan frame - #812

Open
zack-dev-cm wants to merge 1 commit into
teslamotors:masterfrom
zack-dev-cm:fix/barcode-preview-coordinates
Open

zack-dev-cm wants to merge 1 commit into
teslamotors:masterfrom
zack-dev-cm:fix/barcode-preview-coordinates

Conversation

@zack-dev-cm

@zack-dev-cm zack-dev-cm commented Sep 14, 2026 •

Copy link
Copy Markdown

Summary

Related to #484. Android scan-frame selection assumes a 90° image rotation and scales the axes independently. With a 1280×720 zero-rotation fixture, the original compiled CKCamera callback emits OUTSIDE and rejects INSIDE.

Carry an immutable image-geometry snapshot from the analyzer and map ML Kit's rotation-adjusted boxes through sensor coordinates into the actual preview/scan-frame coordinates. Account for view offsets and matrices, use full RectF containment, and discard selections when the preview transform is unavailable or stale. CameraX 1.4.2 supplies the sensor matrices; ImageCapture construction and binding are unchanged.

Preserve public constructors, the raw-size callback, format filtering, no-frame behavior, event shape and throttling. Scanner ownership is addressed in #813, executor reattachment in #817, and CI toolchain drift in #816.

How did you test this change?

Independent head d218635, based on a2a81ce:

  • The original compiled callback reproduces the wrong selection; the no-frame control passes.
  • Both React Native architectures pass 17 Kotlin/Robolectric tests, TypeScript and ESLint. Controls cover crop, mirroring, view offsets, subpixel edges, stale transforms and camera generations.
  • An installed npm archive builds the release app and test APKs after native-source verification. Real ML Kit decodes synthetic YUV images at 0°, 90°, 180° and 270°; the native event path emits only INSIDE. Sensor/preview metadata is synthetic.
  • The unchanged Android example emits INSIDE through its JavaScript callback on an Android 35 emulator with image-file camera input. The installed iOS example completes three mount/return cycles on an iOS 26.2 simulator.
  • The earlier #812/#813 integration passes 38 combined Robolectric tests and both installed ML Kit test classes in both architectures.

The four-PR merge guide identifies the overlapping files and the exact resolution at 7ffe27b. Its public validation passes 41 Robolectric tests with zero skips, TypeScript, ESLint and installed Debug AAR builds in both architectures; per-suite summaries and artifacts are available.

Upstream workflows await approval. Device-specific reproduction of #484 and physical-camera validation are not established. The simulator checks exercise navigation. The baseline default-Xcode build failure is addressed separately in #816.

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.

1 participant