---
name: android_emu_rotate
kind: function
lang: bash
domain: infra
version: "1.0.0"
purity: impure
signature: "android_emu_rotate([--serial <S>] [portrait|landscape|0|90|180|270])"
description: "Rotate emulator screen. Empty=toggle, or fixed orientation. Locks autorotate."
tags: [android, emulator, rotation, orientation, 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 emulator serial. Picked automatically if only one is connected."
  - name: "orientation"
    desc: "Empty=toggle via emu rotate, or fixed: portrait/landscape/0/90/180/270."
output: "Stdout 'rotated: <orient> on <serial>'."
tested: false
tests: []
test_file_path: ""
file_path: "bash/functions/infra/android_emu_rotate.sh"
---

## Ejemplo

```bash
# Toggle rotation
android_emu_rotate

# Force portrait
android_emu_rotate portrait

# Force landscape on specific emulator
android_emu_rotate --serial emulator-5554 landscape

# Set 270 degrees
android_emu_rotate --serial emulator-5554 270
```

## Notas

Deshabilita autorotate (`accelerometer_rotation 0`) antes de aplicar cualquier orientacion fija, de modo que el sistema no la revierta. El toggle (`emu rotate`) no desactiva autorotate: lo usa directamente el daemon del emulador.

`adb_pick_serial` (de `adb_wsl_bash_infra`) selecciona el unico emulador conectado o falla con exit 3 si hay ambiguedad o ninguno disponible. Los argumentos restantes tras extraer `--serial` quedan en `ADB_PICK_REST`.
