fix(android): bound helper output and verify installed bytes

Merged
TH
29m ago
+742-616

Summary

The installed Android helper must be the trusted artifact, and the host must stay bounded about app text. Install checks cover replacements that complete before admission. A holder of the helper signing key can still update the package between pm path and am instrument, so the guarantee depends on #5341's key rotation.

Before / after

BeforeAfter
Installed helper with a higher versionCodeCounted as current, ran unverifiedState newer: uninstall, then install the bundled APK. versionCode comes from dumpsys package
Warm admissionMemo hit skipped device checksOne pm path compared with the verified path
Helper output on the hostUnbounded32 MiB cap per stream: command_output_limit for a one-shot call, android_snapshot_helper_session_response_too_large for a session
Text over 64K charsSerialized in fullHelper keeps a prefix and marks text-clipped. get text and is text refuse with text_clipped. Fill verification accepts a clipped node only when it is the prefix of a longer expected value

Validation

  • Head 2ff26e8323. Prod delta vs 0.22: about +240 / -170 lines.
  • Affected Android, selector and helper test files pass; hosted CI green.
  • Reverting each change failed the tests that pin it.
  • No device runs. The Java test was not run locally.
  • Known gap: before Android 8.0, a same-path reinstall is not detected by warm admission.