Skip to content
Inventor365Public

About

Native Android 12–17 Wireless ADB Manager — root-powered USB & Wireless Debugging automation without Developer Options, plus Windows PowerShell, CMD & .bat command generation

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Relay

Native Wireless ADB Manager for Android & Windows

Android Kotlin Jetpack Compose CI License

Automate Android Wireless Debugging, toggle USB & Wireless ADB without enabling Developer Options, and generate ready-to-run Windows PowerShell, CMD, and .bat connection commands.


Table of Contents


Screenshots

Captured from the R8-minified release build (2.9 MB) running on Android 17 with KernelSU and Material You dynamic wallpaper theming.

Home Dashboard
Home Dashboard
Live endpoint, Prepare Connection CTA & direct USB/Wireless switches
Connection Setup
Guided Connection Setup
Automated 6-step verification from root check to Windows execution
Windows Commands
Windows Commands
PowerShell & CMD tabs, syntax highlighting, copy-all & .bat export
Connection Monitor
Connection Monitor
Real-time state, IAdbManager port source, adbd PID & active sockets
Settings
Settings & Root Diagnostics
6-point root verifier, Developer Options bypass & export policies
Troubleshooting
Live Troubleshooting
Auto-pinned device diagnostics covering 10 Android & Windows issues

Overview

Setting up Android Wireless Debugging with a Windows PC typically means digging into Settings -> Developer Options, toggling Wireless Debugging, approving network prompts, copying ephemeral IP/port numbers, switching screens for temporary pairing codes, and typing adb pair / adb connect by hand.

Relay eliminates the Android-side friction with a native Pixel-style Material 3 utility:

  1. Open Relay and tap Prepare Connection.
  2. Relay verifies real root execution, inspects Wi-Fi / IPv4, activates Wireless Debugging automatically (without opening Settings or enabling Developer Options), and retrieves the live TLS port.
  3. Tap Copy Windows Commands or Export .bat and run it in Windows Terminal (PowerShell or CMD).

Note: Android devices cannot unilaterally initiate an ADB session on a Windows PC. Relay automates everything on the Android device and generates accurate, executable Windows-side commands based on live device telemetry.


Features

Verified Root Integration (RootManager)

  • Executes real root shell verification (su -c "id -u; id; id -Z") with strict command timeouts and independent stdout/stderr readers — never assumes root simply because a manager app or su file exists.
  • Detects Magisk, KernelSU, KernelSU Next, APatch, SuperSU, and generic su binaries.
  • Cleanly distinguishes Granted, Denied, Revoked (including live mid-session revocation), and Unavailable states.
  • Includes a 6-point interactive Root Access Diagnostics suite in Settings.

Multi-Layer Wireless Debugging Discovery (WirelessDebuggingManager)

Retrieves the active TLS connection port reliably across Android 12 through Android 17 without inventing ports:

  1. service.adb.tls.port system property (Android 12–16)
  2. IAdbManager.getAdbWirelessPort() Binder query via root (Android 12–17, including API 37 use_tls_lifecycle)
  3. dumpsys adb (adb_wifi.tls_port, connected_to_adb, user_keys)
  4. Android NsdManager mDNS discovery (_adb-tls-connect._tcp. and _adb-tls-pairing._tcp.), strictly filtered to this device's IPv4 / persist.adb.wifi.guid
  5. Kernel TCP socket inspection for adbd (ss -H -t -a -p -n with /proc/<pid>/fd + /proc/net/tcp{,6} fallback)

Windows Command Generator (CommandGenerator)

  • Dedicated PowerShell and CMD tabs with token syntax highlighting, execution order indicators, individual copy buttons, and one-tap Copy Windows Commands.
  • Supports both Already paired (adb connect IP:CONNECT_PORT) and First-time pairing (adb pair IP:PAIRING_PORT CODE followed by adb connect IP:CONNECT_PORT), strictly keeping pairing and connection ports distinct.
  • Includes ADB executable checks, Windows PATH guidance, adb devices -l, adb disconnect, adb mdns services, and local Windows ADB server reset commands.
  • Exports self-contained CRLF .bat scripts via Android's Storage Access Framework (CreateDocument) with automatic %LOCALAPPDATA%\Android\Sdk\platform-tools probing.

