Skip to content

fix(e2e): dismiss Android ANR dialog blocking Expo E2E on CI#358

Merged
cursor[bot] merged 1 commit into
harden-native-modulesfrom
cursor/fix-e2e-android-anr-5cc7
Jun 30, 2026
Merged

fix(e2e): dismiss Android ANR dialog blocking Expo E2E on CI#358
cursor[bot] merged 1 commit into
harden-native-modulesfrom
cursor/fix-e2e-android-anr-5cc7

Conversation

@plrthink

Copy link
Copy Markdown
Collaborator

Problem

PR #356's CI has been failing intermittently on E2E Android (expo). The latest run (760f77a) shows all build jobs and most E2E jobs passing; only E2E Android (expo) fails.

Maestro debug artifacts from that run show the Expo app did load — "RNZipArchive Playground" is visible behind a system-level "System UI isn't responding" ANR dialog. The assertion fails because the dialog blocks element visibility for the full 180s timeout.

Root cause

Two bugs in the ANR workaround added in 760f77a:

  1. Apostrophe mismatch_setup.yaml used a curly apostrophe (' U+2019) in "System UI isn't responding", but Android renders a straight apostrophe (' U+0027). Maestro's one-shot when: visible check was skipped every time.
  2. Timing — The dismiss handler ran once before extendedWaitUntil. The ANR dialog typically appears during the 3-minute wait (after app launch under emulator memory pressure), so a single pre-check cannot catch it.

The Expo playground is heavier than the RN playground (Expo Router, dev-client shell), making it more likely to trigger system UI ANR on the API 29 / software-GPU GitHub Actions emulator — which is why E2E Android (rn) passes while E2E Android (expo) fails.

Fix

  • Replace the one-shot ANR handler with a repeat/while loop that taps Wait whenever the dialog is visible while waiting for the home screen (up to 90 iterations).
  • Use the correct straight ASCII apostrophe in the visibility selector.
  • Re-add adb shell settings commands to suppress ANR dialogs on the CI emulator (removed in 760f77a when the Maestro fallback was added).

Historical context (PR #356)

Earlier failures on this PR were different issues, now resolved:

Phase Failing job Cause
Jun 23 iOS Build (expo) Swift 6.2 strict-concurrency errors in Expo SDK pods
Jun 23 E2E Android (both) Same ANR / emulator instability
Jun 30 E2E Android (expo) only ANR dialog + broken Maestro dismiss handler

Build jobs and iOS E2E are green on the latest commit; this fix targets the remaining Android Expo E2E failure.

Verification

  • Confirmed apostrophe encoding with Python (U+0027 in updated YAML).
  • Maestro repeat/while pattern matches official docs.
  • Full E2E validation requires CI run on this branch.
Open in Web Open in Cursor 

The E2E Android (expo) job failed because a system-level "System UI
isn't responding" dialog blocked Maestro from seeing the home screen.
The one-shot dismiss handler never fired for two reasons:

1. The YAML used a curly apostrophe (U+2019) but Android renders a
   straight apostrophe (U+0027), so the visibility check was skipped.
2. The dialog often appears mid-wait, after the single pre-check runs.

Replace the one-shot handler with a repeat-while loop that taps Wait
whenever the ANR dialog is visible, and re-add adb settings to suppress
ANR prompts on the CI emulator.

Co-authored-by: Perry <plrthink@gmail.com>
@cursor cursor Bot force-pushed the cursor/fix-e2e-android-anr-5cc7 branch from 0045db1 to 6bde190 Compare June 30, 2026 03:25
@cursor cursor Bot marked this pull request as ready for review June 30, 2026 03:25
@cursor cursor Bot merged commit b23895e into harden-native-modules Jun 30, 2026
@cursor cursor Bot deleted the cursor/fix-e2e-android-anr-5cc7 branch June 30, 2026 03:26

@devin-ai-integration devin-ai-integration 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.

Devin Review found 1 potential issue.

Open in Devin Review

Comment thread .github/workflows/e2e.yml
Comment on lines +210 to +212
adb shell settings put secure show_anr_messages 0
adb shell settings put global anr_dialogs_disabled true
adb shell settings put global anr_show_background false

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🚩 ADB ANR suppression settings may be no-ops on API 29

The three adb shell settings put commands (show_anr_messages, anr_dialogs_disabled, anr_show_background) at .github/workflows/e2e.yml:210-212 are not standard AOSP Settings keys documented for API 29. settings put won't fail even if the keys are unrecognized — it silently writes to the database — but the system may not read them. The anr_dialogs_disabled value is set to true (string) rather than 1 (integer), which could be an issue if the system uses Settings.Global.getInt(). This is mitigated by the Maestro-level fallback: the repeat loop in _setup.yaml:78-89 still actively dismisses any ANR dialogs that appear. So these commands are best-effort hardening, not the sole defense.

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

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