Server &
Network Layer

The backbone of the application. A hybrid architecture combining a local HTTP control bridge with specialized WebSocket and TCP channels for real-time bidirectional communication.

Dart Shelf Server WebSockets Async TCP
๐Ÿ–ฅ๏ธ
โšก SocketManager
๐Ÿ“ž CallUI
๐Ÿ“ฑ DexTCP

Main Server (Windows)

Local Control & Bridge Server โ€ข Dart Shelf โ€ข JSON

๐Ÿ›ก๏ธ Secure

Acts as the single source of truth, coordinating Android background services, ADB connections, and the Flutter UI.

Device & System Discovery

GET / Serves the local HTML dashboard interface.
GET /ping Health check to verify server status.
Response Model { "status": "success" }
POST /add_me_to_server Registers Android device (IP, ID, Fingerprint).
Request Payload Model { "android": { "android_id": "7b74e4bf673dec04", "device_name": "OnePlus 11 5G", "ip_address": "192.168.29.168", "manufacturer": "OnePlus", "product": "string", "model": "CPH2447", "wallpaper": "base64_string...", "pairing_code": "739129", "google_email": "user@example.com", "google_display_name": "Adb Devices Manager", "google_profile_image_base64": "base64_string...", "device_fingerprint": "OnePlus/CPH2447/...", "id": "19def77c" } } Response Model { "status": "success" }
GET /devices Returns all connected devices info.
Response Model { "status": "success", "devices": [ { "name": "OnePlus CPH2447", "id": "OnePlus|CPH2447|qcom...", "isAdbConnected": true, "isAppConnected": false, "isDefault": true, "ip": "192.168.29.168", "wifiName": "Mobile Network", "lastConnected": "2025-12-17T23:03:40...", "device_id": "19def77c", "device_image_id": "2", "device_model": "CPH2447", "android_version": "16", "manufacturer": "OnePlus", "device_name": "OnePlus 11 5G", "android_id": "7b74e4bf673dec04", "manufacturer_name": null, "product_name": null, "model_name": null, "wallpaper": "/9j/4AAQSkZJRg...", "pairing_code": "739129", "google_email": "user@example.com", "google_display_name": "Adb Devices Manager", "google_profile_image_base64": "/9j/4AAD//Z", "device_fingerprint": "OnePlus/CPH2447/...", "isAdbProgress": false, "isAPPProgress": false, "totalAppCount": null, "installedApps": [] } ] }
GET /get_device_info Returns Windows host identity (Hostname, IP).
Response Model { "status": "success", "windows": { "hostname": "DESKTOP-VA2142V", "ip": "192.168.29.193", "full_name": "DELL", "microsoft_email": "user@example.com" } }

Media & Actions

