automotive aidl: Add required @RustDerive annotations

Derive vehicle hal parcelables from the Clone trait where applicable. This is is
supportive for implementing a vehicle hal service in Rust because caching e.g
VehiclePropValue or VehiclePropConfig instances allow less verbose code and
increase performance. Cloning a VehiclePropConfig instead of constructing each
time needed is less verbose. Property configs are normally not updated at
runtime.

This is not an API change, so in order to avoid having to bump the AIDL
API version for this HAL we used the hash_gen.sh script as below:

$ m android.hardware.automotive.vehicle-update-api
$ m android.hardware.automotive.vehicle-freeze-api

$ vim vehicle/aidl/Android.bp # removed frozen_api argument and the newly
created version 3 block

$ cp -r aidl_api/android.hardware.automotive.vehicle/3/* aidl_api/android.hardware.automotive.vehicle/2/
$ rm -rf aidl_api/android.hardware.automotive.vehicle/3/

./system/tools/aidl/build/hash_gen.sh \
    hardware/interfaces/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2 \
    1 \
    hardware/interfaces/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/.hash

Test: manual - used new derives in custom implementation
Change-Id: I586b89b160eb7a01ce24fad211b9e909175cdd3c
Merged-In: I889c0d51f2c2633908231dd39c9ea5259de36667
This commit is contained in:
Felix Obenhuber 2024-02-15 09:56:08 +01:00 committed by Yu Shan
parent 55fb557a81
commit 38f12da7b8
31 changed files with 31 additions and 20 deletions

View file

@ -1 +1,2 @@
a741c2814ba6e9852e106bc26e820d741f66ebb8
2e101035a8abf667295ca2106bebb8850b9bdc9c

View file

@ -32,7 +32,7 @@
// later when a module using the interface is updated, e.g., Mainline modules.
package android.hardware.automotive.vehicle;
@JavaDerive(equals=true, toString=true) @VintfStability
@JavaDerive(equals=true, toString=true) @RustDerive(Clone=true) @VintfStability
parcelable GetValueRequest {
long requestId;
android.hardware.automotive.vehicle.VehiclePropValue prop;

View file

@ -32,7 +32,7 @@
// later when a module using the interface is updated, e.g., Mainline modules.
package android.hardware.automotive.vehicle;
@JavaDerive(equals=true, toString=true) @VintfStability
@JavaDerive(equals=true, toString=true) @RustDerive(Clone=true) @VintfStability
parcelable GetValueResult {
long requestId;
android.hardware.automotive.vehicle.StatusCode status = android.hardware.automotive.vehicle.StatusCode.OK;

View file

@ -32,7 +32,7 @@
// later when a module using the interface is updated, e.g., Mainline modules.
package android.hardware.automotive.vehicle;
@JavaDerive(equals=true, toString=true) @VintfStability
@JavaDerive(equals=true, toString=true) @RustDerive(Clone=true) @VintfStability
parcelable RawPropValues {
int[] int32Values = {};
float[] floatValues;

View file

@ -32,7 +32,7 @@
// later when a module using the interface is updated, e.g., Mainline modules.
package android.hardware.automotive.vehicle;
@JavaDerive(equals=true, toString=true) @VintfStability
@JavaDerive(equals=true, toString=true) @RustDerive(Clone=true) @VintfStability
parcelable SetValueRequest {
long requestId;
android.hardware.automotive.vehicle.VehiclePropValue value;

View file

@ -32,7 +32,7 @@
// later when a module using the interface is updated, e.g., Mainline modules.
package android.hardware.automotive.vehicle;
@JavaDerive(equals=true, toString=true) @VintfStability
@JavaDerive(equals=true, toString=true) @RustDerive(Clone=true) @VintfStability
parcelable SetValueResult {
long requestId;
android.hardware.automotive.vehicle.StatusCode status = android.hardware.automotive.vehicle.StatusCode.OK;

View file

@ -32,7 +32,7 @@
// later when a module using the interface is updated, e.g., Mainline modules.
package android.hardware.automotive.vehicle;
@JavaDerive(equals=true, toString=true) @VintfStability
@JavaDerive(equals=true, toString=true) @RustDerive(Clone=true) @VintfStability
parcelable SubscribeOptions {
int propId;
int[] areaIds;

View file

@ -32,7 +32,7 @@
// later when a module using the interface is updated, e.g., Mainline modules.
package android.hardware.automotive.vehicle;
@JavaDerive(equals=true, toString=true) @VintfStability
@JavaDerive(equals=true, toString=true) @RustDerive(Clone=true) @VintfStability
parcelable VehicleAreaConfig {
int areaId;
int minInt32Value;

View file

@ -32,7 +32,7 @@
// later when a module using the interface is updated, e.g., Mainline modules.
package android.hardware.automotive.vehicle;
@JavaDerive(equals=true, toString=true) @VintfStability
@JavaDerive(equals=true, toString=true) @RustDerive(Clone=true) @VintfStability
parcelable VehiclePropConfig {
int prop;
android.hardware.automotive.vehicle.VehiclePropertyAccess access = android.hardware.automotive.vehicle.VehiclePropertyAccess.NONE;

View file

@ -32,7 +32,7 @@
// later when a module using the interface is updated, e.g., Mainline modules.
package android.hardware.automotive.vehicle;
@JavaDerive(equals=true, toString=true) @VintfStability
@JavaDerive(equals=true, toString=true) @RustDerive(Clone=true) @VintfStability
parcelable VehiclePropError {
int propId;
int areaId;

View file

@ -32,7 +32,7 @@
// later when a module using the interface is updated, e.g., Mainline modules.
package android.hardware.automotive.vehicle;
@JavaDerive(equals=true, toString=true) @VintfStability
@JavaDerive(equals=true, toString=true) @RustDerive(Clone=true) @VintfStability
parcelable VehiclePropValue {
long timestamp;
int areaId;

View file

@ -32,7 +32,7 @@
// later when a module using the interface is updated, e.g., Mainline modules.
package android.hardware.automotive.vehicle;
@JavaDerive(equals=true, toString=true) @VintfStability
@JavaDerive(equals=true, toString=true) @RustDerive(Clone=true) @VintfStability
parcelable GetValueRequest {
long requestId;
android.hardware.automotive.vehicle.VehiclePropValue prop;

View file

@ -32,7 +32,7 @@
// later when a module using the interface is updated, e.g., Mainline modules.
package android.hardware.automotive.vehicle;
@JavaDerive(equals=true, toString=true) @VintfStability
@JavaDerive(equals=true, toString=true) @RustDerive(Clone=true) @VintfStability
parcelable GetValueResult {
long requestId;
android.hardware.automotive.vehicle.StatusCode status = android.hardware.automotive.vehicle.StatusCode.OK;

View file

@ -32,7 +32,7 @@
// later when a module using the interface is updated, e.g., Mainline modules.
package android.hardware.automotive.vehicle;
@JavaDerive(equals=true, toString=true) @VintfStability
@JavaDerive(equals=true, toString=true) @RustDerive(Clone=true) @VintfStability
parcelable RawPropValues {
int[] int32Values = {};
float[] floatValues;

View file

@ -32,7 +32,7 @@
// later when a module using the interface is updated, e.g., Mainline modules.
package android.hardware.automotive.vehicle;
@JavaDerive(equals=true, toString=true) @VintfStability
@JavaDerive(equals=true, toString=true) @RustDerive(Clone=true) @VintfStability
parcelable SetValueRequest {
long requestId;
android.hardware.automotive.vehicle.VehiclePropValue value;

View file

@ -32,7 +32,7 @@
// later when a module using the interface is updated, e.g., Mainline modules.
package android.hardware.automotive.vehicle;
@JavaDerive(equals=true, toString=true) @VintfStability
@JavaDerive(equals=true, toString=true) @RustDerive(Clone=true) @VintfStability
parcelable SetValueResult {
long requestId;
android.hardware.automotive.vehicle.StatusCode status = android.hardware.automotive.vehicle.StatusCode.OK;

View file

@ -32,7 +32,7 @@
// later when a module using the interface is updated, e.g., Mainline modules.
package android.hardware.automotive.vehicle;
@JavaDerive(equals=true, toString=true) @VintfStability
@JavaDerive(equals=true, toString=true) @RustDerive(Clone=true) @VintfStability
parcelable SubscribeOptions {
int propId;
int[] areaIds;

View file

@ -32,7 +32,7 @@
// later when a module using the interface is updated, e.g., Mainline modules.
package android.hardware.automotive.vehicle;
@JavaDerive(equals=true, toString=true) @VintfStability
@JavaDerive(equals=true, toString=true) @RustDerive(Clone=true) @VintfStability
parcelable VehicleAreaConfig {
int areaId;
int minInt32Value;

View file

@ -32,7 +32,7 @@
// later when a module using the interface is updated, e.g., Mainline modules.
package android.hardware.automotive.vehicle;
@JavaDerive(equals=true, toString=true) @VintfStability
@JavaDerive(equals=true, toString=true) @RustDerive(Clone=true) @VintfStability
parcelable VehiclePropConfig {
int prop;
android.hardware.automotive.vehicle.VehiclePropertyAccess access = android.hardware.automotive.vehicle.VehiclePropertyAccess.NONE;

View file

@ -32,7 +32,7 @@
// later when a module using the interface is updated, e.g., Mainline modules.
package android.hardware.automotive.vehicle;
@JavaDerive(equals=true, toString=true) @VintfStability
@JavaDerive(equals=true, toString=true) @RustDerive(Clone=true) @VintfStability
parcelable VehiclePropError {
int propId;
int areaId;

View file

@ -32,7 +32,7 @@
// later when a module using the interface is updated, e.g., Mainline modules.
package android.hardware.automotive.vehicle;
@JavaDerive(equals=true, toString=true) @VintfStability
@JavaDerive(equals=true, toString=true) @RustDerive(Clone=true) @VintfStability
parcelable VehiclePropValue {
long timestamp;
int areaId;

View file

@ -20,6 +20,7 @@ import android.hardware.automotive.vehicle.VehiclePropValue;
@VintfStability
@JavaDerive(equals=true, toString=true)
@RustDerive(Clone=true)
parcelable GetValueRequest {
// A unique request ID. For every client, the request ID must start with 1
// and monotonically increase for every SetValueRequest. If it hits

View file

@ -21,6 +21,7 @@ import android.hardware.automotive.vehicle.VehiclePropValue;
@VintfStability
@JavaDerive(equals=true, toString=true)
@RustDerive(Clone=true)
parcelable GetValueResult {
// The ID for the request this response is for.
long requestId;

View file

@ -18,6 +18,7 @@ package android.hardware.automotive.vehicle;
@VintfStability
@JavaDerive(equals=true, toString=true)
@RustDerive(Clone=true)
parcelable RawPropValues {
/**
* This is used for properties of types VehiclePropertyType#INT32,

View file

@ -20,6 +20,7 @@ import android.hardware.automotive.vehicle.VehiclePropValue;
@VintfStability
@JavaDerive(equals=true, toString=true)
@RustDerive(Clone=true)
parcelable SetValueRequest {
// A unique request ID. For every client, the request ID must start with 1
// and monotonically increase for every SetValueRequest. If it hits

View file

@ -20,6 +20,7 @@ import android.hardware.automotive.vehicle.StatusCode;
@VintfStability
@JavaDerive(equals=true, toString=true)
@RustDerive(Clone=true)
parcelable SetValueResult {
// The ID for the request this response is for.
long requestId;

View file

@ -21,6 +21,7 @@ package android.hardware.automotive.vehicle;
*/
@VintfStability
@JavaDerive(equals=true, toString=true)
@RustDerive(Clone=true)
parcelable SubscribeOptions {
/** Property to subscribe */
int propId;

View file

@ -20,6 +20,7 @@ import android.hardware.automotive.vehicle.VehiclePropertyAccess;
@VintfStability
@JavaDerive(equals=true, toString=true)
@RustDerive(Clone=true)
parcelable VehicleAreaConfig {
/**
* Area id is always 0 for VehicleArea#GLOBAL properties.

View file

@ -22,6 +22,7 @@ import android.hardware.automotive.vehicle.VehiclePropertyChangeMode;
@VintfStability
@JavaDerive(equals=true, toString=true)
@RustDerive(Clone=true)
parcelable VehiclePropConfig {
/** Property identifier */
int prop;

View file

@ -20,6 +20,7 @@ import android.hardware.automotive.vehicle.StatusCode;
@VintfStability
@JavaDerive(equals=true, toString=true)
@RustDerive(Clone=true)
parcelable VehiclePropError {
// Property ID.
int propId;

View file

@ -26,6 +26,7 @@ import android.hardware.automotive.vehicle.VehiclePropertyStatus;
*/
@VintfStability
@JavaDerive(equals=true, toString=true)
@RustDerive(Clone=true)
parcelable VehiclePropValue {
/** Time is elapsed nanoseconds since boot */
long timestamp;