fix: QR scanning fails on LineageOS due to camera row stride mismatch#500
Merged
torlando-tech merged 1 commit intomainfrom Feb 21, 2026
Merged
fix: QR scanning fails on LineageOS due to camera row stride mismatch#500torlando-tech merged 1 commit intomainfrom
torlando-tech merged 1 commit intomainfrom
Conversation
Use plane.rowStride instead of imageProxy.width as the dataWidth parameter in PlanarYUVLuminanceSource. On some devices (e.g. Xperia 10 V running LineageOS), the Y plane row stride includes alignment padding bytes beyond the image width. Passing imageProxy.width caused every row after the first to be misaligned, corrupting the image data and preventing ZXing from detecting QR codes. Also add TRY_HARDER decode hint for improved detection reliability, and remove consumeWindowInsets so the bottom instruction card properly respects navigation bar padding on devices with 3-button navigation. Fixes #477 https://claude.ai/code/session_01CkWLdAGiEP6rpP5xnWMayW
Contributor
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Contributor
Greptile SummaryFixes QR code scanning on devices where the camera Y plane row stride differs from the image width (e.g., Xperia 10 V on LineageOS). The core change passes
Confidence Score: 4/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant Camera as CameraX
participant Analyzer as QrCodeAnalyzer
participant ZXing as ZXing MultiFormatReader
participant UI as QrScannerScreen
Camera->>Analyzer: analyze(imageProxy)
Analyzer->>Analyzer: Check scan cooldown
Analyzer->>Analyzer: Get Y plane buffer
Note over Analyzer: data = ByteArray(buffer.remaining())
Analyzer->>Analyzer: Get plane.rowStride
Note over Analyzer: rowStride may include<br/>padding bytes > width
Analyzer->>ZXing: PlanarYUVLuminanceSource(data, rowStride, height, 0, 0, width, height, false)
Note over ZXing: dataWidth = rowStride ensures<br/>correct row byte offsets
ZXing->>ZXing: HybridBinarizer → BinaryBitmap
ZXing->>ZXing: decode(bitmap) with TRY_HARDER
alt QR code found
ZXing-->>Analyzer: Result with text
Analyzer->>UI: onQrCodeDetected(qrText)
else No QR code
ZXing-->>Analyzer: Exception (ignored)
end
Analyzer->>Analyzer: imageProxy.close()
Last reviewed commit: 208ae0f |
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.
Use plane.rowStride instead of imageProxy.width as the dataWidth
parameter in PlanarYUVLuminanceSource. On some devices (e.g. Xperia 10 V
running LineageOS), the Y plane row stride includes alignment padding
bytes beyond the image width. Passing imageProxy.width caused every row
after the first to be misaligned, corrupting the image data and
preventing ZXing from detecting QR codes.
Also add TRY_HARDER decode hint for improved detection reliability, and
remove consumeWindowInsets so the bottom instruction card properly
respects navigation bar padding on devices with 3-button navigation.
Fixes #477
https://claude.ai/code/session_01CkWLdAGiEP6rpP5xnWMayW