Summary
On Android, the daemon remembers per device that the test IME helper (com.callstack.agentdevice.imehelper) is installed, and never re-checks it during its lifetime. If the helper disappears from the device while the daemon is still alive, the next open leaves the real keyboard active and reports success, with no warning.
Reproduction
agent-device 0.21.24, Android emulator API 32, single daemon started by the first command.
npx agent-device open com.android.settings --platform android
adb shell settings get secure default_input_method # com.callstack.agentdevice.imehelper/.TestInputMethodService
npx agent-device close
adb uninstall com.callstack.agentdevice.imehelper # Success
npx agent-device open com.android.settings --platform android # "Opened: com.android.settings", rc 0
adb shell settings get secure default_input_method # com.google.android.inputmethod.latin/com.android.inputmethod.latin.LatinIME
With a field focused after the second open:
keyboard status: Keyboard visible: yes, Input method: com.google.android.inputmethod.latin
snapshot --json: keyboard.kind is visible
After daemon stop, the same open reinstalls the helper and selects it (TestInputMethodService, Keyboard visible: no, kind: absent).
Expected
open either reinstalls the helper when it is missing, or fails / warns that the test IME could not be selected.
Likely cause
dist/src/ime-state.js: ensureHelperInstalled is called with a module-level cache: new Set(). Once a device id is in the set, the installation is not checked again.
When it happens in practice
An AVD wiped (-wipe-data) or recreated under the same serial (emulator-5554), or the helper uninstalled, then reopened within the daemon's idle timeout (~5 min after the last close). A plain emulator restart with the helper still installed does not trigger it.
Summary
On Android, the daemon remembers per device that the test IME helper (
com.callstack.agentdevice.imehelper) is installed, and never re-checks it during its lifetime. If the helper disappears from the device while the daemon is still alive, the nextopenleaves the real keyboard active and reports success, with no warning.Reproduction
agent-device 0.21.24, Android emulator API 32, single daemon started by the first command.
With a field focused after the second
open:keyboard status:Keyboard visible: yes,Input method: com.google.android.inputmethod.latinsnapshot --json:keyboard.kindisvisibleAfter
daemon stop, the sameopenreinstalls the helper and selects it (TestInputMethodService,Keyboard visible: no,kind: absent).Expected
openeither reinstalls the helper when it is missing, or fails / warns that the test IME could not be selected.Likely cause
dist/src/ime-state.js:ensureHelperInstalledis called with a module-levelcache: new Set(). Once a device id is in the set, the installation is not checked again.When it happens in practice
An AVD wiped (
-wipe-data) or recreated under the same serial (emulator-5554), or the helper uninstalled, then reopened within the daemon's idle timeout (~5 min after the lastclose). A plain emulator restart with the helper still installed does not trigger it.