POST /Run_audio_bordcast Starts audio streaming (Fast/High Quality).
Request Payload Model { "ip": "192.168.29.168", "command": "fast", // or "high" "getDeviceFullInfo": { "id": "19def77c" } } Response Model { "status": "success", "message": "Audio broadcast started", "ip": "192.168.29.168", "mode": "fast" }
POST /get_device_wallpaper Returns device wallpaper as Base64.
Request Payload Model { "id": "19def77c" } Response Model { "status": "success", "wallpaper": "/9j/4AAQSkZJRg.....QQSEf/2Q==" }
POST /get_google_info Returns Google account details (Email, Photo).
Request Payload Model { "id": "19def77c" } Response Model { "status": "success", "google_email": "user@example.com", "google_display_name": "Adb Devices Manager", "google_profile_image_base64": "/9j/4AAD//Z" }

Windows Integration & Device Control

POST /windows/copy_to_clipboard Updates the Windows clipboard with text.
Request Payload Model { "text": "Copied text message" } Response Model { "status": "success", "message": "Copied to clipboard" }
POST /windows/open_url Opens a valid URL on Windows default browser.
Request Payload Model { "url": "https://example.com" } Response Model { "status": "success", "message": "URL opened" }
POST /get_functions_status Checks status of mirroring & control.
Request Payload Model { "ip": "192.168.29.168" } Response Model { "status": "success", "functions": { "Screen Mirroring": true, "Audio Cast": false, "Input Control": false } }
POST /run_function Toggles control functions (Mirror/Audio/Input).
Request Payload Model { "ip": "192.168.29.168", "mode": "Screen Mirroring" } Response Model { "status": "success", "message": "Function run" }

App Bridge Socket

Persistent Connection โ€ข Hardware Identity โ€ข Logic Relay

๐Ÿ›ก๏ธ Secure

The primary persistent channel between the Android background service and the desktop bridge. for multiple devices purpose we will use this socket only for live app connection

If, in any case, Windows shuts down, turns off, or becomes disconnected, the Android socket will also be disconnected automatically. Android App will Kill it self For Battery Optimization

WS ws://$ip:$port Central stateful communication channel.

Handshake & Device Identity

type: "register" Authenticates device using hardware fingerprint.
Registration Payload (Android โ†’ Desktop) { "type": "register", "id": "Build.MANUFACTURER|Build.MODEL|...", "ip": "$hidden_address" }

Call Manager 1

Start call_manager.exe for each Ip

Core WebSocket server for real-time app communication. Enforces Single Active Connection per IP (except localhost), ensuring strict 1:1 state mapping.

WS ws://ip:$port Primary app connection channel.

Client โ†’ Server Events

type: "call_event" Forwards call state to CallManager.
Call Event Payload { "type": "call_event", "event_type": "incoming_call", "caller_number": "+1234567890", "device_ip": "$hidden" }

Server Methods (Dart)

sendTo(ip, msg) sendIpRaw(ip, json) broadcast(msg, {excludeIp})

Call Manager 2

Localhost โ€ข Controller for each call_manager.exe

A specialized, ephemeral socket server established only when the Call UI window is active. It ensures secure, 1:1 data syncing between the specific user context and the UI window.

Detailed Protocol Exchange

CLIENT โ†’ REGISTER_CALL_UI Full handshake identifying device and call context.
Registration Payload { "type": "register_call_ui", "id": "192.168.1.5_+1234567890", "ip": "192.168.1.5", "phoneNumber": "+1234567890", "deviceDisplayName": "OnePlus 11 5G", "callerName": "John Doe", "isIncoming": "1" }
SERVER โ†’ CALL_UPDATE In-call state updates (e.g. call accepted/ended).
Update Message { "type": "call_update", "ip": "192.168.1.5", "number": "+1234567890" }

AdbTcpServer (Dex)

Global TCP Service โ€ข App Logic Sync

A global service providing deep integration for Android Dex mode. It broadcasts UI events, system toggles, and manages high-performance app audio streams across all connected clients.

System Control & Navigation

GET "go home" | "go back" Triggers Android system navigation events.
Response Model (Server -> Client) { "type": "go home", "ok": true }
POST "toggleBluetooth" Remotely toggles hardware Bluetooth state.
Response Model (Server -> Client) { "type": "toggleBluetooth", "status": true }

App Audio Streaming Protocol

CMD req_app_audio={pkg} Requests high-performance audio for package.
Server Response (Server -> Client) { "type": "set_app_audio", "app": "com.spotify.music", "status": true }

App Data Sync (Client โ†’ Server)

SYNC sync_all_favorites Syncs user app favorites to the server.
Payload Model { "type": "sync_all_favorites", "data": [ { "name": "Spotify", "package": "com.spotify.music" }, { "name": "YouTube", "package": "com.google.android.youtube" } ] }
CLICK Side Bar click event Reports UI interactions in Dex Sidebar.
Payload Model { "type": "Side Bar click event", "data": "open app" }
UPDATE add_new_recent_app Reports an app launch to the global state.
Payload Model { "type": "add_new_recent_app", "package": "com.whatsapp", "label": "WhatsApp" }

Main Server (Android)

Device-Side Server โ€ข Local Network Only โ€ข Secured

๐Ÿ›ก๏ธ SECURE

The Android device hosts a local HTTP server to handle requests from the Windows desktop app. All routes are local-network only and most require a security .

Health & Connection

GET /ping Check if the server is running.
Response Model { "status": "success", "timestamp": 1730000000000, "message": "Server is running" }
GET /i_am_connected_to Returns the currently connected Windows server IP
(For mutiple device support).
Response Model (Connected) { "status": "success", "connected": true, "server_ip": "192.168.x.x", "timestamp": 1730000000000 }
GET /disconnect Disconnects and gracefully closes the Android app.
Response Model { "status": "success", "message": "App will disconnect and close shortly.", "timestamp": 1730000000000 }

Socket Services

POST /start_socket_io_for_media_sessions Starts media session socket streaming.
Request Payload { "ip": "192.168.x.x" } Response Model { "status": "success", "timestamp": 1730000000000, "message": "Socket service started successfully." }
POST /start_socket_io_for_notifications Starts notification streaming socket.
Request Payload { "ip": "192.168.x.x" } Response Model { "status": "success", "timestamp": 1730000000000, "message": "Notification socket service started successfully." }

File Transfer

POST /upload_file Uploads a file to Android Downloads folder.
Body (Binary Stream) <Raw File Bytes> Response Model { "status": "success", "message": "File downloaded successfully", "filePath": "/storage/emulated/0/Download/example.zip", "fileSize": 12.5, "duration": 3.2, "speedMBps": 3.9 }

App Data API

/app_data โ€ข Installed Apps & Metadata

๐Ÿ’Ž TRUSTED
GET /app_data/get_all_apps Returns all launchable apps with metadata and icons.
Response Model { "status": "success", "count": 125, "apps": [ { "app_name": "WhatsApp", "package_name": "com.whatsapp", "version_name": "2.24.1", "is_system": false, "is_home_app": true, "source_dir": "/data/app/~~xyz/base.apk", "icon_base64": "iVBORw0KGgoAAA..." } ] }
GET /app_data/total_app_count Returns the total number of launchable apps.
Response Model { "status": "success", "total_app_count": 125 }

Call Settings API

/call_settings โ€ข Call Logs, Control & Dialer Operations

๐Ÿ›ก๏ธ Secure
GET /call_settings/get_all_calls Returns full call history with IDs.
Response Model { "status": "success", "count": 20, "calls": [ { "id": 42, "name": "John Doe", "number": "+911234567890", "type": "incoming", "timestamp": 1730000000000, "duration_seconds": 120 } ] }
GET /call_settings/get_contact_calls Returns call logs filtered by phone number.
Request Params ?number=12345 Response Model { "status": "success", "count": 3, "calls": [ { "id": 12, "name": "Unknown", "number": "12345", "type": "missed", "timestamp": 1730000000000, "duration_seconds": 0 } ] }
GET /call_settings/make_call Initiates a phone call.
Request Params ?number=1234567890 Response Model { "status": "success", "message": "Placing call to 1234567890" }
GET /call_settings/delete_call Delete a single call log or all call logs.
Request Params ?id=42 (Optional, delete all if missing) Response Model { "status": "success", "message": "Deleted call log with id: 42", "rows_deleted": 1 }
GET /call_settings/end_call Ends the currently ongoing call.
Response Model { "status": "success", "message": "Call ended successfully" }
GET /call_settings/answer_call Answers a ringing call.
Response Model { "status": "success", "message": "Answered incoming call" }

Contacts API

/contacts โ€ข Address Book Access

๐Ÿ›ก๏ธ PRIVATE
GET /contacts/get_total Get total number of contacts.
Response Model { "status": "success", "total_contacts": 50 }
GET /contacts/get_all Get all contact details with photo.
Response Model { "status": "success", "count": 1, "contacts": [ { "id": "1", "name": "Alice", "numbers": ["+123456789"], "photo_base64": "iVBORw0KGg..." } ] }

File Manager API

/file_manager โ€ข Filesystem Operations

๐Ÿ›ก๏ธ Secure
GET /file_manager/list_dir List all files/folders in a directory.
Request Params ?path=/storage/emulated/0 (Optional) Response Model { "status": "success", "path": "/storage/emulated/0", "count": 10, "files": [ { "name": "DCIM", "path": "/storage/emulated/0/DCIM", "is_directory": true, "size": 0, "last_modified": 1730000000, "type": "directory" } ] }
GET /file_manager/get_file Get text file content.
Request Params ?path=/sdcard/note.txt Response Model { "status": "success", "path": "/sdcard/note.txt", "content": "Hello World" }
GET /file_manager/file_info Get metadata (detailed).
Request Params ?path=/sdcard/photo.jpg Response Model { "status": "success", "info": { ...file_object... } }
GET /file_manager/delete Delete file/folder recursively.
Request Params ?path=/sdcard/trash Response Model { "status": "success", "message": "Deleted: /sdcard/trash" }
GET /file_manager/rename Rename / Move file.
Request Params ?old_path=...&new_path=... Response Model { "status": "success" }
GET /file_manager/create_folder Create new folder.
Request Params ?path=/sdcard&name=NewFolder Response Model { "status": "success" }
GET /file_manager/search Search (files + folders) with full info.
Request Params ?query=invoice&path=/sdcard Response Model { "status": "success", "query": "invoice", "count": 5, "results": [ ...file_objects... ] }
GET /file_manager/open_with Open file with system app.
Request Params ?path=/sdcard/video.mp4 Response Model { "status": "success", "message": "Opened: /sdcard/video.mp4" }
GET /file_manager/copy_move Copy or Move files.
Request Params ?src=...&dest=...&mode=copy|move Response Model { "status": "success", "message": "Operation completed: copy" }
POST /file_manager/upload Upload file.
Request Payload Multipart: file=..., target_path=..., file_name=... Response Model { "status": "success", "message": "Uploaded uploaded_file", "saved_name": "uploaded_file", "saved_path": "/storage/emulated/0/uploaded_file" }

Photo Data API

/photo_data โ€ข Media Library & Thumbnails

๐Ÿ›ก๏ธ Secure

Provides deep access to the Android MediaStore gallery. Supports pagination, album filtering, and high-performance thumbnail generation on-the-fly.

GET /photo_data/get_photos Returns paginated list of all photos.
Request Params ?page=1&limit=30 Response Model { "status": "success", "page": 1, "limit": 30, "count": 30, "photos": [ { "name": "IMG_2024.jpg", "path": "/sdcard/DCIM/Camera/...", "folder_name": "Camera", "date_taken": 1730000000000, "size": "2.4 MB", "thumbnail_base64": "iVBORw0KG..." } ] }
GET /photo_data/get_full_photo Returns full image as Base64.
Request Params ?path=/sdcard/DCIM/Camera/IMG_1.jpg Response Model { "status": "success", "path": "/sdcard/DCIM...", "image_base64": "/9j/4AAQ..." }
GET /photo_data/total_photo_count Returns total number of photos on device.
Response Model { "status": "success", "total_photo_count": 1254 }
GET /photo_data/get_all_folders Returns all media albums/folders.
Response Model { "status": "success", "folder_count": 5, "folders": [ { "folder_name": "Camera" }, { "folder_name": "Screenshots" } ] }
GET /photo_data/get_folder_photos Returns photos for a specific album.
Request Params ?folder_name=Camera&page=1&limit=30 Response Model { "status": "success", "folder_name": "Camera", "count": 30, "photos": [ ... ] }
GET /photo_data/total_folder_photos_count Get photo count for a specific album.
Request Params ?folder_name=Camera Response Model { "status": "success", "total_folder_photos_count": 450 }

SMS API

/sms_settings โ€ข Messaging & Conversations

๐Ÿ›ก๏ธ Secure

Enables full interaction with the device's SMS database. Supports reading the entire inbox/sent history, sending new messages, and deleting records.

GET /sms_settings/get_all_sms Fetches full SMS history from device.
Response Model { "status": "success", "count": 150, "messages": [ { "address": "+1234567890", "body": "Hello from ADB Manager", "timestamp": 1730000000000, "type": "inbox" } ] }
POST /sms_settings/send_sms Sends a text message to a specified number.
Request Params ?number=+1234567890&message=Hello Response Model { "status": "success", "sent_to": "+1234567890", "message": "Hello" }
GET /sms_settings/delete_sms Deletes a specific SMS message by ID.
Request Params ?id=123 Response Model { "status": "success", "deleted_count": 1 }

FileUploadServer (File Transfer)

HTTP + WebSocket โ€ข File Streaming โ€ข Real-time Sync

A hybrid server combining HTTP file transfer endpoints with WebSocket for real-time device registration and state sync. Handles multipart uploads, binary streaming, and Flutter โ†” Server communication.

WebSocket Connection

WS ws://$ip:$port Persistent WebSocket for device registration & state.
type: "register" Registers connected device with name and IP.
Registration Payload (Device โ†’ Server) { "type": "register", "name": "OnePlus 11 5G" } Server Action // Device added to controller.connectedDevices // {socket, {name, ip}} stored for tracking

File Upload Routes

GET / Serves the file upload HTML page.
GET /upload_file Serves the upload page UI.
POST /upload_file Handles multipart file uploads from web/Android.
Request Headers { "Content-Type": "multipart/form-data; boundary=...", "google_display_name": "User Display Name" } Response Model { "success": true, "file_name": "document.pdf", "bytes": 1048576 }
POST /download_file Streams a file for download (binary).
Request Payload Model { "file_path": "C:\\Users\\DELL\\Downloads\\document.pdf" } Response Headers { "Content-Type": "application/octet-stream", "Content-Disposition": "attachment; filename=\"document.pdf\"", "Content-Length": 1048576, "Cache-Control": "no-cache, no-store, must-revalidate" }

Flutter Integration

POST /submit Receives file paths from Flutter for sending to devices.
Request Payload Model { "file_paths": [ "C:\\Users\\DELL\\Documents\\file1.pdf", "C:\\Users\\DELL\\Documents\\file2.jpg" ], "is_send_to": true } Response Model { "ok": true, "received_count": 2, "file_paths": [ "C:\\Users\\DELL\\Documents\\file1.pdf", "C:\\Users\\DELL\\Documents\\file2.jpg" ] } Internal Actions // 1. Brings window to front via windowManager // 2. Fetches available devices from Flask backend // 3. Updates controller.fileList with new entries // 4. Each file stored with status: "Ready"
GET /toggle_file_transfer_visibility Toggles the file transfer window visibility.(Alt + F)
Response "Toggled" Behavior // If window visible โ†’ hide() // If window hidden โ†’ show() + focus()

Legacy Binary Upload (Flutter Client)

POST /upload_file Legacy binary upload fallback (no multipart boundary).
Request Headers { "filename": "report.pdf", "content-length": 2097152, "x-forwarded-for": "192.168.29.168" } Response Model { "success": true, "file_name": "report.pdf" }

Static File Serving

GET /{filename}.html | .css | .js Serves HTML, CSS, JS from assets folder.
Content Types { ".html": "text/html", ".css": "text/css", ".js": "application/javascript" } Asset Location "lib/html_files/{filename}"

Notification Server (HTTP)

UI Toggle Control โ€ข Stream Events

A singleton HTTP server that manages notification UI visibility toggles. Exposes a stream controller for real-time UI state updates across the application.

HTTP Endpoints

POST /toggle_notification_ui Toggles the notification overlay UI visibility.(Alt + N)
Request Payload Model (Optional) { "toggle_timestamp": 1703097600000 } Response Model { "status": "success", "message": "Toggle notification UI processed successfully", "timestamp": 1703097600123 } Stream Event Emitted { "type": "toggle_ui", "timestamp": 1703097600123, "request_timestamp": 1703097600000 }

Stream Controller

STREAM notificationUpdates Broadcast stream for UI toggle events.
Stream Type Stream<Map<String, dynamic>> // Broadcast stream - multiple listeners supported Event Model { "type": "toggle_ui", "timestamp": 1703097600123, "request_timestamp": 1703097600000 // from request }

Notification TCP Server

LAN Accessible โ€ข JSON Line Protocol

A raw TCP socket server bound to the local network IP for receiving notification data from Android devices. Uses JSON line protocol (newline-delimited JSON) for reliable message parsing.

Client Connection Flow

CONNECT Client โ†’ Server Android device connects via TCP socket.
Connection Tracking // Server logs: "๐Ÿ“ก Client connected: 192.168.29.168 (total=1)" // Client stored in _clients list // Buffer initialized for JSON line parsing
Incoming JSON Message Parsed JSON objects emitted to stream.
Message Format (Android โ†’ Server) { "type": "notification", "title": "New Message", "body": "You have a new notification", "package": "com.whatsapp", "timestamp": 1703097600000 }\n โ† newline delimiter required Stream Output // notificationsStream emits: { "type": "notification", "title": "New Message", "body": "You have a new notification", ... }
DISCONNECT Client Disconnection Automatic cleanup and exit on empty clients.
Disconnect Behavior // On client disconnect: "๐Ÿ”Œ Disconnected: 192.168.29.168:54321" "๐Ÿงน Cleaned up client (remaining=0)" // โš ๏ธ If no clients remain โ†’ exit(0) "๐Ÿšช No clients remaining โ€” exiting immediately."

Outgoing Commands

SEND sendCommandToAll(cmd) Broadcast JSON command to all connected clients.
Command Format (Server โ†’ Clients) { "action": "dismiss", "notification_id": "12345" }\n Broadcast Log "๐Ÿ“ค Sent to 2 clients: {action: dismiss, ...}"

Media DataManager (HTTP)

Window Visibility โ€ข Media Control

A singleton HTTP server for controlling the media playback window visibility. Integrates with window_manager to show/hide the media overlay UI.

GET /toggle_media_visibility Toggles the media window show/hide state.(Alt + M)
Response Model (Success) { "status": "success", "message": "Media window visibility toggled", "is_visible": true } Behavior // If window is visible โ†’ windowManager.hide() // If window is hidden โ†’ windowManager.show() // Returns the NEW visibility state Response Model (Error) { "status": "error", "message": "Error toggling visibility: $error" }

Media TCP Server

Media Sync โ€ข Smart Caching

A high-performance TCP socket server for streaming media metadata from Android devices. Features intelligent caching, debounced updates, and IP-based client grouping for reliable playback state sync.

Client Connection & IP Grouping

CONNECT Client โ†’ Server Android device connects, replacing previous connection from same IP.
Connection Behavior // New client from same IP replaces old connection: "๐Ÿ”Œ Client connected: 192.168.29.168:54321" // _clientGroups[ip] = [newSocket] // Previous sockets from same IP destroyed

Media Data Types

type: "core_info" Basic playback metadata (title, artist, state).
Payload Model (Android โ†’ Server) { "type": "core_info", "package_name": "com.spotify.music", "title": "Blinding Lights", "artist": "The Weeknd", "album": "After Hours", "is_playing": true, "position": 45000, "duration": 200000 }
type: "app_icon" Application icon as Base64 image.
Payload Model (Android โ†’ Server) { "type": "app_icon", "package_name": "com.spotify.music", "icon_base64": "/9j/4AAQSkZJRgABAQAA..." }
type: "album_art" Album artwork as Base64 image.
Payload Model (Android โ†’ Server) { "type": "album_art", "package_name": "com.spotify.music", "art_base64": "/9j/4AAQSkZJRgABAQAA..." }
type: "remove_info" Clear media session for a package.
Payload Model (Android โ†’ Server) { "type": "remove_info", "package_name": "com.spotify.music" } Callback Emitted // onMediaUpdate called with: { "package_name": "com.spotify.music", "type": "remove_info" }

Smart Cache System

CACHE _mediaCache Intelligent per-package media data caching.
Cache Structure { "com.spotify.music": { "core_info": { /* title, artist, etc */ }, "app_icon": { /* icon_base64 */ }, "album_art": { /* art_base64 */ } }, "com.google.android.youtube.music": { ... } } Merge Behavior // After 150ms debounce, all cached data merged: { "package_name": "com.spotify.music", "title": "Blinding Lights", "artist": "The Weeknd", "icon_base64": "...", "art_base64": "..." } // โ†’ onMediaUpdate?.call(merged)

Outgoing Commands

SEND sendCommandToAll(cmd) Broadcast command to all connected clients.
Command Examples (Server โ†’ Android) // Play/Pause { "action": "play" } { "action": "pause" } // Skip tracks { "action": "next" } { "action": "previous" } // Seek to position { "action": "seek", "position": 60000 }
SEND sendCommandToIp(ip, cmd) Send command to specific device by IP.
Targeted Command // Send to specific device: sendCommandToIp("192.168.29.168", { "action": "pause" });

Disconnect Handling

DISCONNECT _handleDisconnect(ip) Cleanup on client disconnect with cache clear.
Disconnect Actions // 1. Destroy all sockets for IP // 2. Remove from _clientGroups // 3. Clear entire _mediaCache // 4. Emit remove_All event: { "package_name": "192.168.29.168", "type": "remove_All" } // โš ๏ธ If no clients remain โ†’ exit(0)


"coreinfo" | "core_info" โ†’ core_info "appicon" | "app_icon" โ†’ app_icon "albumart" | "album_art" โ†’ album_art "removeinfo" | "remove_info" โ†’ remove_info