Skip to content

MS-1312 Reset OCR frame flag on screen rotation#1570

Merged
luhmirin-s merged 1 commit intorelease/2026.1.0from
feature/MS-1312-reset-ocr-on-rotation
Feb 3, 2026
Merged

MS-1312 Reset OCR frame flag on screen rotation#1570
luhmirin-s merged 1 commit intorelease/2026.1.0from
feature/MS-1312-reset-ocr-on-rotation

Conversation

@luhmirin-s
Copy link
Contributor

JIRA ticket
Will be released in: 2026.1.0

Root cause analysis (for bugfixes only)

First known affected version: 2026.1.0 (could be also 2025.4.0, but it is a too low of a priority to check)

  • View model tracks a flag to skip extra frames while the current one is processing.
  • This flag is reset only after the frame is processed until the end.
  • In case of configuration change the frame processing coroutine is cancelled pre-maturely and the flag is not reset correctly, which causes the OCR process to freeze.

Notable changes

  • Reset the flag manually when OCR is being stopped.

Testing guidance

  • Run workflow up to external credentials step and select document OCR.
  • Start document scanning process and, once the progress bar moves, rotate the device to cause the configuration change.
  • Proceed with scanning, it should work until the end.

Additional work checklist

  • Effect on other features and security has been considered
  • Design document marked as "In development" (if applicable)
  • External (Gitbook) and internal (Confluence) Documentation is up to date (or ticket created)
  • Test cases in Testiny are up to date (or ticket created)
  • Other teams notified about the changes (if applicable)

@luhmirin-s
Copy link
Contributor Author

@alexandr-simprints Pinging you especially, since that is your area of expertise :)

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a bug where the OCR process would freeze after a screen rotation. The root cause was that a boolean flag (isRunningOcrOnFrame) used to prevent processing multiple frames simultaneously was not being reset when OCR stopped due to a configuration change, causing the scanner to become permanently blocked.

Changes:

  • Added ocrStopped() method to reset the frame processing flag when OCR is stopped
  • Called the new method in the stopOcr() function to ensure flag is reset during configuration changes
  • Added unit test to verify the flag reset behavior

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
ExternalCredentialScanOcrViewModel.kt Added new ocrStopped() method to reset isRunningOcrOnFrame flag
ExternalCredentialScanOcrFragment.kt Added call to viewModel.ocrStopped() in stopOcr() method; minor refactoring of when expression
ExternalCredentialScanOcrViewModelTest.kt Added unit test to verify ocrStopped() correctly resets the flag

@luhmirin-s luhmirin-s force-pushed the feature/MS-1312-reset-ocr-on-rotation branch from 1577410 to 7fab81d Compare February 3, 2026 14:52
@BurningAXE
Copy link
Contributor

First known affected version: 2026.1.0 (could be also 2025.4.0, but it is a too low of a priority to check)

If we are deploying 2025.4.0 in GG2, it's worth fixing it there, too.

@luhmirin-s
Copy link
Contributor Author

@BurningAXE at this point it would be too much of a hassle with the release pipeline for a rare issue (only when rotating in the specific moment) with a trivial fix (just restart the capture).

@sonarqubecloud
Copy link

sonarqubecloud bot commented Feb 3, 2026

@luhmirin-s luhmirin-s merged commit c0c3a37 into release/2026.1.0 Feb 3, 2026
14 checks passed
@luhmirin-s luhmirin-s deleted the feature/MS-1312-reset-ocr-on-rotation branch February 3, 2026 15:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants