injecting-input-and-state
Installation
SKILL.md
Injecting Input and State — Drive the Device From the Shell
This skill covers the on-device shell surface a test/QA engineer drives over adb to simulate user gestures, override the screen configuration, flip system settings, reset app state, and launch Activities. Transport (adb devices, USB/TCP) lives in ../../architecture/understanding-adb-architecture/SKILL.md; capturing artefacts after driving the device lives in ../../capture/capturing-screenshots-and-screenrecord/SKILL.md.
When to use this skill
- The developer needs to script a user journey from CI without writing instrumentation: tap, swipe, type text, press hardware keys.
- A bug repro requires a specific screen size or density (
wm size 411x731,wm density 320) without recreating an emulator AVD. - The test suite is flaky because animations are on; the developer wants the canonical hermetic preamble (
window_animation_scale = 0etc.). - The developer needs to clear app data between runs and is unsure whether
am force-stopis enough (it is not). - A script uses
adb shell svc wifi disableand silently does nothing on API 30+ — the moderncmd wifi set-wifi-enabled disabledis the fix. - The developer needs to launch a deep-link Activity with typed extras (
--ez,--ei,--es).
When NOT to use this skill
- The bytes need to leave the device (screenshots, logs, DB). Use
../../capture/capturing-screenshots-and-screenrecord/SKILL.md,../../observability/extracting-logs-with-logcat/SKILL.md,../../transfer/extracting-test-artifacts/SKILL.md. - Driving the device from inside an instrumentation test, not from the host. Use
../../../instrumentation/scenarios/launching-activities-with-activityscenario/SKILL.mdor UiAutomator. - Installing or uninstalling APKs. Use
../../apps/installing-and-managing-apps/SKILL.md. - Connecting to the device in the first place. Use
../../devices/connecting-to-devices/SKILL.mdor../../devices/connecting-over-wifi/SKILL.md.