Skip to content

fix(android): center scan frame after enabling and layout changes - #822

Draft
maharshi-coding wants to merge 1 commit into
teslamotors:masterfrom
maharshi-coding:fix/android-scan-frame-layout
Draft

maharshi-coding wants to merge 1 commit into
teslamotors:masterfrom
maharshi-coding:fix/android-scan-frame-layout

Conversation

@maharshi-coding

Copy link
Copy Markdown

Related to #576; complements #812.

Re-enabling showFrame on an already laid-out Android camera creates an overlay whose measured dimensions are still zero. The frame becomes a 53×53-pixel corner fragment. Calculate frameRect from actual layout bounds in onSizeChanged() and use those bounds when changing the custom frame size.

Adds four Robolectric regression tests and runs them with the Android example build. Measured validation and before/after screenshots are included.

Validation performed locally:

  • Installed baseline and patched release APKs on an Android 35 ARM64 emulator with image-file camera input. All six 1:1, 4:3 and 16:9 portrait/landscape layouts reproduced the corner fragment; patched frames retain their initial bounds with zero measured center offset after re-enabling.
  • Release example build and release lint checks pass; 13 legacy-architecture layout tests and four new-architecture Debug tests pass. The committed suite contains four tests; nine additional layout controls were run separately.
  • Exact Map Android barcode bounds into the visible scan frame #812 head d218635: all 24 independent selection-matrix cases and its 17 existing tests pass, while seven layout checks fail. A separate local composition with this layout patch passes all 54 tests. Those coordinate tests use supplied detections and authored sensor matrices.
  • The patched app saved a valid 60,652-byte, 1280×720 JPEG through the capture API.

Local native builds used JDK 17 and an external SDK 36 override because SDK 34 was absent. Baseline TypeScript passes; existing ESLint/Jest commands are blocked by missing eslint-plugin-import/jest.

#710 already changes Android aspect-ratio selection to viewfinder dimensions; #644 changes iOS. Preview grid spacing was unchanged across the six emulator layouts (maximum X/Y difference 0.39%). The original Galaxy A13 stretching/first-load report remains unverified on that hardware. #812 owns barcode coordinate mapping; this PR addresses the separately reproduced visible-frame layout defect, so #576 should remain open.

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