---
name: android_input_swipe
kind: function
lang: bash
domain: infra
version: "1.0.0"
purity: impure
signature: "android_input_swipe([--serial <S>], x1: int, y1: int, x2: int, y2: int, [duration_ms: int])"
description: "Send swipe gesture between two points with duration."
tags: [android, adb, input, swipe, gesture, ui-test, pendiente-usar]
uses_functions: [adb_wsl_bash_infra]
uses_types: []
returns: []
returns_optional: false
error_type: "error_go_core"
imports: []
params:
  - name: "--serial <S>"
    desc: "Optional target device serial. Overrides ADB_SERIAL envvar."
  - name: x1
    desc: "Start X coordinate in pixels."
  - name: y1
    desc: "Start Y coordinate in pixels."
  - name: x2
    desc: "End X coordinate in pixels."
  - name: y2
    desc: "End Y coordinate in pixels."
  - name: duration_ms
    desc: "Optional swipe duration in milliseconds. Default 300."
output: "Stdout swipe summary line: 'swipe x1,y1 → x2,y2 (Nms) on <serial>'."
tested: false
tests: []
test_file_path: ""
file_path: "bash/functions/infra/android_input_swipe.sh"
---

## Ejemplo

```bash
source bash/functions/infra/android_input_swipe.sh

# Scroll down (swipe up)
android_input_swipe 540 1400 540 400

# Scroll up slowly on a specific device
android_input_swipe --serial emulator-5554 540 400 540 1400 800
```

## Notas

Requiere `adb_wsl.sh` (sourceado automáticamente). Usa `adb_pick_serial` para
resolver el dispositivo objetivo a partir de `--serial`, `ADB_SERIAL` o el
único device disponible.

Los cuatro argumentos de coordenadas se validan como enteros antes de invocar
adb — acepta coordenadas negativas (edge cases de hardware con ejes invertidos).

Exit 3 si `adb_pick_serial` no puede resolver el serial (sin devices o ambiguo).
Exit 1 si faltan coordenadas o alguna no es numérica.
