fix(android): reinstall and reselect the test IME helper after it disappears
Merged
LA
4d ago+164+164+012345678901234567890123456789-8-8-0123456789
Summary
open remembers per daemon that it installed the test IME helper and never checks again, so once the helper is gone (uninstalled, -wipe-data, or an emulator snapshot from before the install), the next open leaves the real keyboard active and succeeds (#3407).
- A remembered install now re-reads the installed version code (one
cmd package list packages --show-versioncode, about 34 ms on an API 33 emulator) and reinstalls a missing or older helper. The cache still skips the APK checksums. - After an install,
ensureAndroidImeHelperwaits up to 5 s forime list -a -sto list the service.adb installreturns before the input method manager registers it, andime enable/ime setthen fail with "Unknown input method". This also hits first installs onmain. A wait that runs out leaves the refusal to the existing read-back.
Closes #3407. 3 files: the two checks and tests.
Validation
Head 72ce59f: pnpm check:affected --run passed, run with AWS_REGION unset because cloud-connect-profile.test.ts reads the host's region. Reverting either change fails its new test.
Live on an Android 13 emulator (API 33, arm64, -gpu swiftshader_indirect), open com.android.settings, reading default_input_method after each open:
| Test IME selected after | base 3d48bb9 | head 72ce59f |
|---|---|---|
reopen after adb uninstall (#3407's steps) | 0/10 | 10/10 |
| first open, helper freshly installed | 16/20 | 20/20 |
| reopen after loading a snapshot taken without the helper | 0/10 | 10/10 |
Not run on a physical device or a remote adb provider.