# `DalaDev.Bench.ADBHelper`
[🔗](https://github.com/manhvu/dala_dev/blob/main/lib/dala_dev/bench/ADBHelper.ex#L1)

Common ADB operations for battery benchmarking.

Centralizes ADB command execution to reduce duplication across
battery bench and preflight modules.

# `app_pid`

```elixir
@spec app_pid(String.t(), String.t()) ::
  {:ok, String.t()} | {:error, String.t()} | :app_dead
```

Gets the PID of an app on an Android device.

# `auto_detect_device`

```elixir
@spec auto_detect_device() :: String.t() | nil
```

Auto-detects a connected Android device.

# `available?`

```elixir
@spec available?() :: boolean()
```

Checks if ADB is available.

# `battery_level`

```elixir
@spec battery_level(String.t()) :: {:ok, non_neg_integer()} | {:error, String.t()}
```

Gets the battery level from an Android device.

# `check_app_installed`

```elixir
@spec check_app_installed(String.t(), String.t()) ::
  {:ok, String.t()} | {:error, String.t()}
```

Checks if an app is installed on an Android device.

# `check_device`

```elixir
@spec check_device(String.t() | nil) :: {:ok, String.t()} | {:error, String.t()}
```

Checks if ADB is available and a device is reachable.

Returns `{:ok, serial}` if a device is found, `{:error, reason}` otherwise.

# `device_ok?`

```elixir
@spec device_ok?(String.t()) :: boolean()
```

Checks if a device is reachable via ADB.

# `enable_wifi_adb`

```elixir
@spec enable_wifi_adb(String.t()) :: :ok | {:error, String.t()}
```

Enables WiFi ADB for a device.

# `ensure_local_dist`

```elixir
@spec ensure_local_dist() :: :ok
```

Ensures local Erlang distribution is started.

# `run`

```elixir
@spec run(String.t(), [String.t()]) :: {:ok, String.t()} | {:error, String.t()}
```

Runs an ADB command and returns the output.

# `run_raw`

```elixir
@spec run_raw(String.t(), [String.t()]) :: String.t()
```

Runs an ADB command and returns the raw output (including stderr).

# `setup_tunnels`

```elixir
@spec setup_tunnels(String.t()) :: :ok
```

Sets up ADB tunnels for device communication.

# `wifi_ip`

```elixir
@spec wifi_ip(String.t()) :: {:ok, String.t()} | {:error, String.t()}
```

Gets the WiFi IP for a device.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
