Open-source Projection Android App for Apple CarPlay and Android Auto using the Carlinkit CPC200-CCPA adapter.
Apple CarPlay and Android Auto projection
Carlinkit CPC200-CCPA (Amazon US)
About This Project:
Carlink is a modernization of the original "Carplay" project by Abuharsky, designed as an open-source alternative to the proprietary Carlinkit AutoKit application. This project provides:
- USB Host Communication: Direct USB protocol implementation for CPC200-CCPA control
- Hardware-Accelerated Video: H.264 rendering with MediaCodec and OpenGL ES2
- Full Audio Support: Media, Navigation, Siri, and Phone Call audio playback with microphone capture
Credits & Prior Works
This project builds upon the foundational research and implementations from:
- Carplay by Abuharsky - Original Android implementation
- Node-Carplay by Rhysmorgan134 - Protocol reverse engineering
- Pi-Carplay by f-io - Raspberry Pi implementation
- PyCarplay by Electric-Monk - Python implementation
Project Structure:
carlink/
├── lib/ - Flutter plugin implementation
│ ├── carlink.dart - Main API (421 lines)
│ ├── carlink_method_channel.dart - Native messaging bridge
│ ├── carlink_platform_interface.dart - Platform abstraction
│ ├── driver/ - CPC200-CCPA protocol implementation
│ │ ├── adaptr_driver.dart - Protocol orchestration, initialization
│ │ ├── readable.dart - Message parsing (13 types)
│ │ ├── sendable.dart - Message serialization
│ │ └── usb/
│ │ └── usb_device_wrapper.dart - USB lifecycle management
│ ├── console_log_listener.dart - Console logging
│ ├── file_log_manager.dart - File-based logging with rotation
│ ├── logging_lifecycle_manager.dart - Logging coordination
│ ├── log.dart - Centralized logging system
│ ├── common.dart - Shared utilities
│ └── usb.dart - USB abstractions
├── android/ - Native Android implementation
│ └── src/main/kotlin/com/carlink/
│ ├── CarlinkPlugin.kt - FlutterPlugin entry point
│ ├── handlers/ - Modular method call handlers
│ │ ├── MethodCallDispatcher.kt
│ │ ├── UsbDeviceHandler.kt
│ │ ├── BulkTransferHandler.kt
│ │ ├── VideoHandler.kt
│ │ └── DisplayMetricsHandler.kt
│ ├── UsbDeviceManager.kt - USB device discovery
│ ├── BulkTransferManager.kt - USB I/O operations
│ ├── VideoTextureManager.kt - Texture lifecycle
│ ├── H264Renderer.java - MediaCodec, Intel QuickSync
│ ├── PacketRingByteBuffer.java - 16MB ring buffer
│ ├── TextureRender.java - OpenGL ES2 rendering
│ ├── OutputSurface.java - EGL surface management
│ ├── DualStreamAudioManager.kt - 4-stream audio playback
│ ├── MicrophoneCaptureManager.kt - Microphone capture
│ ├── AudioRingBuffer.kt - Jitter-compensating audio buffer
│ ├── AppExecutors.java - Thread pool management
│ └── LogCallback.java - Native logging bridge
├── example/ - Example Android application
│ ├── lib/
│ │ ├── main.dart - App entry point
│ │ ├── main_page.dart - Video projection UI
│ │ ├── settings_page.dart - Tabbed settings interface
│ │ ├── theme.dart - Material theme configuration
│ │ ├── immersive_preference.dart - Fullscreen settings
│ │ └── settings/ - Modular settings components
│ │ ├── status_tab_content.dart
│ │ ├── control_tab_content.dart
│ │ ├── logs_tab_content.dart
│ │ ├── status_monitor.dart
│ │ ├── logging_preferences.dart
│ │ ├── enhanced_sharing.dart
│ │ ├── settings_enums.dart
│ │ ├── settings_tab_base.dart
│ │ ├── delete_confirmation_dialog.dart
│ │ ├── export_warning_dialog.dart
│ │ └── transfer_dialog.dart
│ └── android/ - Build from here for APK/AAB
└── docs/ - Technical documentation
├── project.md - Comprehensive technical analysis
├── Firmware/ - CPC200-CCPA specifications
├── GM/ - GM infotainment specs
└── Autokit_reference_only/ - Original AutoKit reference
Development Environment:
- Android Studio: Narwhal 2025.1.2+ (includes JDK 21)
- Flutter: ≥3.32.0 with Dart ≥3.8.0
- Java/JDK: Version 21 (bundled with Android Studio)
- Gradle: 8.12.1 with AGP 8.12.1
- Kotlin: 2.2.0
Android
- Minimum SDK: API 32 (Android 12L)
- Target SDK: API 34 (Android 14)
- Compile SDK: API 36 (Android 15)
- NDK: 27.0.12077973
Note: Flutter must be installed as both an Android Studio plugin AND as a standalone SDK. See Flutter installation guide.
Building from Source:
Quick Start:
-
Configure Application Identity
Edit
project_config.gradlein the root directory:myApplicationId = "com.your.app" // Your unique package name myApplicationName = "Carlink" // App display name myVersionCode = 1 // Play Store version code myVersionName = "1.0.0" // User-visible version
The build system automatically:
- Generates package structure from
TEMPLATE_PACKAGE - Creates
MainActivity.ktwith correct package name - Cleans up old package directories
- Generates package structure from
-
Load Flutter + Dart SDKs
- With Flutter and Dart installed in your terminal
- Within
Carlink/example/android/, run:flutter clean && flutter pub get && ./gradlew clean
- This prepares the directory for building APKs and troubleshooting
-
Build with Android Studio
- Open project directory:
Carlink/example/android - Wait for Gradle sync to complete
- Build → Build Bundle(s) / APK(s) → Build APK
- Or use terminal:
./gradlew assembleRelease
- Open project directory:
Features:
-
Video Projection
- Hardware-accelerated H.264 rendering with MediaCodec
- Intel QuickSync optimization with fallback to generic decoders
- Multitouch input support (1-10 simultaneous touch points)
- Adaptive buffer pools (6-20 buffers based on resolution)
- Low-latency mode for Android 12+ (16-29ms total pipeline)
-
Audio Playback & Microphone
- 4 simultaneous audio streams: Media, Navigation, Siri/Voice, Phone Calls
- AAOS CarAudioContext integration (proper volume group routing)
- Jitter-compensating ring buffers with underrun recovery
- Microphone capture for Siri and phone calls (16kHz mono)
- Volume ducking during navigation prompts
-
Settings UI (Modular Architecture)
- Status Tab: Adapter status monitoring
- Control Tab: Device control commands (disconnect phone, close adapter, reset renderer, reset/reinit adapter)
- Logs Tab: File logging management with 7 configurable log levels
- Bulk file operations and enhanced sharing (AAOS compatible)
- Responsive design (mobile/tablet/desktop breakpoints)
- Immersive fullscreen mode toggle
- Theme system with Material Design
-
Logging System
- Tag-based filtering (12 categories: USB, PLATFORM, VIDEO, AUDIO, etc.)
- Console output with session IDs and ISO8601 timestamps
- File logging with automatic rotation (5MB max, 7-day retention)
- Queue-based non-blocking architecture
- Dual output: console + persistent file storage
-
Performance Monitoring
- FPS tracking with 30-second intervals
- Buffer utilization statistics
- USB throughput monitoring
- Codec performance metrics
Current Limitations:
- Platform Support: Android-only implementation
- No iOS, web, macOS, or Linux native support
- Linux/macOS entries in pubspec.yaml are placeholders only
My Hardware:
Primary Test Platform:
- Vehicle: Chevrolet 2024 Silverado
- Radio: GM AAOS (gminfo3.7-3.8, RPO: IOK)
- Radio: GM AAOS Build Y181
- Processor: Intel Atom x7-A3960 (x86_64)
- Display: 2400x960 ultra-wide
- GPU: Intel HD Graphics 505 (18 EUs, Intel QuickSync optimized)
- Adapter: CPC200-CCPA A15W (verified)
Compatibility Notes:
- Apple CarPlay
- Android Auto (Might need to do initial pairing with Autokit App)
-
- Android Auto has resolution limitations by Google design.
- H.264 rendering includes Intel QuickSync optimizations but works with generic decoders
- Adaptive buffer pools automatically adjust for different resolutions
- Tested on AAOS but should work on standard Android 12L+ devices
- Your results may vary with different hardware configurations
-- Documentation
The docs/ directory contains technical documentation:
- docs/project.md - Comprehensive technical analysis (optimized for AI ingestion)
- docs/Firmware/ - CPC200-CCPA adapter specifications and protocol details
- docs/GM/ - GM infotainment (gminfo3.7) technical specifications
- docs/Autokit_reference_only/ - Original Carlinkit AutoKit reference implementation
These documents provide detailed information about:
- CPC200-CCPA protocol (16-byte header, 13 message types, 51+ commands)
- Hardware specifications (ARM32, 128MB RAM, WM8960/AC6966 audio codecs etc)
- Audio pipeline architecture (7 audio formats, bidirectional processing)
- Video processing (H.264 hardware acceleration, resolution negotiation)
- USB bulk transfer implementation and error recovery
Architecture & Performance
Flutter Plugin Layer:
lib/carlink.dart- Main API with lifecycle management (421 lines)lib/carlink_method_channel.dart- Native messaging bridge (357 lines)lib/carlink_platform_interface.dart- Platform abstraction (130 lines)lib/driver/adaptr_driver.dart- CPC200-CCPA protocol orchestration (375 lines)lib/driver/readable.dart- Message parsing for 13 protocol message types (446 lines)lib/driver/sendable.dart- Message serialization (Touch, MultiTouch, Commands) (375 lines)lib/driver/usb/usb_device_wrapper.dart- USB device lifecycle management (355 lines)lib/log.dart- Centralized logging with tag filtering (324 lines)lib/file_log_manager.dart- File-based logging with rotation (422 lines)
Android Native Layer (Handler-Based Architecture):
CarlinkPlugin.kt- FlutterPlugin entry pointhandlers/MethodCallDispatcher.kt- Routes method calls to specialized handlershandlers/UsbDeviceHandler.kt- USB device lifecycle managementhandlers/BulkTransferHandler.kt- USB read/write operationshandlers/VideoHandler.kt- Video texture managementhandlers/DisplayMetricsHandler.kt- Screen resolution detectionUsbDeviceManager.kt- USB device discovery and permissionsBulkTransferManager.kt- Bulk transfer retry logic and error recoveryVideoTextureManager.kt- Texture lifecycle coordinationH264Renderer.java- MediaCodec integration with adaptive buffer pools (6-20 buffers)PacketRingByteBuffer.java- 16MB ring buffer with dynamic resizeTextureRender.java- OpenGL ES2 external texture renderingOutputSurface.java- EGL surface managementCarLinkMessage.java- Protocol message wrapperCarLinkMessageHeader.java- Message header parsing
Example Application:
example/lib/main.dart- App entry point with logging initialization (99 lines)example/lib/main_page.dart- Video projection with multitouch processing (361 lines)example/lib/settings_page.dart- Tabbed settings interface (148 lines)example/lib/theme.dart- Material Design theme configurationexample/lib/immersive_preference.dart- Fullscreen mode persistenceexample/lib/settings/- 11 modular settings components:status_tab_content.dart- Real-time adapter status displaycontrol_tab_content.dart- Device control commandslogs_tab_content.dart- Log file management UIstatus_monitor.dart- Adapter status polling servicelogging_preferences.dart- Log level persistenceenhanced_sharing.dart- AAOS-compatible file sharing- And 5 dialog components for user interactions
Performance Characteristics
- Video Latency: 16-29ms total (H.264 decode: 8-15ms, protocol: 1-2ms, OpenGL: 3-5ms)
- Touch Latency: <16ms touch-to-USB transmission
- Memory Footprint: ~3.45MB active processing
- CPU Usage: 36-58% during active streaming (on Intel Atom x7-A3960)
- Buffer Management: Adaptive pool sizing based on resolution (6-20 buffers)
Important Notes
Modifying Dart Protocol Code
Exercise caution when modifying lib/driver/adaptr_driver.dart, lib/driver/readable.dart, or lib/driver/sendable.dart files. The CPC200-CCPA communication protocol is based on reverse engineering from several years ago when Carlinkit App+firmware was decrypted.
The initialization sequence and communication logic must remain compatible with the adapter firmware. Breaking changes can prevent the adapter from functioning correctly.
Firmware Limitations
Adding new adapter features is not currently possible without reverse engineering the latest Carlinkit firmware. The adapter's capabilities are limited to what was documented during the original App+firmware decryption.
For firmware research: CPC200-CCPA-Firmware-Dump repository
Centralized Build Configuration
All version numbers, SDK levels, and package identifiers are managed in project_config.gradle. This file is the single source of truth for:
- Application ID and display name
- Version code and version name
- SDK levels (min, target, compile)
- Kotlin, Gradle, and Java versions
Update this file before publishing to Google Play Store. The automated build system handles package generation and cleanup.
Support & Issues
Consider this repo AS-IS without any support, do with it as you please. Updates are pushed out as I find things to fix, add, or remove. So Fork it or copy and make your own repo, MIT license and all that.