Skip to content

[MS-1239] Fragment correctly restores OCR state after being rotated#1456

Merged
alexandr-simprints merged 2 commits into
release/2025.4.0from
MS-1239-mf-id-ocr-state-is-not-restored-after-rotation
Nov 10, 2025
Merged

[MS-1239] Fragment correctly restores OCR state after being rotated#1456
alexandr-simprints merged 2 commits into
release/2025.4.0from
MS-1239-mf-id-ocr-state-is-not-restored-after-rotation

Conversation

@alexandr-simprints
Copy link
Copy Markdown
Contributor

JIRA ticket
Will be released in: 2025.4.0

Root cause analysis (for bugfixes only)

First known affected version: 2025.4.0

If device is rotated during the OCR scan, the UI is reverted back to the initial screen state. However, frames are still being captured for OCR in background.

This happens because there are two initializeFragment() invocations in the ExternalCredentialScanOcrFragment:

  1. Within the async camera permission launchPermissionRequest
  2. Within the onResume function

Ideally we would like to have the following logic in the fragment:

  1. Check camera permissions
  2. Start camera preview, if granted
  3. Start observing OCR state

Notable changes

  • Renaming stateLiveData to scanOcrStateLiveData to explicitly specify that this object stores the state of the OCR, not the state of the fragment
  • Observers are only initialized when camera is ready
Screen_recording_20251107_134543.mp4

Testing guidance

  • Start OCR
  • Rotate the device
  • Ensure the OCR state remains unchanged

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)

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Nov 7, 2025

@luhmirin-s
Copy link
Copy Markdown
Contributor

Do we have a testiny case for MFID screen rotations?

@alexandr-simprints
Copy link
Copy Markdown
Contributor Author

Do we have a testiny case for MFID screen rotations?

@luhmirin-s yes, there are tests: TC-310

@alexandr-simprints alexandr-simprints merged commit ae1c3ec into release/2025.4.0 Nov 10, 2025
13 checks passed
@alexandr-simprints alexandr-simprints deleted the MS-1239-mf-id-ocr-state-is-not-restored-after-rotation branch November 10, 2025 19:08
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.

3 participants