From e279306e5788502386a62940d405a9866b5d6fa2 Mon Sep 17 00:00:00 2001 From: Aaqib Ismail Date: Tue, 5 Sep 2023 17:20:49 -0700 Subject: [PATCH 1/2] Add missing status codes Bug: 299191602 Test: m Change-Id: I65a74ac6e93ec5ffcf32b54b6a11c983b1c32262 --- .../automotive/vehicle/StatusCode.proto | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/StatusCode.proto b/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/StatusCode.proto index 63d7933e7d..95e766a2ea 100644 --- a/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/StatusCode.proto +++ b/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/StatusCode.proto @@ -38,6 +38,37 @@ enum StatusCode { /* Something unexpected has happened in Vehicle HAL */ INTERNAL_ERROR = 5; + + /** + * For features that are not available because the underlying feature is + * disabled. + */ + NOT_AVAILABLE_DISABLED = 6; + + /** + * For features that are not available because the vehicle speed is too low. + */ + NOT_AVAILABLE_SPEED_LOW = 7; + + /** + * For features that are not available because the vehicle speed is too + * high. + */ + NOT_AVAILABLE_SPEED_HIGH = 8; + + /** + * For features that are not available because of bad camera or sensor + * visibility. Examples might be bird poop blocking the camera or a bumper + * cover blocking an ultrasonic sensor. + */ + NOT_AVAILABLE_POOR_VISIBILITY = 9; + + /** + * The feature cannot be accessed due to safety reasons. Eg. System could be + * in a faulty state, an object or person could be blocking the requested + * operation such as closing a trunk door, etc. + */ + NOT_AVAILABLE_SAFETY = 10; }; message VehicleHalCallStatus { From 810144a1682f9f0dfde64c08c04cdef16e234611 Mon Sep 17 00:00:00 2001 From: Aaqib Ismail Date: Tue, 5 Sep 2023 17:49:55 -0700 Subject: [PATCH 2/2] Add missing supportedEnumValues Bug: 299192013 Test: m Change-Id: I36d1e4942cb44604539e384bde9300ac8ca8eba2 --- .../src/ProtoMessageConverter.cpp | 10 +++++++++- .../automotive/vehicle/VehicleAreaConfig.proto | 7 +++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/automotive/vehicle/aidl/impl/grpc/utils/proto_message_converter/src/ProtoMessageConverter.cpp b/automotive/vehicle/aidl/impl/grpc/utils/proto_message_converter/src/ProtoMessageConverter.cpp index 6cbc7e523e..6b789bb7a9 100644 --- a/automotive/vehicle/aidl/impl/grpc/utils/proto_message_converter/src/ProtoMessageConverter.cpp +++ b/automotive/vehicle/aidl/impl/grpc/utils/proto_message_converter/src/ProtoMessageConverter.cpp @@ -73,6 +73,11 @@ void aidlToProto(const aidl_vehicle::VehiclePropConfig& in, proto::VehiclePropCo protoACfg->set_max_float_value(areaConfig.maxFloatValue); protoACfg->set_min_int32_value(areaConfig.minInt32Value); protoACfg->set_max_int32_value(areaConfig.maxInt32Value); + if (areaConfig.supportedEnumValues.has_value()) { + for (auto& supportedEnumValue : areaConfig.supportedEnumValues.value()) { + protoACfg->add_supported_enum_values(supportedEnumValue); + } + } } } @@ -87,7 +92,7 @@ void protoToAidl(const proto::VehiclePropConfig& in, aidl_vehicle::VehiclePropCo COPY_PROTOBUF_VEC_TO_VHAL_TYPE(in, config_array, out, configArray); auto cast_to_acfg = [](const proto::VehicleAreaConfig& protoAcfg) { - return aidl_vehicle::VehicleAreaConfig{ + auto vehicleAreaConfig = aidl_vehicle::VehicleAreaConfig{ .areaId = protoAcfg.area_id(), .minInt32Value = protoAcfg.min_int32_value(), .maxInt32Value = protoAcfg.max_int32_value(), @@ -96,6 +101,9 @@ void protoToAidl(const proto::VehiclePropConfig& in, aidl_vehicle::VehiclePropCo .minFloatValue = protoAcfg.min_float_value(), .maxFloatValue = protoAcfg.max_float_value(), }; + COPY_PROTOBUF_VEC_TO_VHAL_TYPE(protoAcfg, supported_enum_values, (&vehicleAreaConfig), + supportedEnumValues.value()); + return vehicleAreaConfig; }; CAST_COPY_PROTOBUF_VEC_TO_VHAL_TYPE(in, area_configs, out, areaConfigs, cast_to_acfg); } diff --git a/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/VehicleAreaConfig.proto b/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/VehicleAreaConfig.proto index b5b7e8070a..ddc64d940d 100644 --- a/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/VehicleAreaConfig.proto +++ b/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/VehicleAreaConfig.proto @@ -36,4 +36,11 @@ message VehicleAreaConfig { float min_float_value = 6; float max_float_value = 7; + + /** + * If the property has a @data_enum, then it is possible to specify a supported subset of the + * @data_enum. If the property has a @data_enum and supported_enum_values is null, then it is + * assumed all @data_enum values are supported unless specified through another mechanism. + */ + repeated int64 supported_enum_values = 8; };