Skip to content

fix(android): bind scan/face without ImageCapture on LIMITED cameras - #809

Open
GladosBlueWallet wants to merge 1 commit into
teslamotors:masterfrom
GladosBlueWallet:fix/android-scan-usecase-bind
Open

fix(android): bind scan/face without ImageCapture on LIMITED cameras#809
GladosBlueWallet wants to merge 1 commit into
teslamotors:masterfrom
GladosBlueWallet:fix/android-scan-usecase-bind

Conversation

@GladosBlueWallet

Copy link
Copy Markdown

Summary

On LIMITED cameras (common with Android emulator webcams), binding Preview + ImageCapture + ImageAnalysis fails with:

All supported output sizes are filtered out according to current resolution selection settings.
maxSize = 640x320
initial size list: [1920x1080, 1280x720, 640x480]

The preview stays black even though the system Camera app works.

When scanBarcode or face detection is on, this PR binds Preview + ImageAnalysis only (capture isn't used in that mode), skips view-derived setTargetAspectRatio on Preview, and targets VGA for analysis.

Photo-capture path is unchanged (Preview + ImageCapture).

Also: don't call bindCameraUseCases() from scan/face props before ProcessCameraProvider is ready.

Test plan

  • Physical device: barcode scan still works
  • Physical device: take picture still works (scanBarcode off)
  • Emulator with webcam: Scan screen shows live preview (not black)
  • Emulator: barcodes still detect via ML Kit
  • Face detection still works if enabled

Made with Cursor

Preview+ImageCapture+ImageAnalysis fails to bind on many LIMITED cameras
(emulator webcams especially), leaving a black preview. When scanning or
detecting faces, bind Preview+ImageAnalysis only, skip view-derived
aspect ratio on Preview, and target VGA for analysis.

Co-authored-by: Cursor <cursoragent@cursor.com>
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