Introduction¶
When agents perform mobile automation, there are typically two approaches: either mirroring the main screen (like scrcpy), or using an emulator. The former steals focus and interrupts user interaction; the latter is a virtual environment where login sessions aren’t shared and state remains inconsistent. Here I introduce a DSH plugin that uses Android VirtualDisplay to create a background screen: it lets AI run apps on a virtual display completely independent from the main screen, while the main screen remains fully available to you — neither side interferes with the other.
What Is This¶
ai-background-screen is a background screen tool built on Android VirtualDisplay. It runs on a real device with a real OS — the app is the normally installed one, and login sessions are shared. Instead of mirroring the main screen, it creates a virtual display that’s invisible to the user, runs apps on it, and streams the screen content in real time via a floating window. The plugin provides three integration methods: CLI, MCP, and DSH.
Core Features¶
- Run a second app instance on the same phone while the user continues using the main screen
- Tap / swipe / long-press / two-finger gestures, supporting 60 Hz continuous hold (e.g., game joysticks) and multi-finger gestures
- Chinese text input via clipboard + KEYCODE_PASTE, without triggering the on-screen keyboard
- 40 tools including screenshot, OCR, template matching, and color detection
- Multiple virtual displays, limited only by device memory (~75–185 MB each)
- Real-time floating window (MJPEG, frame rendered on change), with thumbnail and edge glow status indicators
- No root required; requires Android 12+ (API 31+)
Installation & Setup¶
Prerequisites¶
- Android 12+ (API 31+), no root required
- adb installed, with wireless debugging connected to the phone (recommended:
127.0.0.1:5555) - Wireless debugging enabled on the phone, and pairing completed
Install Commands¶
Install from npm (recommended):
dsh plugin --profile web add ai-background-screen
Install from source (when code modification is needed):
git clone https://github.com/JMINN0/ai-background-screen.git
cd ai-background-screen
dsh plugin --profile web add ./screen
After installation, the engine must be restarted for MCP tools to load.
Using Claude Desktop / Cursor / Cline (without DSH)¶
Configure the MCP Server:
{
"mcpServers": {
"background-screen": {
"command": "node",
"args": ["/Users/your-username/ai-background-screen/screen/bin/mcp-server.mjs"]
}
}
}
Typical Usage¶
Create a Virtual Display¶
# Create a virtual display (also starts the floating window and streaming)
node screen/bin/vdisplay.mjs start
Launch an App¶
First, find the package name:
adb -s 127.0.0.1:5555 shell pm list packages -3
Launch the app:
node screen/bin/vdisplay.mjs launch com.android.calendar
Tap & Input¶
Tap once:
node screen/bin/vdisplay.mjs input tap --nx 0.5 --ny 0.5
Read text then tap (requires OCR support):
node screen/bin/vdisplay.mjs text
node screen/bin/vdisplay.mjs input tap --nx 0.128 --ny 0.145
Screenshot¶
node screen/bin/vdisplay.mjs shot --out /tmp/a.jpg
Stop the Virtual Display¶
node screen/bin/vdisplay.mjs stop
node screen/bin/vdisplay.mjs status
Use Cases & Caveats¶
Ideal for automation scenarios that require running apps in the background, such as batch operations, multi-task processing, and state checks. Keep in mind:
- The plugin runs with the permissions of the current DSH process — verify the source code and license
- Banking / payment apps have restrictions (FLAG_SECURE prevents screen capture)
- The virtual display is visible to apps — it’s not truly “invisible”
- Cannot be used on iPhone
- Fully human-like gestures are not achievable (adb input lacks MOVE trajectories and pressure variation)
Summary¶
This plugin wraps Android VirtualDisplay into a set of CLI + MCP tools, enabling AI to operate a phone on a separate screen while the main screen and keyboard remain completely unaffected. If you need to “use your phone while letting AI run tasks in the background,” check out the catalog page and source code.
- Catalog page: https://www.skillhub.cn/plugins/JMINN0/ai-background-screen
- GitHub: https://github.com/JMINN0/ai-background-screen