Project Drift is an ambitious, open-source development project designed to bridge the ecosystem gap between desktop operating systems (Apple macOS / Microsoft Windows) and Google Android. Its primary objective is to create a lightweight, robust, hardware-independent "Universal Control" pipeline that allows a single mouse and keyboard to cross operating system boundaries seamlessly to control an Android target.
- 🍏 macOS Transmitter (Swift / SwiftUI): AirDrift
- 🤖 Android Receiver (Kotlin / Jetpack Compose): DroidDrift
- 🪟 Windows Transmitter (Upcoming):
WinDrift(Planned desktop transmitter client)
Unlike official ecosystem tools that restrict layout topology or lock software to a single brand ecosystem, Drift provides a unified, cross-platform workspace. By establishing DroidDrift as the central target hub, a user can transition control dynamically from their primary computer, regardless of whether it is a Mac or a Windows PC.
- The Apple/Android Chain: The cursor moves across the MacBook display and instantly wakes up the native Android pointer on a phone or tablet. Meanwhile still supporting the native Universal Control between the MacBook and iPad.
[ iPad (Native) ] <------- [ MacBook (AirDrift) ] -------> [ Android Device (DroidDrift) ]
- The PC Desktop Chain: The cursor hits the boundary of a multi-monitor Windows workstation setup and seamlessly warps directly onto a side-car Android tablet.
[ Windows PC (WinDrift) ] ------------------------------> [ Android Device (DroidDrift) ]
To bypass fragile, closed-source system frameworks, Drift environments run entirely in user space utilizing rock-solid network sockets, accessibility permissions, and official operating system input hooks.
+-------------------------------------------------------------+
| macOS (AirDrift) |
| +-------------------------------------------------------+ |
| | CGEventTap Interception | |
| +---------------------------+---------------------------+ |
| | (Deltas / Coordinates) |
| v |
| +-------------------------------------------------------+ |
| | WebSocket Client | |
| +---------------------------+---------------------------+ |
+------------------------------|------------------------------+
| (JSON Stream via Wi-Fi/USB)
v [Port 8080]
+-------------------------------------------------------------+
| Android Device (DroidDrift) |
| |
| +-------------------------------------------------------+ |
| | InputAccessibilityService (WebSocket Server) | |
| | - Port 8080: Ingests macOS mouse/keyboard events | |
| | - Updates floating UI cursor position overlay | |
| | - Tracks boundary exits & temporal cooldowns | |
| +---------------------------+---------------------------+ |
| | |
| +-----------------------+ |
| | (Fallback Mode) | (TCP) | [Port 9000]
| v v |
| +-------------+------------+ +-----+-----+|
| | Accessibility Click/Drag | | AdbMain ||
| | (dispatchGesture API) | | (Daemon) ||
| +--------------------------+ +-----+-----+|
| | |
| v |
| +-----+-----+|
| | IInputMgr ||
| | Binder ||
| | Injection ||
| +-----------+|
+-------------------------------------------------------------+
- Input Interception (
CGEventTap): Intercepts low-level physical mouse movements (mouseMoved) and keyboard states (keyDown/keyUp) before they hit the window server. - Edge Locking: Swallows the local system cursor once it hits the virtual boundary, freezing it in place while translating raw relative movement vectors into structured JSON tracking payloads.
- Lock Cooldown: Incorporates a 500ms lock cooldown to prevent pending queue events from immediately re-locking the cursor when returning control to the Mac, resolving recursive looping.
Rather than a single server causing port conflicts, DroidDrift uses a dual-mode, host-client architecture:
InputAccessibilityService(App-Space WebSocket Server - Port 8080):- Receives events from the macOS transmitter.
- Manages absolute screen coordinates and renders a beautiful iPadOS-style circular cursor overlay.
- Triggers the edge-exit transition to restore Mac cursor focus with a 500ms exit cooldown.
AdbMain(Privileged ADB-Shell Daemon - Port 9000):- Bypasses standard Android restriction on
INJECT_EVENTSby running in the ADB shell context (UID 2000) using Android'sapp_processcommand. - Connects to the local binder
"input"service viaServiceManager.getService("input")to retrieveIInputManagerreflection-free. - Receives action payloads from
InputAccessibilityServiceover a local TCP loopback (port 9000) and injects touch/pointer events at the driver level.
- Bypasses standard Android restriction on
- Dual-Mode Graceful Fallback:
- If the ADB daemon is not running (e.g., disconnected USB/wireless debug), the App-Space service automatically falls back to simulating clicks and scrolls globally using the accessibility service's
dispatchGesture()API.
- If the ADB daemon is not running (e.g., disconnected USB/wireless debug), the App-Space service automatically falls back to simulating clicks and scrolls globally using the accessibility service's
- iPadOS-Style Floating Cursor: Uses the
SYSTEM_ALERT_WINDOWpermission to draw a beautiful, modern, translucent blue circular pointer with a white border and drop shadow. This cursor is overlayed on top of all Android apps and updates dynamically, solving the issue of One UI hiding the native pointer when no physical USB mouse is plugged in. - Glassmorphic Settings Setup: The Jetpack Compose UI has been overhauled to present a premium glassmorphic checklist screen. It dynamically detects permission states, displays real-time connection info (local IP, socket state), and guides the user through enabling overlay and accessibility services.
- macOS App:
AirDrift(Wireless, lightweight background utility for Mac) - Android App:
DroidDrift(The Android accessibility service & privileged injector daemon)
- Build and Install DroidDrift APK:
adb push DroidDrift/app/build/outputs/apk/debug/app-debug.apk /data/local/tmp/
- Grant Permissions:
- Open DroidDrift and toggle the glassmorphic checklist settings to grant Display Over Other Apps (Overlay) and enable the DroidDrift Accessibility Service.
- Spawn Privileged ADB Daemon (Optional but Recommended for full injection):
adb shell "export CLASSPATH=/data/local/tmp/app-debug.apk; exec app_process /data/local/tmp com.drift.droiddrift.AdbMain 1080 2320" - Port Forward & Run macOS Transmitter:
adb forward tcp:8080 tcp:8080 cd AirDrift swift run AirDrift localhost
- 🪟 WinDrift (Upcoming): Engineering a lightweight Windows transmitter client to capture desktop mouse and keyboard events at the system level and stream them to the
DroidDriftserver, enabling Windows-to-Android continuity for PC workspaces.
- Source & Attribution: Project Drift is an original cross-platform control architecture designed and built by me. It accesses standard macOS APIs (
CGEventTap) and Android system frameworks (AccessibilityServiceand driver-level binder"input"services). - Motive: Created as a personal utility to bridge the OS interoperability gap between macOS/Windows computers and Android targets, avoiding brand-specific proprietary lock-in.
- Modifications: Created the dual-layer network control flow, integrating the Swift-based transmitter and Kotlin-based receiver.
- Limitations:
- Requires active USB or Wireless ADB debugging configured to run the privileged background daemon (
AdbMain) for raw, driver-level mouse injection. - The accessibility fallback input mode (
dispatchGesture()) exhibits movement lag and is not optimized for rapid cursor tracking. - Limited to basic pointer coordinates, click gestures, and keyboard typing. Entangled multi-touch gestures, drag-and-drop file transfers, and unified clipboard features are not yet implemented.
- Requires active USB or Wireless ADB debugging configured to run the privileged background daemon (
- Tooling & AI Usage: This codebase has been developed completely using the Antigravity CLI assistant, as I do not have prior experience with Swift or Kotlin development. All core application logic, system API integration, and user interfaces were scaffolded, refined, and debugged through iterative AI pair-programming sessions.