From eee70913d1765f2e17ed27fbd97b8ed41426a149 Mon Sep 17 00:00:00 2001
From: Android Partner Docs A HAL defines a standard interface for hardware vendors to implement,
+which enables Android to be agnostic about lower-level driver implementations.
+Using a HAL allows you to implement functionality without affecting or modifying
+the higher level system. HAL implementations are packaged into modules and
+loaded by the Android system at the appropriate time. You must implement the corresponding HAL (and driver) for the specific
+hardware your product provides. HAL implementations are typically built into
+shared library modules ( To guarantee that HALs have a predictable structure, each hardware-specific
+HAL interface has properties defined in
+ A module represents your packaged HAL implementation, which is stored as a
+shared library ( In addition, the When you implement a HAL and create the module struct, you must name it
+ A device abstracts the hardware of your product. For example, an audio
+module can contain a primary audio device, a USB audio device, or a Bluetooth
+A2DP audio device. A device is represented by the In addition to these standard properties, each hardware-specific HAL
+interface can define more of its own features and requirements. For details,
+see the HAL reference documentation as well as
+the individual instructions for each HAL. HAL implementations are built into modules ( For details on setting up the build for each HAL, see the HAL-specific
+documentation through the Porting section of this website.
+Android system architecture contains the following components:
+ The application framework is used most often by application developers. As a
+hardware developer, you should be aware of developer APIs as many map directly
+to the underlying HAL interfaces and can provide helpful information about
+implementing drivers. The Binder Inter-Process Communication (IPC) mechanism allows the application
+framework to cross process boundaries and call into the Android system services
+code. This enables high level framework APIs to interact with Android system
+services. At the application framework level, this communication is hidden from
+the developer and things appear to "just work". System services are modular, focused components such as Window Manager,
+Search Service, or Notification Manager. Functionality exposed by application
+framework APIs communicates with system services to access the underlying
+hardware. Android includes two groups of services: system (such as
+Window Manager and Notification Manager) and media (services involved
+in playing and recording media). A HAL defines a standard interface for hardware vendors to implement,
+which enables Android to be agnostic about lower-level driver implementations.
+Using a HAL allows you to implement functionality without affecting or modifying
+the higher level system. HAL implementations are packaged into modules and
+loaded by the Android system at the appropriate time. For details, see
+Hardware Abstraction Layer (HAL).
+ Developing your device drivers is similar to developing a typical Linux
+device driver. Android uses a version of the Linux kernel with a few special
+additions such as wake locks (a memory management system that is more aggressive
+in preserving memory), the Binder IPC driver, and other features important for a
+mobile embedded platform. These additions are primarily for system functionality
+and do not affect driver development. You can use any version of the kernel as long as it supports the required
+features (such as the binder driver). However, we recommend using the latest
+version of the Android kernel. For details, see
+Building Kernels. The upcoming Android O release includes Project Treble, a major re-architect
+of the Android OS framework designed to make it easier, faster, and less costly
+for manufacturers to update devices to a new version of Android. Project Treble separates the vendor implementation (device-specific,
+lower-level software written by silicon manufacturers) from the Android OS
+framework via a new vendor interface. In Android 7.x and earlier, no formal vendor interface exists so device
+makers must update large portions of the Android code to move a device to a
+newer version of Android: With Treble, a new stable vendor interface provides access to the
+hardware-specific parts of Android, enabling device makers to deliver new
+Android releases simply by updating the Android OS framework—without any
+additional work required from the silicon manufacturers: To ensure forward compatibility of the vendor implementation, the new vendor
+interface will be validated by the Vendor Test Suite (VTS), which is analogous
+to the Compatibility Test Suite (CTS). VTS is
+already launched and can be used to automate HAL and OS kernel testing even in
+pre-Treble environments; for details, see
+Systems Testing
+With VTS. Project Treble is coming to all new devices launching with Android O and
+beyond, and the new architecture is already running on the Developer Preview of
+O for Pixel phones. When Android O launches, we'll have full details here (on
+source.android.com). In the interim,
+you can find more details on Treble over at the
+Android
+Developers Blog. Many car subsystems interconnect with each other and the in-vehicle
-infotainment (IVI) system via various bus topologies. The exact bus type and
-protocols vary widely between manufacturers (and even between different vehicle
-models of the same brand); examples include Controller Area Network (CAN) bus,
-Local Interconnect Network (LIN) bus, Media Oriented Systems Transport (MOST),
-as well as automotive-grade Ethernet and TCP/IP networks such as BroadR-Reach.
- Android Automotive has a hardware abstraction layer (HAL) that provides a
-consistent interface to the Android framework regardless of physical transport
-layer. This vehicle HAL is the interface for developing Android Automotive
-implementations. System integrators can implement a vehicle HAL module by connecting
-function-specific platform HAL interfaces (e.g. HVAC) with technology-specific
-network interfaces (e.g. CAN bus). Typical implementations may include a
-dedicated Microcontroller Unit (MCU) running a proprietary real-time operating
-system (RTOS) for CAN bus access or similar, which may be connected via a serial
-link to the CPU running Android Automotive. Instead of a dedicated MCU, it may
-also be possible to implement the bus access as a virtualized CPU. It is up to
-each partner to choose the architecture suitable for the hardware as long as the
-implementation fulfills the interface requirements for the vehicle HAL. The vehicle HAL is the interface definition between the car and the vehicle
-network service: The vehicle HAL interface is based on accessing (read, write, subscribe) a
-property, which is an abstraction for a specific function. Properties can be
-read-only, write-only (used to pass information to vehicle HAL level), or read
-and write. Support of most properties is optional. Each property is uniquely identified by an int32 key and has a predefined
-type ( The vehicle HAL defines three zone types: Each zoned property should use pre-defined zone type. If necessary, you can
-use a custom zone type for each property (for details, see
-Handling custom properties). Use In addition, some properties have specific configuration flags to represent
-capability. The vehicle HAL uses the following interfaces: The vehicle HAL uses the following callback interfaces: A zoned property is equivalent to a collection of multiple properties where
-each sub property is accessible by specified zone value. During initialization, the value for the property may not be available yet as
-the matching vehicle network message has not yet been received. In such cases,
-the In addition, some properties (such as HVAC temperature) can have a value to
-indicate it is in max power mode rather than in specific temperature value. In
-such cases, use special values to represent such state. Example: get HVAC Temperature A Some Until Example: set HVAC Temperature To support partner-specific needs, the vehicle HAL allows custom properties
-that are restricted to system apps. Use the following guidelines when working
-with custom properties: You can use the vehicle HAL to control HVAC by setting HVAC-related
-properties. Most HVAC properties are zoned properties, but a few are non-zoned
-(global) properties. Example properties defined include: For full list of HVAC properties, search for
- Vehicle HAL sensor properties represent real sensor data or policy
-information such as driving status. Some sensor information (such as driving
-status and day/night mode) is accessible by any app without restriction as the
-data is mandatory to build a safe vehicle application. Other sensor information
-(such as vehicle speed) is more sensitive and requires specific permissions that
-users can manage. Supported sensor properties include: The vehicle HAL supports three levels of security for accessing data: Direct access to vehicle properties is allowed only to selected system
-components with vehicle network service acting as the gatekeeper. Most
-applications go through additional gatekeeping by car service (for example, only
-system applications can control HVAC as it requires system permission granted
-only to system apps). AOSP includes the following testing resources for use in development: Many car subsystems interconnect with each other and the in-vehicle
+infotainment (IVI) system via various bus topologies. The exact bus type and
+protocols vary widely between manufacturers (and even between different vehicle
+models of the same brand); examples include Controller Area Network (CAN) bus,
+Local Interconnect Network (LIN) bus, Media Oriented Systems Transport (MOST),
+as well as automotive-grade Ethernet and TCP/IP networks such as BroadR-Reach.
+ the Android Automotive hardware abstraction layer (HAL) provides a
+consistent interface to the Android framework regardless of physical transport
+layer. This vehicle HAL is the interface for developing Android Automotive
+implementations. System integrators can implement a vehicle HAL module by connecting
+function-specific platform HAL interfaces (e.g. HVAC) with technology-specific
+network interfaces (e.g. CAN bus). Typical implementations may include a
+dedicated Microcontroller Unit (MCU) running a proprietary real-time operating
+system (RTOS) for CAN bus access or similar, which may be connected via a serial
+link to the CPU running Android Automotive. Instead of a dedicated MCU, it may
+also be possible to implement the bus access as a virtualized CPU. It is up to
+each partner to choose the architecture suitable for the hardware as long as the
+implementation fulfills the interface requirements for the vehicle HAL. The vehicle HAL is the interface definition between the car and the vehicle
+network service: For more details, see Vehicle
+Properties.
+
+ The vehicle HAL supports three levels of security for accessing data: Direct access to vehicle properties is allowed only to selected system
+components with vehicle network service acting as the gatekeeper. Most
+applications go through additional gatekeeping by car service (for example, only
+system applications can control HVAC as it requires system permission granted
+only to system apps). AOSP includes the following testing resources for use in development: The vehicle HAL interface defines the properties OEMs can implement and
+contains property metadata (for example, whether the property is an int and
+which change modes are allowed). The vehicle HAL interface is based on accessing
+(read, write, subscribe) a property, which is an abstraction for a specific
+function. The vehicle HAL uses the following interfaces: The vehicle HAL uses the following callback interfaces: Properties can be read-only, write-only (used to pass information to vehicle
+HAL level), or read and write (support of most properties is optional). Each
+property is uniquely identified by an int32 key and has a predefined type
+( The vehicle HAL defines three zone types: Each zoned property should use pre-defined zone type. If necessary, you can
+use a custom zone type for each property (for details, see
+Handling custom properties). Use In addition, some properties have specific configuration flags to represent
+capability. A zoned property is equivalent to a collection of multiple properties where
+each sub property is accessible by specified zone value. During initialization, the value for the property may not be available yet as
+the matching vehicle network message has not yet been received. In such cases,
+the In addition, some properties (such as HVAC temperature) can have a value to
+indicate it is in max power mode rather than in specific temperature value. In
+such cases, use special values to represent such state. Example: get HVAC Temperature A Some Until Example: set HVAC Temperature To support partner-specific needs, the vehicle HAL allows custom properties
+that are restricted to system apps. Use the following guidelines when working
+with custom properties: You can use the vehicle HAL to control HVAC by setting HVAC-related
+properties. Most HVAC properties are zoned properties, but a few are non-zoned
+(global) properties. Example properties defined include: For full list of HVAC properties, search for
+ Vehicle HAL sensor properties represent real sensor data or policy
+information such as driving status. Some sensor information (such as driving
+status and day/night mode) is accessible by any app without restriction as the
+data is mandatory to build a safe vehicle application. Other sensor information
+(such as vehicle speed) is more sensitive and requires specific permissions that
+users can manage. Supported sensor properties include:
-Android gives you the freedom to implement your own device specifications and
+ Android gives you the freedom to implement your own device specifications and
drivers. The hardware abstraction layer (HAL) provides a standard method for
creating software hooks between the Android platform stack and your hardware.
The Android operating system is also open source, so you can contribute your own
-interfaces and enhancements.
-
-To ensure devices maintain a high level of quality and offer a consistent user
-experience, each device must pass tests in the compatibility test suite (CTS).
-The CTS verifies devices meet a quality standard that ensures apps run reliably
-and users have a good experience. For details on the CTS, see
-Compatibility.
-
-Before porting Android to your hardware, take a moment to understand the Android
-system architecture at a high level. Because your drivers and the HAL interact
-with Android, knowing how Android works can help you navigate the many layers of
-code in the Android Open Source Project (AOSP) source tree.
-
-The application framework is used most often by application developers. As a
-hardware developer, you should be aware of developer APIs as many map directly
-to the underlying HAL interfaces and can provide helpful information about
-implementing drivers.
-
-The Binder Inter-Process Communication (IPC) mechanism allows the application
-framework to cross process boundaries and call into the Android system services
-code. This enables high level framework APIs to interact with Android system
-services. At the application framework level, this communication is hidden from
-the developer and things appear to "just work."
-
-Functionality exposed by application framework APIs communicates with system
-services to access the underlying hardware. Services are modular, focused
-components such as Window Manager, Search Service, or Notification Manager.
-Android includes two groups of services: system (services such as
-Window Manager and Notification Manager) and media (services involved
-in playing and recording media).
-
-The hardware abstraction layer (HAL) defines a standard interface for hardware
-vendors to implement and allows Android to be agnostic about lower-level driver
-implementations. The HAL allows you to implement functionality without
-affecting or modifying the higher level system. HAL implementations are
-packaged into modules (
-You must implement the corresponding HAL (and driver) for the specific hardware
-your product provides. HAL implementations are typically built into shared
-library modules (
- Each hardware-specific HAL interface has properties that are defined in
-
- A module represents your packaged HAL implementation, which is stored as a shared library ( In addition, the When you implement a HAL and create the module struct, you must name it
-
- A device abstracts the actual hardware of your product. For example, an audio module can contain
- a primary audio device, a USB audio device, or a Bluetooth A2DP audio device. A device
- is represented by the
- In addition to these standard properties, each hardware-specific HAL interface can define more of its
- own features and requirements. See the HAL reference documentation
- as well as the individual instructions for each HAL for more information on how to implement a specific interface.
- HAL implementations are built into modules ( For more information about setting up the build for each HAL, see its respective documentation.
-Developing your device drivers is similar to developing a typical Linux device
-driver. Android uses a version of the Linux kernel with a few special additions
-such as wake locks (a memory management system that is more aggressive in
-preserving memory), the Binder IPC driver, and other features important for a
-mobile embedded platform. These additions are primarily for system functionality
-and do not affect driver development.
-
-
-You can use any version of the kernel as long as it supports the required
-features (such as the binder driver). However, we recommend using the latest
-version of the Android kernel. For details on the latest Android kernel, see Building Kernels.
-.so
files), but as Android does not mandate
+a standard interaction between a HAL implementation and device drivers, you can
+do what is best for your situation. However, to enable the Android system to
+correctly interact with your hardware, you must abide by the
+contract defined in each hardware-specific HAL interface.hardware/libhardware/include/hardware/hardware.h
. This interface
+allows the Android system to load correct versions of your HAL modules in a
+consistent way. A HAL interface consists of two components: modules and devices.
+HAL modules
+.so file
). The
+hardware/libhardware/include/hardware/hardware.h
header file
+defines a struct (hw_module_t
) that represents a module and
+contains metadata such as the version, name, and author of the module. Android
+uses this metadata to find and load the HAL module correctly.hw_module_t
struct contains a pointer to
+another struct, hw_module_methods_t
, that contains a pointer to
+an open function for the module. This open function is used to initiate
+communication with the hardware for which the HAL is serving as an abstraction.
+Each hardware-specific HAL usually extends the generic hw_module_t
+struct with additional information for that specific piece of hardware. For
+example, in the camera HAL, the camera_module_t
struct contains a
+hw_module_t
struct along with other camera-specific function
+pointers:
+typedef struct camera_module {
+ hw_module_t common;
+ int (*get_number_of_cameras)(void);
+ int (*get_camera_info)(int camera_id, struct camera_info *info);
+} camera_module_t;
+
+
+HAL_MODULE_INFO_SYM
. Example from the Nexus 9 audio HAL:
+struct audio_module HAL_MODULE_INFO_SYM = {
+ .common = {
+ .tag = HARDWARE_MODULE_TAG,
+ .module_api_version = AUDIO_MODULE_API_VERSION_0_1,
+ .hal_api_version = HARDWARE_HAL_API_VERSION,
+ .id = AUDIO_HARDWARE_MODULE_ID,
+ .name = "NVIDIA Tegra Audio HAL",
+ .author = "The Android Open Source Project",
+ .methods = &hal_module_methods,
+ },
+};
+
+
+HAL devices
+hw_device_t
struct. Similar to a
+module, each type of device defines a detailed version of the generic
+hw_device_t
that contains function pointers for specific features
+of the hardware. For example, the audio_hw_device_t
struct type
+contains function pointers to audio device operations:
+struct audio_hw_device {
+ struct hw_device_t common;
+
+ /**
+ * used by audio flinger to enumerate what devices are supported by
+ * each audio_hw_device implementation.
+ *
+ * Return value is a bitmask of 1 or more values of audio_devices_t
+ */
+ uint32_t (*get_supported_devices)(const struct audio_hw_device *dev);
+ ...
+};
+typedef struct audio_hw_device audio_hw_device_t;
+
+
+Building HAL modules
+.so
) files and are
+dynamically linked by Android when appropriate. You can build your modules by
+creating Android.mk
files for each of your HAL implementations
+and pointing to your source files. In general, your shared libraries must be
+named in a specific format so they can be found and loaded properly. The naming
+scheme varies slightly from module to module, but follows the general pattern
+of: <module_type>.<device_name>
.
+Application framework
+
+Binder IPC
+System services
+Hardware abstraction layer (HAL)
+Linux kernel
+Android updates
+Testing Treble
+Coming soon
+Architecture
-
-
-
-/platform/packages/services/Car/car-lib
./platform/packages/services/Car/
.vns_policy.xml
and vendor_vns_policy.xml
.
-Located at /platform/packages/services/Car/vehicle_network_service/
;
-for libraries to access the vehicle network, refer to
-/platform/packages/services/Car/libvehiclenetwork/
.hardware/libhardware/include/hardware/vehicle.h
. For a basic
-reference implementation, refer to
-hardware/libhardware/modules/vehicle/
.Vehicle properties
-value_type
):
-
-
-INT32
(and array), INT64
, BOOLEAN
,
-FLOAT
(and array), string, bytes.Zone types
-
-
-vehicle_zone
: Zone based on rows.vehicle_seat
: Zone based on seats.vehicle_window
: Zone based on windows.Configuring a property
-vehicle_prop_config_t
to provide configuration information
-for each property. Information includes:
-
-access
(r, w, rw)change_mode
(represents how property is monitored: on change vs
-continuous)min_value
(int32, float, int64), max_value
(int32,
-float, int64)min_sample_rate
, max_sample_rate
permission_model
prop
(Property ID, int)value_type
zone_flags
(represents supported zones as bit flags)HAL interfaces
-
-
-
-
-
-vehicle_prop_config_t const *(*list_properties)(..., int*
-num_properties)
. List configuration of all properties supported by the
-vehicle HAL. Only supported properties will be used by vehicle network service.
-(*get)(..., vehicle_prop_value_t *data)
. Read the current value
-of the property. For zoned property, each zone may have different value.(*set)(..., const vehicle_prop_value_t *data)
. Write a value to
-property. Result of write is defined per each property.(*subscribe)(..., int32_t prop, float sample_rate, int32_t
-zones)
.
-
(*release_memory_from_get)(struct vehicle_hw_device* device,
-vehicle_prop_value_t *data)
. Release memory allocated from get call.
-
-
-(*vehicle_event_callback_fn)(const vehicle_prop_value_t
-*event_data)
. Notifies vehicle property's value change. Should be done
-only for subscribed properties.(*vehicle_error_callback_fn)(int32_t error_code, int32_t property,
-int32_t operation).
Return global vehicle HAL level error or error per
-each property. Global error causes HAL restart, which can lead to restarting
-other components, including applications.Handling zone properties
-
-
-
-get
call for zoned property always includes zone in request, so
-only the current value for the requested zone should be returned.set
call for zoned property always includes zone in request, so
-only the requested zone should be changed.subscribe
call includes flags of all zones subscribed. Events
-from un-subscribed zones should not be reported.Get calls
-get
call should return -EAGAIN
. Some properties
-(such as HVAC) have separate on/off power property. Calling get
for
-such a property (when powered off) should return a special value
-(VEHICLE_INT_OUT_OF_RANGE_OFF/VEHICLE_FLOAT_OUT_OF_RANGE_OFF)
-rather than returning an error.
-
-
-Set calls
-set
call is an asynchronous operation involving event
-notification after a requested change is made. In a typical operation, a
-set
call leads to making a change request across vehicle network.
-When the change is performed by the electronic control unit (ECU) owning the
-property, the updated value is returned through vehicle network and the vehicle
-HAL sends an updated value as an event to vehicle network service (VNS).set
calls may require initial data to be ready but during
-initialization, such data may not be available yet. In such cases, the
-set
call should return -EAGAIN
. Some properties with
-separate power on /off should return -ESHUTDOWN
when the property
-is powered off and set cannot be done.set
is made effective, get
does not
-necessarily return the same value as what is set. The exception is a property
-with change mode of VEHICLE_PROP_CHANGE_MODE_ON_SET.
This property
-notifies change only when it is set by external component outside Android (for
-example, clock properties such as VEHICLE_PROPERTY_UNIX_TIME
).Handling custom properties
-
-
-
-VEHICLE_PROPERTY_CUSTOM_START,
-VEHICLE_PROPERTY_CUSTOM_END
] range. Other ranges are reserved for future
-extension; using such ranges can cause conflicts in future Android releases.value_type
. BYTES type allows passing raw
-data, so this is enough in most cases. Sending big data frequently through
-custom properties can slow down the whole vehicle network access, so be careful
-when you add a big payload.vendor_vns_policy.xml
(otherwise, all
-access will be rejected).VendorExtensionManager
(for Java components) or
-via Vehicle Network Service API (for native). Do not modify other car APIs as it
-can lead to compatibility issues in the future.Handling HVAC properties
-
-
-VEHICLE_PROPERTY_HVAC_TEMPERATURE_SET
(set temperature per each
-zone).VEHICLE_PROPERTY_HVAC_RECIRC_ON
(control recirculation per each
-zone).VEHICLE_PROPERTY_HVAC_*
in vehicle.h
.Handling sensor properties
-
-
-
-DRIVING_STATUS
(should support). Represents allowed operations
-in the current driving state. This information is used to block unsafe
-applications while driving.NIGHT_MODE
(should support). Determines day/night mode of
-display.GEAR_SELECTION/CURRENT_GEAR
. Gear selected by driver vs.
-actual gear.VEHICLE_SPEED
. Vehicle speed. Protected with permission.ODOMETER
. Current odometer reading. Protected with permission.
-FUEL_LEVEL
. Current fuel level in %.FUEL_LEVEL_LOW
. Fuel level is low or not (boolean).Security
-
-
-vns_policy.xml
)Validation
-
-
-
-
-
diff --git a/en/devices/automotive/index.html b/en/devices/automotive/index.html
new file mode 100644
index 00000000..83a7a6ef
--- /dev/null
+++ b/en/devices/automotive/index.html
@@ -0,0 +1,109 @@
+
+
+ hardware/libhardware/tests/vehicle/vehicle-hal-tool.c
.
-Command-line native tool to load vehicle HAL and do simple operations. Useful
-for getting the system up and running in the early stages of development.packages/services/Car/tests/carservice_test/
. Contains car
-service testing with mocked vehicle HAL properties. For each property, expected
-behavior is implemented in the test. This can be a good starting point to
-understand expected behavior.hardware/libhardware/modules/vehicle/
. A basic reference
-implementation.Architecture
+
+
+/platform/packages/services/Car/car-lib
./platform/packages/services/Car/
.vns_policy.xml
and vendor_vns_policy.xml
.
+Located at /platform/packages/services/Car/vehicle_network_service/
;
+for libraries to access the vehicle network, refer to
+/platform/packages/services/Car/libvehiclenetwork/
.hardware/libhardware/include/hardware/vehicle.h
. For a basic
+reference implementation, refer to
+hardware/libhardware/modules/vehicle/
.Security
+
+
+vns_policy.xml
)Validation
+
+
+
+
+
diff --git a/en/devices/automotive/properties.html b/en/devices/automotive/properties.html
new file mode 100644
index 00000000..5a69edef
--- /dev/null
+++ b/en/devices/automotive/properties.html
@@ -0,0 +1,231 @@
+
+
+ hardware/libhardware/tests/vehicle/vehicle-hal-tool.c
+Command-line native tool to load vehicle HAL and do simple operations. Useful
+for getting the system up and running in the early stages of development.packages/services/Car/tests/carservice_test/
Contains car
+service testing with mocked vehicle HAL properties. For each property, expected
+behavior is implemented in the test. This can be a good starting point to
+understand expected behavior.hardware/libhardware/modules/vehicle/
A basic reference
+implementation.HAL interfaces
+
+
+
+vehicle_prop_config_t const *(*list_properties)(..., int*
+num_properties)
+
List configuration of all properties supported by the vehicle HAL. Only
+supported properties are used by vehicle network service.
+(*get)(..., vehicle_prop_value_t *data)
+
Read the current value of the property. For zoned property, each zone may
+have different value.(*set)(..., const vehicle_prop_value_t *data)
+
Write a value to property. Result of write is defined per property.(*subscribe)(..., int32_t prop, float sample_rate, int32_t
+zones)
+
+
(*release_memory_from_get)(struct vehicle_hw_device* device,
+vehicle_prop_value_t *data)
+
Release memory allocated from get call.
+
+
+(*vehicle_event_callback_fn)(const vehicle_prop_value_t
+*event_data)
+
Notifies vehicle property's value change. Should be done only for
+subscribed properties.(*vehicle_error_callback_fn)(int32_t error_code, int32_t property,
+int32_t operation)
+
Return global vehicle HAL level error or error per property. Global error
+causes HAL restart, which can lead to restarting other components (including
+applications).Vehicle properties
+value_type
):
+
+
+INT32
(and array), INT64
, BOOLEAN
,
+FLOAT
(and array), string, bytes.Zone types
+
+
+vehicle_zone
+
Zone based on rows.vehicle_seat
+
Zone based on seats.vehicle_window
+
Zone based on windows.Configuring a property
+vehicle_prop_config_t
to provide configuration information
+for each property. Information includes:
+
+access
(r, w, rw)change_mode
(represents how property is monitored: on change vs
+continuous)min_value
(int32, float, int64), max_value
(int32,
+float, int64)min_sample_rate
, max_sample_rate
permission_model
prop
(Property ID, int)value_type
zone_flags
(represents supported zones as bit flags)Handling zone properties
+
+
+
+get
call for zoned property always includes zone in request, so
+only the current value for the requested zone should be returned.set
call for zoned property always includes zone in request, so
+only the requested zone should be changed.subscribe
call includes flags of all zones subscribed. Events
+from un-subscribed zones should not be reported.Get calls
+get
call should return -EAGAIN
. Some properties
+(such as HVAC) have separate on/off power property. Calling get
for
+such a property (when powered off) should return a special value
+(VEHICLE_INT_OUT_OF_RANGE_OFF/VEHICLE_FLOAT_OUT_OF_RANGE_OFF)
+rather than returning an error.
+
+
+Set calls
+set
call is an asynchronous operation involving event
+notification after a requested change is made. In a typical operation, a
+set
call leads to making a change request across vehicle network.
+When the change is performed by the electronic control unit (ECU) owning the
+property, the updated value is returned through vehicle network and the vehicle
+HAL sends an updated value as an event to vehicle network service (VNS).set
calls may require initial data to be ready but during
+initialization, such data may not be available yet. In such cases, the
+set
call should return -EAGAIN
. Some properties with
+separate power on /off should return -ESHUTDOWN
when the property
+is powered off and set cannot be done.set
is made effective, get
does not
+necessarily return the same value as what is set. The exception is a property
+with change mode of VEHICLE_PROP_CHANGE_MODE_ON_SET.
This property
+notifies change only when it is set by external component outside Android (for
+example, clock properties such as VEHICLE_PROPERTY_UNIX_TIME
).Handling custom properties
+
+
+
+VEHICLE_PROPERTY_CUSTOM_START,
+VEHICLE_PROPERTY_CUSTOM_END
] range. Other ranges are reserved for future
+extension; using such ranges can cause conflicts in future Android releases.value_type
. BYTES type allows passing raw
+data, so this is enough in most cases. Sending big data frequently through
+custom properties can slow down the whole vehicle network access, so be careful
+when you add a big payload.vendor_vns_policy.xml
(otherwise, all
+access will be rejected).VendorExtensionManager
(for Java components) or
+via Vehicle Network Service API (for native). Do not modify other car APIs as it
+can lead to compatibility issues in the future.Handling HVAC properties
+
+
+VEHICLE_PROPERTY_HVAC_TEMPERATURE_SET
+
Set temperature per zone.VEHICLE_PROPERTY_HVAC_RECIRC_ON
+
Control recirculation per zone).VEHICLE_PROPERTY_HVAC_*
in vehicle.h
.Handling sensor properties
+
+
+
+
+
diff --git a/en/devices/images/ape_fwk_hal.png b/en/devices/images/ape_fwk_hal.png
index 03f27e94..c22b2984 100644
Binary files a/en/devices/images/ape_fwk_hal.png and b/en/devices/images/ape_fwk_hal.png differ
diff --git a/en/devices/index.html b/en/devices/index.html
index 49bea636..e6d7b152 100644
--- a/en/devices/index.html
+++ b/en/devices/index.html
@@ -21,190 +21,27 @@
limitations under the License.
-->
-
-
-DRIVING_STATUS
+
Should support. Represents allowed operations in the current driving state.
+This information is used to block unsafe applications while driving.NIGHT_MODE
+
Should support. Determines day/night mode of display.GEAR_SELECTION/CURRENT_GEAR
+
Gear selected by driver vs. actual gear.VEHICLE_SPEED
+
Vehicle speed. Protected with permission.ODOMETER
+
Current odometer reading. Protected with permission.
+FUEL_LEVEL
+
Current fuel level in %.FUEL_LEVEL_LOW
+
Fuel level is low or not (boolean).Application framework
-Binder IPC
-System services
-Hardware abstraction layer (HAL)
-.so
) file and loaded by the Android system
-at the appropriate time.
-.so
files). Android does not mandate a standard
-interaction between your HAL implementation and your device drivers, so you have
-free reign to do what is best for your situation. However, to enable the Android
-system to correctly interact with your hardware, you must abide
-by the contract defined in each hardware-specific HAL interface.
-Standard HAL structure
-hardware/libhardware/include/hardware/hardware.h
, which
- guarantee that HALs have a predictable structure.
- This interface allows the Android system to load the correct versions of your
- HAL modules in a consistent way. There are two general components
- that a HAL interface consists of: a module and a device.
-.so file
). It contains
- metadata such as the version, name, and author of the module, which helps Android find and load it correctly. The
- hardware/libhardware/include/hardware/hardware.h
header file defines a
- struct, hw_module_t
, that represents a module and contains information such as
- the module version, author, and name.hw_module_t
struct contains
- a pointer to another struct, hw_module_methods_t
, that contains a pointer to
- an "open" function for the module. This open function is used to initiate communication with
- the hardware that the HAL is serving as an abstraction for. Each hardware-specific HAL usually
- extends the generic hw_module_t
struct with additional information
- for that specific piece of hardware. For example in the camera HAL, the camera_module_t
struct
- contains a hw_module_t
struct along with other camera-specific function pointers:
-
-typedef struct camera_module {
- hw_module_t common;
- int (*get_number_of_cameras)(void);
- int (*get_camera_info)(int camera_id, struct camera_info *info);
-} camera_module_t;
-
-
-HAL_MODULE_INFO_SYM
. For instance, here is an example from the Nexus 9 audio HAL:
-struct audio_module HAL_MODULE_INFO_SYM = {
- .common = {
- .tag = HARDWARE_MODULE_TAG,
- .module_api_version = AUDIO_MODULE_API_VERSION_0_1,
- .hal_api_version = HARDWARE_HAL_API_VERSION,
- .id = AUDIO_HARDWARE_MODULE_ID,
- .name = "NVIDIA Tegra Audio HAL",
- .author = "The Android Open Source Project",
- .methods = &hal_module_methods,
- },
-};
-
-hw_device_t
struct. Like a module, each type of device
- defines a more-detailed version of the generic hw_device_t
that contains
- function pointers for specific features of the hardware. For example, the
- audio_hw_device_t
struct type contains function pointers to audio device operations:
-
-struct audio_hw_device {
- struct hw_device_t common;
-
- /**
- * used by audio flinger to enumerate what devices are supported by
- * each audio_hw_device implementation.
- *
- * Return value is a bitmask of 1 or more values of audio_devices_t
- */
- uint32_t (*get_supported_devices)(const struct audio_hw_device *dev);
- ...
-};
-typedef struct audio_hw_device audio_hw_device_t;
-
-
-HAL modules
-.so
) files and are dynamically linked by Android when appropriate.
- You can build your modules by creating Android.mk
files for each of your HAL implementations
- and pointing to your source files. In general, your shared libraries must be named in a certain format, so that
- they can be found and loaded properly. The naming scheme varies slightly from module to module, but they follow
- the general pattern of: <module_type>.<device_name>
.Linux kernel
-
Before porting Android to your hardware, take a moment to understand the +Android system architecture. +Because your drivers and the HAL interact with Android, knowing its structure +can help you navigate the many layers of code in the Android Open Source Project +(AOSP) source tree. When you are comfortable with the basic Android +architecture, review the interface-specific documentation in this section to +learn about specific HALs and how to build them for your device.
+ +To maintain a high level of quality and offer a consistent user experience, +Android requires that all implementations meet the requirements stated in the +Compatibility Definition Document (CDD) +and that all devices pass tests in the +Compatibility Test Suite (CTS). For +details on the Android compatibility program, see +Compatibility.