Skip to content

fix(auth): rebuild app lock lifecycle handling - #6892

Open
SeniorZhai wants to merge 2 commits into
masterfrom
fix/app-lock-lifecycle
Open

SeniorZhai wants to merge 2 commits into
masterfrom
fix/app-lock-lifecycle

Conversation

@SeniorZhai

Copy link
Copy Markdown
Member

No description provided.

@gaotic

gaotic Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

AI review done for 22f939e in 6m 11s · 1 comment

Quality: Needs a fix before merge. Source review confirmed the early deep-link timeout fix and found a remaining PIN unlock issue during activity recreation. Runtime verification was blocked.

Role Model Status
Reviewer Grok grok-4.7-build · effort medium failed (error)
Reviewer Codex codex/gpt-6.2-sol · effort high ok
Summary Codex codex/gpt-6.2-sol · effort medium ok

@gaotic gaotic Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

AI review · Grok + Codex · ef5f292

Request changes. git diff --check passed. The targeted AppAuthActivityTest run stopped before test execution because the Gradle wrapper could not download version 9.9.1.

return false
}
if (!isLocked && !foregroundChecked) {
foregroundChecked = true

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

A deep link handled entirely in onCreate can leave app lock disabled past its timeout. For example, a rejected WalletConnect link opened during the grace period sets foregroundChecked here, then finishes before onStart, so no onStop clears the flag. The next launch skips the timeout check. Keep the early deep-link check, but only mark the foreground session checked once an activity has started.


private fun bindPinVerification(dialog: VerifyBottomSheetDialogFragment) {
dialog.setOnPinSuccess {
if (!lifecycle.currentState.isAtLeast(Lifecycle.State.STARTED)) return@setOnPinSuccess

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

If PIN verification succeeds while the lock screen is stopped, this guard drops the unlock. The verification coroutine continues while stopped, so the PIN sheet still dismisses and shows “Successful,” but the user has to authenticate again. If unlocking must wait until the activity starts, defer applying the result and showing success until then.

@gaotic gaotic Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

AI review · Codex (Grok failed) · 22f939e

Request changes. git diff --check passed for both the full PR and the changes since the previous review. Gradle failed during startup, so neither targeted auth test ran.

if (lifecycle.currentState.isAtLeast(Lifecycle.State.STARTED)) {
applyPinSuccessUnlock()
} else {
pendingPinUnlock = true

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

If PIN verification succeeds after onSaveInstanceState, this updates only the current activity. The PIN sheet still dismisses and requests a success toast, but a recreated activity restores pendingPinUnlock = false from the earlier snapshot and asks for authentication again. Keep the verified result in an activity-scoped ViewModel that survives configuration changes, and show success when the unlock is applied.

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.

1 participant