How 674809/carlife works
Repository Scope
Apollo-DuerOS is a vehicle-telematics repository containing: an Android CarLife head-unit implementation, a portable C++ CarLife library, Android DuerOS launcher variants, DSP design documents, and DuerOS Auto integration specifications. It is a multi-deliverable source/documentation repository rather than one deployable application.
Android CarLife Head Unit
The primary Android vehicle-side client implements the CarLife smartphone-integration protocol. It is responsible for device connection, protocol handling, media presentation/playback, and vehicle input forwarding; phone-side applications retain business logic. Android startup is defined by CarLife-Android-Vehicle/AndroidManifest.xml, application initialization by CarLife-Android-Vehicle/src/com/baidu/carlifevehicle/CarLifeApplication.java, and the main UI host by CarLife-Android-Vehicle/src/com/baidu/carlifevehicle/CarlifeActivity.java.
CarLife Connection and Session Boundary
The connection subsystem abstracts multiple phone/head-unit transports: Android Open Accessory/USB, NCM, Wi-Fi, and iPhone USB multiplexing/tethering. CarLife-Android-Vehicle/src/com/baidu/carlifevehicle/connect/ConnectManager.java coordinates transport lifecycle; CarLife-Android-Vehicle/src/com/baidu/carlifevehicle/connect/ConnectService.java provides a service boundary; CarLife-Android-Vehicle/src/com/baidu/carlifevehicle/connect/ConnectSocket.java represents socket transport. Connection setup includes heartbeat management and platform/device broadcasts, separating physical connectivity from protocol dispatch.
Protocol, Negotiation, and Security
Messages are serialized with Protocol Buffers, including protocol-version negotiation, device metadata, feature configuration, auth, media, touch, and vehicle telemetry. Android-generated schemas reside in CarLife-Android-Vehicle/src/com/baidu/carlife/protobuf/; protocol handlers are centralized through CarLife-Android-Vehicle/src/com/baidu/carlifevehicle/message/MsgHandlerCenter.java. Encryption setup and AES/RSA operations form a security boundary around authentication/key exchange: CarLife-Android-Vehicle/src/com/baidu/carlifevehicle/encryption/EncryptSetupManager.java and CarLife-Android-Vehicle/src/com/baidu/carlifevehicle/encryption/RSAManager.java.
Vehicle I/O and Media Pipeline
Head-unit touch, hard keys, microphone input, GPS, speed, and other car data are converted into CarLife protocol events, while incoming media/control streams are rendered locally. Touch handling is routed through CarLife-Android-Vehicle/src/com/baidu/carlifevehicle/touch/TouchListenerManager.java; vehicle telemetry reporting through CarLife-Android-Vehicle/src/com/baidu/carlifevehicle/vehicledata/CarDataManager.java; audio packets flow through buffering, arbitration, and Android playback in CarLife-Android-Vehicle/src/com/baidu/carlifevehicle/audioplayer/VehiclePCMPlayer.java. Bluetooth HFP pairing/call control is a separate Android/Binder-facing integration in CarLife-Android-Vehicle/src/com/baidu/carlifevehicle/bluetooth/BtHfpManager.java.
CarLife UI and Recovery
The Android client is a fragment-based head-unit UI with launch, main, in-call, touch, settings, help, authorization, and exception states. Fragment navigation is coordinated by CarLife-Android-Vehicle/src/com/baidu/carlifevehicle/fragment/CarLifeFragmentManager.java; the primary connected/disconnected UI is CarLife-Android-Vehicle/src/com/baidu/carlifevehicle/fragment/MainFragment.java; recovery/diagnostic presentation is CarLife-Android-Vehicle/src/com/baidu/carlifevehicle/fragment/ExceptionFragment.java. Layout resources support multiple head-unit resolutions under CarLife-Android-Vehicle/res/.
Cross-Platform CarLife Library
CarLife-Vehicle-Lib exposes equivalent CarLife HU capabilities as a C++ dynamic-library integration surface for Linux and QNX-oriented environments. Public embedding APIs are defined in CarLife-Vehicle-Lib/LibSource/include/CCarLifeLib.h; the wrapper implementation is CarLife-Vehicle-Lib/LibSource/libwrapper/CCarLifeLib.cpp; connection/channel setup is split across CarLife-Vehicle-Lib/LibSource/modules/CConnectionSetupModule.cpp and command, control, media, video, TTS, and VR channel modules. Its protobuf source schemas in CarLife-Vehicle-Lib/LibSource/protobuf/proto/ are the cross-language protocol contract shared conceptually with the Android implementation.
DuerOS Launcher and Supporting Artifacts
DuerOS-Launcher is a separate Gradle Android launcher product with landscape head-unit, portrait head-unit, and mirror variants. Each variant has its own manifest and HomeActivity, for example DuerOS-Launcher/app-headunit-open/src/main/java/com/baidu/che/codriverlauncher/ui/HomeActivity.java. Shared runtime concerns—application base, HTTP, caching, device adaptation, and bundled CoDriver SDK—are in DuerOS-Launcher/core/; map access is isolated behind DuerOS-Launcher/map-sdk/src/main/java/com/baidu/che/codriverlauncher.mapsdk/MapSdkWrapper.java and Baidu LBS binaries. DSP-Solution-For-DuerOS/ and DuerOS-Auto-Spec/ are documentation deliverables describing DSP voice processing and OEM integration requirements, not executable runtime modules.
Main entry points: MsgHandlerCenter.java Protocol dispatch · CarLifeApplication.java CarLife application · HomeActivity.java Launcher variants · CarlifeActivity.java CarLife activity
Components 22
Android CarLife HU
- Android startup
CarLife-Android-Vehicle/AndroidManifest.xml - CarLife application
CarLife-Android-Vehicle/src/com/baidu/carlifevehicle/CarLifeApplication.java - CarLife activity
CarLife-Android-Vehicle/src/com/baidu/carlifevehicle/CarlifeActivity.java - Fragments and layouts · Connected, call, settings, authorization, and recovery states.
CarLife-Android-Vehicle/src/com/baidu/carlifevehicle/fragment/CarLifeFragmentManager.java - Connection service
CarLife-Android-Vehicle/src/com/baidu/carlifevehicle/connect/ConnectService.java - Transport lifecycle · Coordinates USB, NCM, Wi-Fi, and iPhone multiplexed transports.
CarLife-Android-Vehicle/src/com/baidu/carlifevehicle/connect/ConnectManager.java - Socket transport
CarLife-Android-Vehicle/src/com/baidu/carlifevehicle/connect/ConnectSocket.java - Protocol dispatch
CarLife-Android-Vehicle/src/com/baidu/carlifevehicle/message/MsgHandlerCenter.java - Android protobuf schemas
- Authentication and crypto · Establishes encryption and RSA/AES key exchange.
CarLife-Android-Vehicle/src/com/baidu/carlifevehicle/encryption/EncryptSetupManager.java - Vehicle input and telemetry · Forwards touch and reports vehicle data as protocol events.
CarLife-Android-Vehicle/src/com/baidu/carlifevehicle/touch/TouchListenerManager.java - Local media playback · Buffers, arbitrates, and plays incoming PCM audio.
CarLife-Android-Vehicle/src/com/baidu/carlifevehicle/audioplayer/VehiclePCMPlayer.java - Bluetooth HFP
CarLife-Android-Vehicle/src/com/baidu/carlifevehicle/bluetooth/BtHfpManager.java
C++ CarLife Library
- C++ embedding API · Linux and QNX head-unit integration surface.
CarLife-Vehicle-Lib/LibSource/include/CCarLifeLib.h - C++ library wrapper
CarLife-Vehicle-Lib/LibSource/libwrapper/CCarLifeLib.cpp - C++ connection setup
CarLife-Vehicle-Lib/LibSource/modules/CConnectionSetupModule.cpp - C++ protobuf schemas
DuerOS Launcher
- Launcher variants · Landscape, portrait, and mirror head-unit products.
DuerOS-Launcher/app-headunit-open/src/main/java/com/baidu/che/codriverlauncher/ui/HomeActivity.java - Launcher core · Application base, networking, cache, adaptation, and CoDriver SDK.
- Map SDK wrapper
DuerOS-Launcher/map-sdk/src/main/java/com/baidu/che/codriverlauncher.mapsdk/MapSdkWrapper.java
Integration Documents
- DSP voice design
- DuerOS Auto specification
Connections 20
- Android startup → CarLife application: starts
- CarLife application → CarLife activity: initializes
- CarLife activity → Fragments and layouts: hosts
- CarLife application → Connection service: runs session
- Connection service → Transport lifecycle: delegates lifecycle
- Transport lifecycle → Socket transport: opens channel
- Socket transport → Protocol dispatch: carries messages
- Protocol dispatch → Android protobuf schemas: serializes
- Protocol dispatch → Authentication and crypto: negotiates auth
- Protocol dispatch → Fragments and layouts: drives UI state
- Vehicle input and telemetry → Protocol dispatch: sends car events
- Protocol dispatch → Local media playback: delivers media
- Protocol dispatch → Bluetooth HFP: coordinates calls
- C++ embedding API → C++ library wrapper: implemented by
- C++ library wrapper → C++ connection setup: sets up channels
- C++ connection setup → C++ protobuf schemas: uses
- Android protobuf schemas → C++ protobuf schemas: conceptual shared contract
- Launcher variants → Launcher core: uses
- Launcher variants → Map SDK wrapper: accesses maps through
- DSP voice design → DuerOS Auto specification: complements OEM integration