injecting-input-and-state

Drives Android devices from the host shell via adb input, wm, settings, am, and cmd commands.

1|Updated Jul 6, 2026
One-click install
npx skills add https://github.com/citytexi/team-yg-pesonal-agent --skill injecting-input-and-state-citytexi
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: injecting-input-and-state
Source: https://github.com/citytexi/team-yg-pesonal-agent/tree/main/.claude/skills/injecting-input-and-state
Command: npx skills add https://github.com/citytexi/team-yg-pesonal-agent --skill injecting-input-and-state-citytexi

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Scripting Android device behavior from CI or a host shell is error-prone: input text silently drops spaces, svc wifi no-ops on API 30+, am force-stop leaves stale app state, and leaked wm size overrides break later test runs. This Skill provides the correct, verified shell commands for injecting input, overriding display configuration, resetting app state, and launching Activities. ## Core Features & Use Cases - Input Injection: Tap, swipe, drag-and-drop, text entry (with %s space encoding), and key events via adb shell input, including source prefixes like dpad for TV focus navigation. - Display & Settings Control: Override screen size and density with wm size/wm density, and set the hermetic animation-scale-zero preamble with settings put global. - State Reset & Launch: Distinguish pm clear from am force-stop for between-test resets, and launch Activities with am start -S -W -n pkg/.Activity plus typed intent extras. - Modern cmd Wrapper: Replace deprecated svc aliases with cmd wifi set-wifi-enabled, cmd connectivity airplane-mode, cmd uimode night, and per-app locales on API 30+. - Use Case: A QA engineer writing a CI script needs a reproducible cold-start test: clear app data with pm clear, zero the animation scales, launch the main Activity with am start -S -W, then inject a tap-and-type user journey — all without flakiness from stale state or silent svc failures. ## Quick Start Ask the assistant to write an adb shell script that clears the app data, disables animations, launches the main Activity, and types a login email and password using input text.

Frequently Asked Questions about injecting-input-and-state

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I type text with spaces using adb shell input?▼

Encode spaces as %s in adb shell input text, for example `adb shell input text 'hello%sworld'`. Plain spaces cause only the first word to be typed, and shell metacharacters must be escaped twice for the local and device shells.

What is the difference between am force-stop and pm clear?▼

am force-stop kills the app process but leaves shared preferences, databases, caches, and granted permissions intact. pm clear kills the process and wipes all app data, making it the correct choice for a hermetic between-test reset.

Why does adb shell svc wifi disable not work on Android 11+?▼

The svc commands were demoted to ordinary shell commands on API 30+ and silently no-op with exit code 0. Use `adb shell cmd wifi set-wifi-enabled disabled` instead, and verify with `cmd wifi status`.

How do I disable animations for stable instrumented tests?▼

Set window_animation_scale, transition_animation_scale, and animator_duration_scale to 0 via `adb shell settings put global`. Alternatively, enable `testOptions.animationsDisabled = true` in the Gradle build configuration.

How do I launch an Android Activity from the command line with extras?▼

Use `adb shell am start -S -W -n pkg/.Activity` for a cold, blocking launch. Attach typed extras with flags like --es for strings, --ez for booleans, and --ei for integers.

When should I not use adb shell input for UI testing?▼

Avoid adb shell input when driving the UI from inside an instrumentation test — use ActivityScenario or UiAutomator instead. It is also unreliable for non-ASCII text, where UiObject2.setText is the correct tool.