Smart Reconnection System
How Android DEX detects and handles connection loss through a two-phase recovery strategy without affecting active applications.
Overview
graph TD
Monitor[Connection Watchdog] -->|Disconnection Detected| Quick[Phase 1: Quick Reconnect]
Quick -->|Failure| Full[Phase 2: Full Restart]
Full -->|Success| Idle[Return to Normal Operation]
Quick -->|Success| Idle
Full -->|All Attempts Failed| Error[Permanent Error State]
Once the boot sequence completes, ReconnectionManager monitors both Logic Engine (JAR) and Feature Hub (APK) connections independently.
Phase 1 — Quick Reconnect
Triggered: Immediately on first disconnection detected.
- Re-establish ADB Bridge:
adb connectfollowed by port reverse forwarding. - Wait for Handshakes: Attempts to restore existing sessions.
Phase 2 — Full Restart
Triggered: Quick reconnect failed after a 5s attempt.
- Kill Stale Processes: Terminates existing processes on both sides.
- Full Redeployment: Re-upload service modules and re-launch services.
- Session Resumption: Re-establishes all communication channels.
Reconnecting Overlay
A full-screen widget appears during recovery, showing the status of each component (JAR, APK) and a human-readable progress message. While visible, user interaction with the desktop is temporarily disabled.