This tutorial will cover a specific use case with Android Automotive: how to dynamically change vehicle properties?
Concepts
In Android Automotive, several parameters of the vehicle are abstracted by the Vehicle HAL and handled via Vehicle Properties.
These parameters include the vehicle speed, doors opening, gear selection, fuel level, and many more (see VehiclePropertyIds for a more detailed list).
In a real vehicle, the Vehicle HAL continuously communicates with various vehicle sensors and ECUs to retrieve the value of these parameters and expose them to the Android apps.
In an automotive emulator, the VHAL is not connected to any real hardware. For testing and demonstration purposes, we implemented a way to dynamically inject values for these properties via a gRPC server (running on the device) and a gRPC client (running either on the device or on a host machine).
This allows you to mock the state of the vehicle in a simple way, which can be very useful in the context of automated tests.
Using the gRPC client
For this example, we have implemented a small gRPC client which is able to get and set the values of a subset of vehicle properties. You can try it as follows:
- On the device, click on the icon
at the bottom navigation area, swipe to the right and start the VehicleDemo application. It displays the current state of some vehicle properties:
- Open a new browser tab with the IP address of your device, and go to the Shell panel:

- Run the following commands:
# Open the fuel door:
./system/vendor/bin/grpc-vhal-aidl-client -s 0.0.0.0:45001 -i 287310600 -v 1
# Connecting to server at 0.0.0.0:45001
# Connected to the server at 0.0.0.0:45001
# Setting the value of 287310600 to 1
# Get whether the fuel door is opened (1) or not (0):
./system/vendor/bin/grpc-vhal-aidl-client -s 0.0.0.0:45001 -i 287310600
# Connecting to server at 0.0.0.0:45001
# Connected to the server at 0.0.0.0:45001
# The value of 287310600 is:
# VehiclePropValue{timestamp: 288592858284, areaId: 0, prop: 287310600, status: AVAILABLE,
# value: RawPropValues{int32Values: [1], floatValues: [], int64Values: [], byteValues: [], stringValue: }}The fuel door now appears in red in the VehicleDemo application:

This small demonstration client only covers a subset of vehicle properties, but the good news is that you can implement your own gRPC client!
Access the gRPC server
The gRPC server running on the device is accessible via TCP requests on <virtual_device_IP_address:45001> (don’t forget to open this port in your AWS EC2 security group). Then you can implement your gRPC client by relying on the AAOS VehicleServer.proto gRPC APIs and the corresponding proto files.
