Skip to content

reset stage when QR scanning is cancelled - #370

Closed
munzzyy wants to merge 1 commit into
GrapheneOS:mainfrom
munzzyy:fix/scanner-cancel
Closed

munzzyy wants to merge 1 commit into
GrapheneOS:mainfrom
munzzyy:fix/scanner-cancel

Conversation

@munzzyy

@munzzyy munzzyy commented Sep 9, 2026

Copy link
Copy Markdown

Fixes #323.

Backing out of the QR scanner returns RESULT_CANCELED, which the activity result callback ignored. stage kept the value set when the scan started, so the next configuration change recreated the activity in a stage that hides the buttons but has nothing to show. Only the toolbar survived.

The callback now resets Auditee and EnableRemoteVerify to None when the scanner exits without a result. A denied camera permission request leaves the same stale stage behind, so it gets the same reset. Auditor is untouched on purpose: backing out of the scanner there goes back to the challenge QR, which the restore path already redraws.

Verified on an API 36 x86_64 emulator. Before the change, the five steps from #323 end with a blank screen under the toolbar. After it, the buttons survive rotation after cancelling the scan from the auditee button, from the remote verification button, and after a denied permission request, and the auditor flow still restores its QR code after backing out of the scanner. The emulator is not a supported auditee model, so to press the buttons at all I temporarily added the emulator's model string to isSupportedAuditee in my local build; that line is not in this change. Not tested on a real Pixel, and hardware attestation is not involved in this path.

Backing out of QRScannerActivity returns RESULT_CANCELED, which the
activity result callback ignored, so stage kept the value set when the
scan started. The next configuration change then recreated the activity
in that stage: the restore path hides the buttons for anything other
than None, and Auditee and EnableRemoteVerify have no content to
restore, so only the toolbar was left (issue GrapheneOS#323).

Reset those stages to None when the scanner exits without a result.
A denied camera permission request left the same stale stage behind,
so reset it there too.
xhon-pelushi added a commit to xhon-pelushi/Auditor that referenced this pull request Sep 25, 2026
The camera-permission-denied branch of onRequestPermissionsResult left
stage at Auditee/EnableRemoteVerify, the same stuck state the scanner
RESULT_CANCELED path had: the scan never launches, no content is
generated, and a later configuration change hides the buttons leaving
only the toolbar. Reset stage to None there too.

Credit to GrapheneOS#370 for spotting this second path.
@munzzyy

munzzyy commented Sep 25, 2026

Copy link
Copy Markdown
Author

Closing this one. #362 was open a month earlier and now covers both paths, so this is the duplicate of the two.

@munzzyy munzzyy closed this Sep 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

UI disappears if configuration changes after backing out of camera activity launch

1 participant