uiautomator-device-control
Installation
SKILL.md
UiDevice — Device Control
Source: https://developer.android.com/reference/androidx/test/uiautomator/UiDevice, https://developer.android.com/training/testing/other-components/ui-automator-legacy, https://developer.android.com/training/testing/other-components/ui-automator
Purpose
UiDevice is the primary entry point for UI Automator tests. It provides access to device state (display, orientation, current package) and simulates user actions at the system level — button presses, rotation changes, gestures, and power control. Unlike Espresso, UiDevice operates outside the target app process, enabling cross-app and system-level testing.
When to Use
- Any UI Automator test —
UiDevice.getInstance(Instrumentation)is the mandatory first step - Pressing system buttons (Back, Home, Recent Apps, D-pad keys)
- Forcing screen orientation (landscape/portrait) and freezing rotation
- Waking/sleeping the device programmatically
- Querying display dimensions for coordinate-based gestures
- Opening notification shade / Quick Settings
- Taking screenshots for debugging or visual assertions
- Sending shell commands (e.g., launching system Settings)