1 <html devsite> 2 <head> 3 <title>Automotive</title> 4 <meta name="project_path" value="/_project.yaml" /> 5 <meta name="book_path" value="/_book.yaml" /> 6 </head> 7 <body> 8 <!-- 9 Copyright 2017 The Android Open Source Project 10 11 Licensed under the Apache License, Version 2.0 (the "License"); 12 you may not use this file except in compliance with the License. 13 You may obtain a copy of the License at 14 15 http://www.apache.org/licenses/LICENSE-2.0 16 17 Unless required by applicable law or agreed to in writing, software 18 distributed under the License is distributed on an "AS IS" BASIS, 19 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 See the License for the specific language governing permissions and 21 limitations under the License. 22 --> 23 24 25 26 <img style="float: right; margin: 0px 15px 15px 15px;" 27 src="../images/ape_fwk_hal_vehicle.png" alt="Android vehicle HAL icon"/> 28 29 <p>Many car subsystems interconnect with each other and the in-vehicle 30 infotainment (IVI) system via various bus topologies. The exact bus type and 31 protocols vary widely between manufacturers (and even between different vehicle 32 models of the same brand); examples include Controller Area Network (CAN) bus, 33 Local Interconnect Network (LIN) bus, Media Oriented Systems Transport (MOST), 34 as well as automotive-grade Ethernet and TCP/IP networks such as BroadR-Reach. 35 </p> 36 <p>the Android Automotive hardware abstraction layer (HAL) provides a 37 consistent interface to the Android framework regardless of physical transport 38 layer. This vehicle HAL is the interface for developing Android Automotive 39 implementations.</p> 40 <p>System integrators can implement a vehicle HAL module by connecting 41 function-specific platform HAL interfaces (e.g. HVAC) with technology-specific 42 network interfaces (e.g. CAN bus). Typical implementations may include a 43 dedicated Microcontroller Unit (MCU) running a proprietary real-time operating 44 system (RTOS) for CAN bus access or similar, which may be connected via a serial 45 link to the CPU running Android Automotive. Instead of a dedicated MCU, it may 46 also be possible to implement the bus access as a virtualized CPU. It is up to 47 each partner to choose the architecture suitable for the hardware as long as the 48 implementation fulfills the interface requirements for the vehicle HAL.</p> 49 50 <h2 id=arch>Architecture</h2> 51 <p>The vehicle HAL is the interface definition between the car and the vehicle 52 network service:</p> 53 54 <img src="../images/vehicle_hal_arch.png" alt="Android vehicle HAL architecture"> 55 <p class="img-caption"><strong>Figure 1</strong>. Vehicle HAL and Android 56 automotive architecture</p> 57 58 <ul> 59 <li><strong>Car API</strong>. Contains the APIs such as CarHvacManager, 60 CarSensorManager, and CarCameraManager. For details on supported APIs, 61 refer to <code>/platform/packages/services/Car/car-lib</code>.</li> 62 <li><strong>CarService</strong>. Located at 63 <code>/platform/packages/services/Car/</code>.</li> 64 <li><strong>VehicleNetworkService</strong>. Controls vehicle HAL with built-in 65 security. Access restricted to system components only (non-system components 66 such as third party apps should use car API instead). OEMs can control access 67 using <code>vns_policy.xml</code> and <code>vendor_vns_policy.xml</code>. 68 Located at <code>/platform/packages/services/Car/vehicle_network_service/</code>; 69 for libraries to access the vehicle network, refer to 70 <code>/platform/packages/services/Car/libvehiclenetwork/</code>.</li> 71 <li><strong>Vehicle HAL</strong>. Interface that defines the vehicle properties 72 OEMs can implement. Contains property metadata (for example, whether the vehicle 73 property is an int and which change modes are allowed). Located at 74 <code>hardware/libhardware/include/hardware/vehicle.h</code>. For a basic 75 reference implementation, refer to 76 <code>hardware/libhardware/modules/vehicle/</code>.</li> 77 </ul> 78 <p>For more details, see <a href="/devices/automotive/properties.html">Vehicle 79 Properties</a>. 80 81 <h2 id=security>Security</h2> 82 <p>The vehicle HAL supports three levels of security for accessing data:</p> 83 <ul> 84 <li>System only (controlled by <code>vns_policy.xml</code>)</li> 85 <li>Accessible to app with permission (through car service)</li> 86 <li>Accessible without permission (through car service)</li> 87 </ul> 88 <p>Direct access to vehicle properties is allowed only to selected system 89 components with vehicle network service acting as the gatekeeper. Most 90 applications go through additional gatekeeping by car service (for example, only 91 system applications can control HVAC as it requires system permission granted 92 only to system apps).</p> 93 94 <h2 id=validation>Validation</h2> 95 <p>AOSP includes the following testing resources for use in development:</p> 96 <ul> 97 <li><code>hardware/libhardware/tests/vehicle/vehicle-hal-tool.c</code><br> 98 Command-line native tool to load vehicle HAL and do simple operations. Useful 99 for getting the system up and running in the early stages of development.</li> 100 <li><code>packages/services/Car/tests/carservice_test/</code><br>Contains car 101 service testing with mocked vehicle HAL properties. For each property, expected 102 behavior is implemented in the test. This can be a good starting point to 103 understand expected behavior.</li> 104 <li><code>hardware/libhardware/modules/vehicle/</code><br>A basic reference 105 implementation.</li> 106 </ul> 107 108 </body> 109 </html> 110