Skip to content

fix: reset stage when scanner is cancelled - #362

Open
xhon-pelushi wants to merge 2 commits into
GrapheneOS:mainfrom
xhon-pelushi:fix/323-stage-reset-on-scanner-cancel
Open

xhon-pelushi wants to merge 2 commits into
GrapheneOS:mainfrom
xhon-pelushi:fix/323-stage-reset-on-scanner-cancel

Conversation

@xhon-pelushi

Copy link
Copy Markdown

Reset attestation UI stage when the user backs out of the camera scanner without RESULT_OK.

Fixes #323

Test plan

  • Review diff against issue
  • Run project lint/tests if applicable

Stage.Auditee and Stage.EnableRemoteVerify only reset to Stage.None
inside the RESULT_OK branch of the scanner's ActivityResultLauncher
callback. Backing out of the camera activity (RESULT_CANCELED) left
stage stuck at Auditee/EnableRemoteVerify with no content generated
yet. A later configuration change then hid the buttons in onCreate's
onPreDraw listener without restoring any content, leaving only the
toolbar visible.

Fixes GrapheneOS#323
@xhon-pelushi

Copy link
Copy Markdown
Author

Flagging an overlap so a maintainer does not have to find it: #370 (@munzzyy) fixes the same bug,
and it is more complete than this PR.

The first hunk is the same change — mine is } else if (...), theirs is } else { if (...) },
semantically identical.

But theirs has a second hunk that I missed: onRequestPermissionsResult(), resetting the stage when
the camera permission is denied. That is a second way the scan never starts, and this PR leaves
the stage stuck in exactly the same way for it. Their coverage of the bug is strictly better than
mine.

I opened this on 13 August and theirs is from 9 September, so this one is first in time — but
"first" is not the useful property here, "correct" is. Your call, and either is fine by me:

I would lean towards the first, since #370 already has it written.

@munzzyy

munzzyy commented Sep 17, 2026

Copy link
Copy Markdown

Thanks for reading both and saying which one covers more. The permission-denied path is the half that matters, since it leaves the stage stuck the same way.

Happy either way, and it is the maintainers' call: close this for #370, or I close #370 and you add that hunk here. Whichever way it goes I will drop mine so only one stays open.

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.
@xhon-pelushi

Copy link
Copy Markdown
Author

I've added the second path here: onRequestPermissionsResult() now resets the stage to None when the camera permission is denied, the same stuck state the scanner RESULT_CANCELED path had. Credit to #370 (@munzzyy) for spotting that path — this PR now covers both.

@munzzyy since you offered to drop yours either way, no objection from me to closing #370 in favour of this, but it's the maintainers' call. Either way happy to end up with one PR.

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

2 participants