Pass AutoRotate option to CameraManager to enable SetOutputImageRotationEnabled#269
Draft
Pass AutoRotate option to CameraManager to enable SetOutputImageRotationEnabled#269
Conversation
…bled Co-authored-by: jfversluis <939291+jfversluis@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix options not making it to the CameraManager
Pass AutoRotate option to CameraManager to enable SetOutputImageRotationEnabled
Oct 20, 2025
Collaborator
|
@copilot this focuses only on the 1 option. Should we reconsider how we work with these options altogether? |
Contributor
Author
You're right to question this. Currently, My implementation passes the entire Would you prefer:
What's your preference? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The
AutoRotateoption fromBarcodeReaderOptionswas not being passed to theCameraManager, preventing the Android CameraXSetOutputImageRotationEnabledmethod from being called with the user's desired value. This meant that even when developers setAutoRotate = truein their barcode reader options, the Android camera subsystem was not being configured to automatically rotate images based on device orientation.Solution
This PR updates the codebase to pass
BarcodeReaderOptionsthrough to theCameraManager, enabling proper configuration of the Android ImageAnalysis builder.Changes Made
CameraManagerconstructor to accept an optionalBarcodeReaderOptionsparameter and store it in a protectedOptionspropertyUpdateOptions()method toCameraManagerto support runtime option changes, following the same pattern asUpdateCameraLocation()andUpdateSelectedCamera()CameraManager.android.csto call.SetOutputImageRotationEnabled(Options.AutoRotate)when building the ImageAnalysis objectCameraBarcodeReaderViewHandlerto:CreatePlatformView()UpdateOptions()inMapOptions()to handle runtime option changesImpact
AutoRotateis set totrue, the Android CameraX library will now automatically rotate images according to device orientation before passing them to the barcode readerBarcodeReaderOptions()instance if not providedSetOutputImageRotationEnabledis Android CameraX-specificExample Usage
The BigIslandBarcode sample app already demonstrates this:
Original prompt
Fixes #136
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.