Skip to content

Skipperddd/adb_screen

Repository files navigation

adb_screen

adb_screen is a Windows desktop tool for mirroring an Android device and sending input back over ADB. It uses Android Studio's screen-sharing-agent.jar for video/control transport, PyAV for decoding, and a PySide6 UI for interaction.

What It Does

  • Mirrors the Android screen in a desktop window.
  • Sends click, drag, scroll, text input, and common key events back to the device.
  • Supports rooted devices that require su for touch injection.
  • Automatically falls back to adb shell input if the screen-sharing agent cannot inject touch events on the target ROM.
  • Optionally enables USB reverse tethering through gnirehtet.

Scope

The runtime-critical parts are:

  • main.py
  • src/
  • screen-sharing-agent/
  • requirements.txt
  • README.md
  • run_adb_screen.cmd

Optional but useful:

  • tests/
  • vendor/gnirehtet/ if you want the USB internet button to work
  • adb/adb.exe, adb/AdbWinApi.dll, and adb/AdbWinUsbApi.dll if you want to bundle ADB inside the repo

Not required for adb_screen itself and safe to remove before uploading to Gitee:

  • vendor/linuxdeploy/
  • vendor/termux/
  • vendor/termux-browser/
  • vendor/termux-widget/
  • src/adb_screen.egg-info/
  • src/__pycache__/
  • sample screenshots such as termux_screen.png, xfce_touch_screen.png, and similar image files
  • launcher4x6.db

Requirements

  • Windows 10 or newer
  • Python 3.10+
  • One Android device with USB debugging enabled
  • screen-sharing-agent.jar and its ABI libraries under screen-sharing-agent/
  • A working adb.exe, either:
    • bundled in adb/, or
    • available in PATH, or
    • installed under a common Android SDK platform-tools path

Recommended Repository Layout

adb_screen/
	README.md
	main.py
	requirements.txt
	pytest.ini
	run_adb_screen.cmd
	adb/
		adb.exe
		AdbWinApi.dll
		AdbWinUsbApi.dll
	src/
		adb.py
		cli.py
		protocol.py
		reverse_tether.py
		session.py
		viewer.py
		__init__.py
		__main__.py
	screen-sharing-agent/
		screen-sharing-agent.jar
		arm64-v8a/
		armeabi-v7a/
		x86/
		x86_64/
	tests/                              # optional
	vendor/
		gnirehtet/                        # optional, for USB internet only

Installation

Create a virtual environment inside the adb_screen directory and install the project in editable mode:

cd adb_screen
py -3 -m venv .venv
.\.venv\Scripts\python -m pip install --upgrade pip
.\.venv\Scripts\python -m pip install -r requirements.txt

If you do not use py, replace it with python.

Running

Option 1: Double-click launcher

Use the local launcher in this directory:

cd adb_screen
.\run_adb_screen.cmd

The launcher prefers adb_screen\.venv\Scripts\python.exe. If no local virtual environment exists, it falls back to py -3 and then python.

Option 2: Run from the command line

cd adb_screen
.\.venv\Scripts\python .\main.py

Examples:

.\.venv\Scripts\python .\main.py --serial e2bb5a16
.\.venv\Scripts\python .\main.py --use-root
.\.venv\Scripts\python .\main.py --adb "C:\Android\platform-tools\adb.exe"

Useful arguments:

  • --adb <path>: explicit adb.exe path
  • --serial <serial>: select one device when multiple devices are connected
  • --codec avc|hevc|av1: choose the preferred video codec
  • --use-root: run the agent through su
  • --no-use-root: force a non-root session even if saved settings were root-enabled
  • --resource-dir <path>: override the default screen-sharing-agent/ directory

Usage Notes

  • If only one device is connected, you can leave the serial field empty.
  • If your ROM kills touch injection immediately, enable Use root (su) for touch input before connecting.
  • If the agent still cannot inject touch events, the app can reconnect with an adb shell input fallback backend.
  • The Turn off display option keeps the phone panel dark while mirroring and restores it on disconnect.

USB Internet

The USB internet button is optional and depends on vendor/gnirehtet/release/gnirehtet-rust-win64/ containing:

  • gnirehtet.exe
  • gnirehtet.apk

When enabled, the desktop app installs the APK, starts the relay on Windows, and asks Android to route traffic through the USB-connected host. Some devices will show a VPN confirmation dialog that the user must accept.

If you do not need this feature, you can omit vendor/gnirehtet/ from the repo.

Controls

  • Left click / drag: touch and swipe
  • Mouse wheel: scroll
  • Text keys: send text input
  • Backspace, Delete, Enter, Esc, Tab, and arrow keys: send Android key events
  • Back, Home, Power, and task-switch buttons: send the matching Android key codes

Testing

cd adb_screen
.\.venv\Scripts\python -m pytest

Troubleshooting

  • Unable to locate adb: put adb.exe in adb/, add it to PATH, or pass --adb explicitly.
  • Multiple devices are connected: fill the serial field or pass --serial.
  • Touch disconnects right after click: retry with --use-root or enable the root checkbox in the UI.
  • USB internet failed: make sure vendor/gnirehtet exists and accept the VPN prompt on the device.
  • Missing agent jar: verify screen-sharing-agent/screen-sharing-agent.jar and ABI folders are present.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors