--- name: android_input_text kind: function lang: bash domain: infra version: "1.0.0" purity: impure signature: "android_input_text([--serial ], text: string) -> void" description: "Type text in focused field via adb shell input text. Spaces handled." tags: [android, adb, input, text, ui-test, pendiente-usar] uses_functions: [adb_wsl_bash_infra] uses_types: [] returns: [] returns_optional: false error_type: "error_go_core" imports: [] tested: false tests: [] test_file_path: "" file_path: "bash/functions/infra/android_input_text.sh" params: - name: "--serial " desc: "Optional target device serial. If omitted, autodetects first connected device/emulator." - name: "text" desc: "Text to type (spaces become %s as required by adb)." output: "Stdout 'typed: '. Exit 0." notes: | adb input text replaces spaces with %s. Funcion lo hace automaticamente. Special chars " $ ` se escapan con backslash para evitar interpretacion por el shell. Exit 3 si no hay ningun device disponible (propagado desde adb_pick_serial). --- ## Ejemplo ```bash source bash/functions/infra/android_input_text.sh # Tipar en el device por defecto android_input_text "hello world" # → typed: hello world (envia "hello%sworld" a adb) # Tipar en un device especifico android_input_text --serial emulator-5554 "user@example.com" ``` ## Notas `adb shell input text` no acepta espacios directos — los convierte a `%s` internamente. Esta funcion hace la sustitucion antes de llamar a adb para que el comportamiento sea predecible. Los caracteres `"`, `$` y `` ` `` se escapan con backslash para que el shell no los interprete al construir el comando. Depende de `adb_wsl_bash_infra` para resolver el binario `adb.exe` en WSL2 y para `adb_pick_serial` / `adb_s`.