How nisargjhaveri/aawirelessgateway works
Project type and purpose
• This is an Android mobile application (single Gradle module under app/) that enables Wireless Android Auto by acting as a gateway/proxy between a car’s wired Android Auto head unit and a phone (wireless client).
• The app can run in two modes:
• Gateway mode (installed on the device plugged into the car’s USB)
• Wireless-client mode (installed on the phone that will connect wirelessly)
High-level architecture
• Car head unit
• Gateway device (Android phone/tablet)
• Wireless-client device (Android phone/tablet)
– USBReceiverActivity (listens for Android Auto USB accessory attach)
– AAGatewayService (foreground service that orchestrates everything)
– AndroidAutoHelper (invokes native AA APIs)
– WifiHotspotHandler (enables/disables Android hotspot)
– BluetoothProfileHandler & BluetoothHandler (sets up Bluetooth server, incoming RFCOMM socket)
– Proto-generated classes (from app/src/main/proto) to serialize/deserialize control messages
– AAWirelessClientService (foreground service in client mode)
– AndroidAutoHelper (starts native wireless AA)
– BluetoothReceiver (connects to gateway’s Bluetooth socket)
– WifiClientHandler (connects to gateway’s hotspot)
– Proto-generated classes (same message definitions)
Interactions and data flows
• WifiInfoRequest, WifiStartRequest → for communicating SSID, credentials
• Client uses WifiClientHandler to join the hotspot and then AndroidAutoHelper to start AA
• (Optional) Direct USB fallback path on gateway if wireless fails (via root/system app)
Architectural patterns and design principles
• Separation of concerns: distinct Handler classes for USB, Bluetooth, Wi-Fi and a central Service (AAGatewayService / AAWirelessClientService)
• Event-driven Android components: Activities and BroadcastReceivers trigger Services
• Protocol abstraction: .proto files define the control‐plane messages, keeping serialization independent of transport
• Foreground services ensure the app stays alive only when needed (no always-on background)
Technologies and frameworks
• Android SDK: Activities, Services, BroadcastReceivers
• Android Accessory / USB Host APIs for Android Auto over USB
• Android Wi-Fi Hotspot APIs (WifiManager + connectivity intents)
• Android Bluetooth APIs (BluetoothAdapter, BluetoothServerSocket, BluetoothSocket)
• Protocol Buffers (via app/src/main/proto)
• Gradle build system and ProGuard rules