reset stage when QR scanning is cancelled - #370
Open
munzzyy wants to merge 1 commit into
Open
Conversation
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.
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.
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.