⚙️ Boot & Initialization Flow

March 29, 2026 · View on GitHub

Back to README

Every launch of Android DEX executes a precise, sequenced initialization protocol. This document covers every step, its purpose, what triggers it, and how it maps to the UI progress indicators.


Progress Bars

The boot screen shows two independent progress bars fed by separate event streams:

BarSourceWhat It Tracks
JARJarManager event streamLogic Engine deployment + handshake
APPAppManager event streamOverall system initialization

Both bars must reach 1.00 (100%) before the desktop UI unlocks.


Full Initialization Sequence

APP Bar (Overall System)

ProgressUser MessageWhat's Actually Happening
0.02Starting ADB server…adb start-server
0.10Connecting to Android device…adb connect + device link
0.20Device connected — network bridge configuredadb reverse on all required ports
0.28Starting local communication servers…Binds 4 TCP/WS servers on Windows
0.38Deploying service module to Android device…Kicks off JAR deployment (JAR bar begins)
0.55Verifying companion app on device…adb shell pm list packages
0.65Companion app not found — installing now…adb install (only if missing)
0.72Launching Android companion services…adb shell am start ServerStartService
0.84Waiting for background service to connect…Blocks on jar.hello TCP handshake (15s timeout)
0.93Waiting for companion app to connect…Blocks on apk.hello WebSocket handshake (15s timeout)
0.97Activating media and notification services…Sends start commands through APK channel
1.00System readyDesktop UI unlocked

JAR Bar (Logic Engine Deployment)

The JAR bar runs concurrently with APP steps 0.38 → 0.84. It tracks the Logic Engine sub-process independently.

ProgressUser MessageWhat's Actually Happening
0.00Preparing service deployment…stopJar() — kills any existing local process
0.15Stopping previous service on device…adb shell kill [pid] — clears old JAR process on Android
0.30Locating service module…Checks androiddex.jar exists in local install directory
0.50Uploading service module to device…adb push androiddex.jar /data/local/tmp/ (slowest step)
0.70Service module uploaded successfullyPush confirmed, file verified
0.82Launching service runtime on device…adb shell app_process ... JarMain
0.92Service is running — awaiting connection…JAR process started, waiting for TCP connect-back
1.00Service connected — handshake confirmedjar.hello received; JAR bar fully complete

Pre-Boot: Device Selection

Before the initialization sequence begins, the system resolves which device to target:

App launched

     ├─ CLI args provided?
     │       │
     │       ├─ --usb  → target USB device (-d transport)
     │       └─ <ip>   → target Wi-Fi device (ip:5555)

     └─ No args → Auto-Detect

             ├─ 0 devices found → needsDeviceSelection = true
             │   └── ADB Manager Dialog opens (user picks)

             ├─ 1 device found → use it automatically

             └─ 2+ devices found → needsDeviceSelection = true
                 └── ADB Manager Dialog opens (user picks)

→ See Device Manager for the full dialog flow.


Error Behaviour During Boot

At any step failure, the affected bar stops at its current value and an error panel appears below the progress bars. If the failure is connection-related:

  • A glowing "Open ADB Manager — Select Device" button appears
  • Clicking it opens the device picker without restarting the app
  • After device selection, the boot sequence retries from the beginning with a clean state

→ See Error Handling for the full error message reference.


Timeout Policy

HandshakeTimeoutError Message
JAR TCP (jar.hello)15 seconds"Background service timed out. The device may be busy or unreachable."
APK WebSocket (apk.hello)15 seconds"Companion app timed out. Ensure it is installed and running on the device."

Back to README · Architecture » · Modules »