Skip to content

Fix scanning compact PDF417 barcodes#6916

Merged
grzesiek2010 merged 9 commits intogetodk:v2025.3.xfrom
seadowg:fix-wide-pdf417
Oct 7, 2025
Merged

Fix scanning compact PDF417 barcodes#6916
grzesiek2010 merged 9 commits intogetodk:v2025.3.xfrom
seadowg:fix-wide-pdf417

Conversation

@seadowg
Copy link
Member

@seadowg seadowg commented Oct 2, 2025

Work towards #6913

This does not include the prompt to rotate ("Inform the user they can rotate") - that will be a follow-up. I've also removed the confirmation step (the 2-second pause after scanning) as discussed.

Why is this the best possible solution? Were any other approaches considered?

How does this change affect users? Describe intentional changes to behavior and behavior that could have accidentally been affected by code changes. In other words, what are the regression risks?

As discussed in the issue, the main goal here was to allow specific government ID cards using PDF417 barcodes to be scanned - it was not possible to scan these on Pixel 6a devices and this is now possible by rotating to landscape. We don't need to test those barcodes on non-Pixel devices (other devices can have less reliable cameras which makes defining good here hard work).

Other than that, we mainly want to check that the landscape mode works as expected (shows up in landscape orientation only, allows scanning anywhere on the screen) works on different Android OS levels and screen sizes. It's also important to check that QR code has is unaffected by these changes.

Before submitting this PR, please make sure you have:

  • added or modified tests for any new or changed behavior
  • run ./gradlew connectedAndroidTest (or ./gradlew testLab) and confirmed all checks still pass
  • added a comment above any new strings describing it for translators
  • added any new strings with date formatting to DateFormatsTest
  • verified that any code or assets from external sources are properly credited in comments and/or in the about file.
  • verified that any new UI elements use theme colors. UI Components Style guidelines

class ScannerWithFlashlightActivity : LocalizedActivity(), CollectComposeThemeProvider {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
enableEdgeToEdge()
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This allows the full screen to be used for scanning.


override fun shouldConfirm(): Boolean {
return true
return false
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could entirely remove this feature, but I'd like to discuss whether we potentially want to offer an opt-in first.

@seadowg seadowg marked this pull request as ready for review October 2, 2025 13:51
@seadowg seadowg requested a review from grzesiek2010 October 2, 2025 13:51
@seadowg seadowg changed the base branch from master to v2025.3.x October 2, 2025 13:52
@seadowg seadowg added needs testing high priority Should be looked at before other PRs/issues labels Oct 2, 2025
@dbemke
Copy link

dbemke commented Oct 3, 2025

O wow! It really makes a difference when the scanner is in the landscape view. I am even able to scan the drivers license and other barcodes which I wasn't able to scan at all before.

@seadowg seadowg requested a review from grzesiek2010 October 3, 2025 09:52
@dbemke
Copy link

dbemke commented Oct 3, 2025

I think I found a case in which scanning isn't super fast - I used a device which in other version struggled with scanning more complex barcodes and it isn't great at adjusting the focus. It's possible to make scanning more challenging after rotating when there was a different focus level ( I pointed the scanner at the desk). I don't think it's an issue but just wanted to show this might occur. At first I thought that the device struggles with scanning QR codes in the landscape view.
On that device (Redmi 9t Android 10) scanning QR codes and barcodes works well now in general.

XRecorder_03102025_121844.mp4

@seadowg
Copy link
Member Author

seadowg commented Oct 3, 2025

I think I found a case in which scanning isn't super fast - I used a device which in other version struggled with scanning more complex barcodes and it isn't great at adjusting the focus. It's possible to make scanning more challenging after rotating when there was a different focus level ( I pointed the scanner at the desk). I don't think it's an issue but just wanted to show this might occur. At first I thought that the device struggles with scanning QR codes in the landscape view.
On that device (Redmi 9t Android 10) scanning QR codes and barcodes works well now in general.

This seems ok. We're adding a manual button for toggling the full screen mode which I think makes this less problematic, and you're also able to tap to change focus.

@dbemke
Copy link

dbemke commented Oct 3, 2025

There's the "barcode" landscape view in "Reconfigure with QR code" in settings.
reconfLandscape

@dbemke
Copy link

dbemke commented Oct 3, 2025

What should happen if I turn on the flashlight using the button in the portrait view and rotate to the landscape view (no flashlight button)?
If I turn on the flashlight, rotate and scan a QR code. The flashlight is turned off when I'm moved to the question. When I reopen the scanner there's the correct button.
It seems ok but just to double check if maybe the flashlight should turn off on rotation.

@seadowg
Copy link
Member Author

seadowg commented Oct 3, 2025

It seems ok but just to double check if maybe the flashlight should turn off on rotation.

Nope! We could do that, but I think the current behaviour makes sense.

@dbemke
Copy link

dbemke commented Oct 6, 2025

There's the "barcode" landscape view in "Reconfigure with QR code" in settings.

Is this case ok?

@seadowg
Copy link
Member Author

seadowg commented Oct 6, 2025

Is this case ok?

Yeah, I think so! We chose to keep these consistent for the moment so as not to add any extra maintenance burden.

@dbemke
Copy link

dbemke commented Oct 6, 2025

Tested with Success!

Verified Cases:

  • scanning PDF 417 ID cards and poor-quality barcodes on Pixel 7a Android 16, Redmi 9t Android 10, Nexus 5x Android 8.1, Pixel 3a Android 12, Alcatel Android 10, Samsung Galaxy M23, Galaxy M12 Android 11 ,Pixel 6a Android 16 ,Redmi 7 Android 10
  • regression checks on Pixel 6a Android 16 and Redmi 9t Android 10
  • exploratory testing on Pixel 6a and Pixel 7a

@grzesiek2010 grzesiek2010 merged commit a60627d into getodk:v2025.3.x Oct 7, 2025
6 checks passed
@seadowg seadowg deleted the fix-wide-pdf417 branch October 7, 2025 08:02
grzesiek2010 added a commit to grzesiek2010/collect that referenced this pull request Oct 13, 2025
Fix scanning compact PDF417 barcodes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

behavior verified high priority Should be looked at before other PRs/issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants