test(android): pin that a child vanishing mid-read reads as gone

Merged
TH
2d ago
+53-4

Summary

Follow-up to #3901, applying the review's non-blocking notes. 2 files changed.

  • AccessibilityNodeReads.child now reads through nullIfGone, a small generic seam that treats a throwing read as a gone node. The JVM suite can reach it, and a new AccessibilityReadBatchTest case fails if the catch is removed. A non-vanishing failure (IllegalStateException) still propagates.
  • A doc comment says a null node is a programmer error that the catch would also hide.
  • child.getChildCount and the bounds reads in appendNode need no guard. In the framework sources (API 35), getChildCount() returns mChildNodeIds.size() and getBoundsInScreen(Rect) copies mBoundsInScreen. Both are field reads on a sealed node with no interaction-client call. Only getChild goes through AccessibilityInteractionClient, and #3901 already covers it.

Validation

  • Head a09cc7df06: pnpm check:affected --run --head a09cc7df06 passed (exactCommit). The snapshot helper build runs SnapshotHelperTestSuite, which includes the new case.
  • With the catch changed to a different exception type, the same build fails with NullPointerException: window closed from the new case.
  • GitHub owns the Android lanes. No device run: the change is a refactor of the already-verified catch.

🤖 Generated with Claude Code