Skip to content

test(e2e): hide ANR dialogs on the Android E2E emulator - #501

Merged
hurali97 merged 2 commits into
callstack:mainfrom
KisaneNeko:fix/android-e2e-settle-emulator
Oct 19, 2026
Merged

hurali97 merged 2 commits into
callstack:mainfrom
KisaneNeko:fix/android-e2e-settle-emulator

Conversation

@KisaneNeko

@KisaneNeko KisaneNeko commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Refs #499

Problem

Android Detox E2E jobs (Expo 57, Expo 58, Vanilla) fail randomly. In 5 of the 7 failed runs I checked, the app was running fine, but a "System UI isn't responding" dialog was covering it. The emulator is overloaded right after boot and system apps (System UI, GMS) hit ANRs. UIAutomator only sees the dialog window, so the greeting check times out.

Change

prepare-android-emulator-for-detox.sh now runs two commands before Detox starts:

  • settings put global hide_error_dialogs 1: ANRs no longer show a dialog. Android quietly closes the hung app instead; for system apps that means a restart.
  • am broadcast -a android.intent.action.CLOSE_SYSTEM_DIALOGS: closes a dialog that was already showing.

I tested both locally on an API 34 emulator by forcing an ANR. Without the change, the dialog shows up and UIAutomator sees only the dialog window, the same as in CI. With either command, the dialog is gone.

Not covered

The other 2 failed runs were a native crash in Hermes (SIGSEGV inside GWP-ASan). This PR doesn't address that; it's tracked separately in #499.

Before merging

Draft until the Android E2E jobs have been re-run ~10 times without the dialog failure.

🤖 Generated with Claude Code

Right after boot the CI emulator is CPU-saturated and system apps
(System UI, GMS) hit ANRs. The "System UI isn't responding" dialog then
covers the app, UIAutomator only sees the dialog window, and the greeting
check times out.

Before Detox starts, suppress error dialogs, wait until CPU pressure
(/proc/pressure/cpu) stays low, and close any dialog already showing.
The wait is best-effort and never fails the job.

Refs callstack#499
/proc/pressure/cpu is not readable on the CI emulator image, so the wait
was always skipped. Hiding the dialogs is what fixes the failures.
@KisaneNeko KisaneNeko changed the title test(e2e): wait for Android emulator to settle and hide ANR dialogs test(e2e): hide ANR dialogs on the Android E2E emulator Oct 19, 2026
@KisaneNeko
KisaneNeko marked this pull request as ready for review October 19, 2026 07:32
@hurali97
hurali97 merged commit 8dd5ab6 into callstack:main Oct 19, 2026
14 checks passed
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.

2 participants