Live Connection Monitor (ConnectionMonitor)

  • Displays live connection state, IPv4, active port + detection source, transport mode, adbd daemon PID, live session uptime, last attempt, and last successful endpoint.
  • Inspects real ESTABLISHED remote TCP sockets attached to adbd (never fabricates client hostnames) separately from authorized host keys stored in /data/misc/adb/adb_keys.
  • Lifecycle-aware foreground refresh only — zero background services.

Direct USB & Wireless ADB Without Developer Options

Android's AdbService (AdbSettingsObserver and IAdbManager) does not gate on Settings.Global.DEVELOPMENT_SETTINGS_ENABLED — only the Settings UI hides those switches behind Developer Options.

With root granted, Relay controls debugging directly while keeping development_settings_enabled=0:

  • USB Debugging: toggles settings put global adb_enabled 1|0 directly.
  • Wireless Debugging: reads the active Wi-Fi AP BSSID via cmd wifi status (strictly validated against MAC format) and invokes IAdbManager.allowWirelessDebugging(true, bssid) via service call adb (transaction code resolved via reflection with AOSP ABI-stable fallback), atomically trusting the network in AdbKeyStore and starting adbd's TLS server with zero Settings navigation and zero system popups.
  • In-App First-Time Pairing: starts Android's native pairing server via IAdbManager.enablePairingByQrCode(serviceName, ephemeral6DigitCode) using a SecureRandom in-memory code, discovers the ephemeral pairing port over mDNS, and cleans up via IAdbManager.disablePairing().
  • Developer Options Bypass Indicator: displays live development_settings_enabled status on the Dashboard and Settings with a one-tap Turn off action when Developer Options is currently on.

Architecture

flowchart LR
    UI["Jetpack Compose UI (6 Screens)"] --> VM["RelayViewModel (StateFlow)"]
    VM --> ACM["AdbConnectionManager"]
    VM --> CM["ConnectionMonitor"]
    VM --> SM["SettingsManager (DataStore)"]
    ACM --> RM["RootManager"]
    ACM --> NM["NetworkManager"]
    ACM --> WDM["WirelessDebuggingManager"]
    ACM --> CG["CommandGenerator"]
    CM --> RM
    CM --> NM
    CM --> WDM
    WDM --> RM
    WDM --> NM
Loading
app/src/main/java/dev/relay/wirelessadb/
├── MainActivity.kt                      # Edge-to-edge host + Material 3 dynamic theme
├── RelayApplication.kt                  # Explicit RelayContainer dependency graph
├── core/
│   ├── model/
│   │   ├── Models.kt                    # Immutable domain models & state enums
│   │   └── EndpointValidator.kt         # IPv4, port, 6-digit code & shell safety validation
│   ├── root/RootManager.kt              # Root shell execution, provider detection & diagnostics
│   ├── network/NetworkManager.kt        # ConnectivityManager + cmd wifi status enrichment
│   ├── wireless/
│   │   ├── AdbParsers.kt                # Pure dumpsys, binder parcel, ss & /proc/net/tcp parsers
│   │   └── WirelessDebuggingManager.kt  # Direct USB/Wireless/Pairing automation + NsdManager
│   ├── commands/CommandGenerator.kt     # PowerShell, CMD & secure .bat script engine
│   ├── monitor/ConnectionMonitor.kt     # Live connection state, uptime & socket peer tracking
│   ├── settings/SettingsManager.kt      # DataStore preferences (never persists pairing codes)
│   └── adb/
│       ├── AdbConnectionManager.kt      # 6-step Prepare Connection orchestrator
│       └── TroubleshootingEngine.kt     # Live 10-scenario diagnostic evaluator
└── ui/
    ├── RelayViewModel.kt                # Reactive UI state, clipboard & export coordination
    ├── RelayApp.kt                      # Adaptive NavigationBar / NavigationRail + SAF export
    ├── theme/                           # Material You dynamic color, Pixel fallback & typography
    ├── components/                      # 8 custom composables + Windows command syntax highlighter
    └── screens/                         # Home, Setup, Windows Commands, Monitor, Settings, Troubleshooting

