fix(android): read a child that vanished mid-read as gone
Summary
The Android snapshot helper can throw NullPointerException: ... java.util.List.size() on a null object reference from inside AccessibilityNodeInfo.getChild (framework AccessibilityInteractionClient.checkFindAccessibilityNodeInfoResultIntegrity) when the child's window closes during the read. The fixture's alert accept hits it while the dialog closes. The persistent session reports a capture error, so the host force-kills the session, answers with a one-shot am instrument capture, and keeps the session off for about 40 s. Every capture in that window is slower.
AccessibilityNodeReads.child, the single owner of child reads, now treats that throw as the null that the framework answers for a vanished child. 1 file changed.
The new Android perf suite (#3885 stack) found this as automation/alert-accept โ android_snapshot_helper_session_fallback.
Validation
-
Head 8e3885218a:
pnpm check:affected --run --head 8e3885218apassed (exactCommit). Theandroid-helperscheck is GitHub-authoritative (Android / Smoke Tests). -
Device: an API 35
pixel_7emulator (google_apis arm64) with the fixture Release APK. Each iteration pressesautomation-open-alert, runsalert wait, thenalert accept --debug. The NPE session fallbacks were counted from the request logs:- base 9935ef51c2: 3 of 60, plus 2 of 30 in an earlier run;
- this head: 0 of 60.
All 60 accepts were handled in both runs.
-
I logged the framework stack trace with a temporary
Log.ethat is not in this commit.
๐ค Generated with Claude Code