How lmoq/u2state works
U2 is a Python Android UI automation framework. Its main workflow models work as task metadata and UI states: states find UI elements, perform actions, and verify results while a handler controls transitions. Device-session helpers expose the connected device and package context; separate modules provide ADB input, shell-pipe support, notifications, logging, and time utilities. The README is empty, so capabilities are inferred from the source tree and excerpts; relationships not shown there are omitted.
Main entry points: states.py UI states · adb.py ADB input · state.py State handler · pipes.py ADB shell pipes
Components 17
Task orchestration
- Task metadata
U2/task.py - State handler
U2/states/state.py - UI states
U2/states/states.py - State actions
U2/states/functions.py - Action enums
U2/enums.py
Android device access
- Device session
U2/base.py - ADB input
U2/adb_tools/adb.py - ADB shell pipes
U2/process/pipes.py - System detection
U2/process/system.py
Runtime support
- Shell notifications
U2/notif/shell_notif.py - Termux notifications
U2/notif/termux_notif.py - Logger
U2/debug/logger.py - Weekly time
U2/time/stime.py - Interval tracker
U2/time/timetracker.py
Other components
- Automation caller
- Android device
- Host shell
Connections 13
- Automation caller → State handler: runs states
- State handler → UI states: dispatches
U2/states/states.py - UI states → State actions: calls actions
U2/states/states.py - UI states → Task metadata: reads metadata
U2/states/states.py - State handler → Task metadata: uses metadata
U2/states/state.py - UI states → Device session: queries UI
U2/states/states.py - Device session → Android device: queries device
- ADB input → Android device: sends input
U2/adb_tools/adb.py - ADB input → System detection: reads system type
U2/adb_tools/adb.py - ADB input → Host shell: runs commands
U2/adb_tools/adb.py - ADB shell pipes → Android device: opens ADB shell
U2/process/pipes.py - ADB shell pipes → Host shell: creates pipes
U2/process/pipes.py - Shell notifications → Host shell: posts notification
U2/notif/shell_notif.py