Skip to content

Fix Chrome Custom Tab race condition causing window not to close after verification#16

Merged
seftena merged 1 commit into
masterfrom
fix/redirect-activity-race-condition
Apr 27, 2026
Merged

Fix Chrome Custom Tab race condition causing window not to close after verification#16
seftena merged 1 commit into
masterfrom
fix/redirect-activity-race-condition

Conversation

@seftena
Copy link
Copy Markdown
Contributor

@seftena seftena commented Apr 27, 2026

Problem

After verification completes, the Chrome Custom Tab was not dismissing
automatically on Android. Stephen Hagans at CVS reported this as an
ongoing issue after the previous fix.

Root Cause

IDmeRedirectActivity.handleIntent() was reading callingActivity after
calling handleRedirect(). handleRedirect() completes the deferred, which
allows the launchAuth coroutine to immediately resume on Dispatchers.IO
and null out callingActivity in its finally block — before the main
thread could read it. The window-close intent was silently dropped 100%
of the time under this ordering.

Fix

Capture IDmeAuthManager.callingActivity?.get() into a local variable
before handleRedirect() is called. The local variable is immune to
concurrent modification by the IO thread.

Files Changed

  • sdk/src/main/kotlin/com/idme/auth/auth/IDmeRedirectActivity.kt

Auto close verification window
@seftena seftena requested review from a team as code owners April 27, 2026 14:58
@seftena seftena merged commit e6c977f into master Apr 27, 2026
1 check passed
@seftena seftena deleted the fix/redirect-activity-race-condition branch April 27, 2026 18:55
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.

3 participants