Platform Compatibility & Fallbacks

Environment Platform Behavior Relay Handling
Android 12–16 (API 31–36) adbd publishes TLS port to service.adb.tls.port and IAdbManager. Fast-path detection via system property + IAdbManager + dumpsys adb.
Android 17 (API 37) use_tls_lifecycle sends TLS port via adbdauth instead of service.adb.tls.port. Automatically resolves port via IAdbManager.getAdbWirelessPort(), dumpsys adb, mDNS, and adbd listening sockets.
Non-rooted / Root denied Apps cannot write Settings.Global or read /proc/<adbd_pid>/fd. Clean manual-assisted fallback: live IPv4 detection, mDNS discovery, validated manual IP/port/pairing inputs, and Settings shortcut.
Heavily modified OEM ROMs Custom AIDL methods could shift Binder transaction IDs. Resolves IAdbManager$Stub.TRANSACTION_* via reflection first; falls back to settings put global adb_wifi_enabled 1 with guided network-trust recovery.

Security & Privacy

  • Zero shell injection: local root execution uses strictly static platform commands (plus regex-validated MAC addresses and integer transaction codes); user inputs are never passed to su.
  • Validated Windows output: every IPv4, port (1..65535), and 6-digit pairing code is validated and screened against PowerShell/CMD metacharacters (& | ; < > ^ % $ \ " '`) before command generation.
  • Volatile pairing credentials: temporary 6-digit pairing codes exist strictly in volatile memory, are marked android.content.extra.IS_SENSITIVE on Android 13+ clipboard copies, and are never written to DataStore, logs, or exported .bat files (batch scripts prompt interactively via set /p or insert <PAIRING_CODE>).
  • Minimal attack surface: allowBackup="false", usesCleartextTraffic="false", dependenciesInfo and vcsInfo stripped from release APKs, zero telemetry, zero external network traffic, and zero background services.

Quick Start

  1. Install Relay on your Android 12+ device and grant superuser access in Magisk, KernelSU, or APatch.
  2. Connect your Android device and Windows PC to the same Wi-Fi network.
  3. Open Relay and tap Prepare Connection (Developer Options does not need to be enabled).
  4. Tap Copy Windows Commands (or Export .bat).
  5. Open Windows Terminal (PowerShell or CMD) on Windows, paste, and press Enter.
  6. (First-time PC only) Switch to First-time pairing, tap Start In-App Pairing (No Settings), run the generated adb pair command, then run adb connect.

Building & Release Signing

Prerequisites

  • JDK 17+ (CI uses Temurin JDK 21)
  • Android SDK with Platform API 36 (minSdk = 31, compileSdk = 36, targetSdk = 36)
  • Android Studio or the included Gradle wrapper (./gradlew)

Local Debug & Test Commands

# Run JVM unit tests (CommandGenerator, EndpointValidator, AdbParsers)
./gradlew testDebugUnitTest

# Run Android Lint (0 errors, 0 warnings)
./gradlew lintDebug

# Build debug APK
./gradlew assembleDebug

# Build R8-minified release APK (unsigned unless keystore is configured)
./gradlew assembleRelease

Release Signing

Copy keystore.properties.example to keystore.properties (git-ignored) and fill in your release keystore details:

storeFile=/path/to/relay-release.jks
storePassword=your-store-password
keyAlias=relay
keyPassword=your-key-password

Alternatively, supply environment variables (used by .github/workflows/release.yml when pushing v* tags):

  • RELAY_KEYSTORE_PATH (or RELAY_KEYSTORE_BASE64 secret in GitHub Actions)
  • RELAY_KEYSTORE_PASSWORD
  • RELAY_KEY_ALIAS
  • RELAY_KEY_PASSWORD

To test the R8-minified release build on a local device without a production keystore:

./gradlew assembleRelease -PrelayDebugSignRelease=true
adb install -r app/build/outputs/apk/release/app-release.apk

License

Licensed under the Apache License 2.0.

About

Native Android 12–17 Wireless ADB Manager — root-powered USB & Wireless Debugging automation without Developer Options, plus Windows PowerShell, CMD & .bat command generation

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages