diff --git a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h index 6b94277b0f..2d9af05b8a 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h @@ -86,6 +86,7 @@ std::unordered_map AccessForVehiclePrope {VehicleProperty::TRACTION_CONTROL_ACTIVE, VehiclePropertyAccess::READ}, {VehicleProperty::EV_STOPPING_MODE, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::ELECTRONIC_STABILITY_CONTROL_ENABLED, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::ELECTRONIC_STABILITY_CONTROL_STATE, VehiclePropertyAccess::READ}, {VehicleProperty::HVAC_FAN_SPEED, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::HVAC_FAN_DIRECTION, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::HVAC_TEMPERATURE_CURRENT, VehiclePropertyAccess::READ}, diff --git a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h index 94cf4e8c73..1faa382209 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h @@ -86,6 +86,7 @@ std::unordered_map ChangeModeForVehi {VehicleProperty::TRACTION_CONTROL_ACTIVE, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::EV_STOPPING_MODE, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::ELECTRONIC_STABILITY_CONTROL_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::ELECTRONIC_STABILITY_CONTROL_STATE, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::HVAC_FAN_SPEED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::HVAC_FAN_DIRECTION, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::HVAC_TEMPERATURE_CURRENT, VehiclePropertyChangeMode::ON_CHANGE}, diff --git a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java index 0232eba11a..ff48e4cbdd 100644 --- a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java @@ -78,6 +78,7 @@ public final class AccessForVehicleProperty { Map.entry(VehicleProperty.TRACTION_CONTROL_ACTIVE, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.EV_STOPPING_MODE, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.ELECTRONIC_STABILITY_CONTROL_ENABLED, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.ELECTRONIC_STABILITY_CONTROL_STATE, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.HVAC_FAN_SPEED, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.HVAC_FAN_DIRECTION, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.HVAC_TEMPERATURE_CURRENT, VehiclePropertyAccess.READ), diff --git a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java index d4ef724057..1f2c2fa199 100644 --- a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java @@ -78,6 +78,7 @@ public final class ChangeModeForVehicleProperty { Map.entry(VehicleProperty.TRACTION_CONTROL_ACTIVE, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.EV_STOPPING_MODE, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.ELECTRONIC_STABILITY_CONTROL_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.ELECTRONIC_STABILITY_CONTROL_STATE, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.HVAC_FAN_SPEED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.HVAC_FAN_DIRECTION, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.HVAC_TEMPERATURE_CURRENT, VehiclePropertyChangeMode.ON_CHANGE), diff --git a/automotive/vehicle/aidl/generated_lib/java/EnumForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/EnumForVehicleProperty.java index 80fd556096..b2ee4c0126 100644 --- a/automotive/vehicle/aidl/generated_lib/java/EnumForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/EnumForVehicleProperty.java @@ -43,6 +43,7 @@ public final class EnumForVehicleProperty { Map.entry(VehicleProperty.TURN_SIGNAL_STATE, List.of(VehicleTurnSignal.class)), Map.entry(VehicleProperty.IGNITION_STATE, List.of(VehicleIgnitionState.class)), Map.entry(VehicleProperty.EV_STOPPING_MODE, List.of(EvStoppingMode.class)), + Map.entry(VehicleProperty.ELECTRONIC_STABILITY_CONTROL_STATE, List.of(ElectronicStabilityControlState.class, ErrorState.class)), Map.entry(VehicleProperty.HVAC_FAN_DIRECTION, List.of(VehicleHvacFanDirection.class)), Map.entry(VehicleProperty.HVAC_TEMPERATURE_DISPLAY_UNITS, List.of(VehicleUnit.class)), Map.entry(VehicleProperty.HVAC_FAN_DIRECTION_AVAILABLE, List.of(VehicleHvacFanDirection.class)), diff --git a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp index 2b99d7ad8e..371acbeda1 100644 --- a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp +++ b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp @@ -45,6 +45,7 @@ using ::aidl::android::hardware::automotive::vehicle::DriverDistractionState; using ::aidl::android::hardware::automotive::vehicle::DriverDistractionWarning; using ::aidl::android::hardware::automotive::vehicle::DriverDrowsinessAttentionState; using ::aidl::android::hardware::automotive::vehicle::DriverDrowsinessAttentionWarning; +using ::aidl::android::hardware::automotive::vehicle::ElectronicStabilityControlState; using ::aidl::android::hardware::automotive::vehicle::EmergencyLaneKeepAssistState; using ::aidl::android::hardware::automotive::vehicle::ErrorState; using ::aidl::android::hardware::automotive::vehicle::EvConnectorType; @@ -291,6 +292,8 @@ JsonValueParser::JsonValueParser() { std::make_unique>(); mConstantParsersByType["LowSpeedCollisionWarningState"] = std::make_unique>(); + mConstantParsersByType["ElectronicStabilityControlState"] = + std::make_unique>(); mConstantParsersByType["Constants"] = std::make_unique(); #ifdef ENABLE_VEHICLE_HAL_TEST_PROPERTIES mConstantParsersByType["TestVendorProperty"] = diff --git a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json index 3dcdb9d3f3..3c32587b6e 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json +++ b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json @@ -4136,6 +4136,27 @@ 1 ] } + }, + { + "property": "VehicleProperty::ELECTRONIC_STABILITY_CONTROL_STATE", + "defaultValue": { + "int32Values": [ + "ElectronicStabilityControlState::ENABLED" + ] + }, + "areas": [ + { + "areaId": 0, + "supportedEnumValues": [ + "ErrorState::NOT_AVAILABLE_SAFETY", + "ErrorState::NOT_AVAILABLE_SPEED_HIGH", + "ErrorState::NOT_AVAILABLE_SPEED_LOW", + "ErrorState::NOT_AVAILABLE_DISABLED", + "ElectronicStabilityControlState::ENABLED", + "ElectronicStabilityControlState::ACTIVATED" + ] + } + ] } ] } diff --git a/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp b/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp index 8df0451bde..0c1e4b9e85 100644 --- a/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp +++ b/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp @@ -232,6 +232,13 @@ const std::unordered_map> mAdasEnabledPropToAdasPr toInt(VehicleProperty::LOW_SPEED_COLLISION_WARNING_STATE), }, }, + // ESC + { + toInt(VehicleProperty::ELECTRONIC_STABILITY_CONTROL_ENABLED), + { + toInt(VehicleProperty::ELECTRONIC_STABILITY_CONTROL_STATE), + }, + }, }; } // namespace diff --git a/automotive/vehicle/aidl/impl/fake_impl/hardware/test/FakeVehicleHardwareTest.cpp b/automotive/vehicle/aidl/impl/fake_impl/hardware/test/FakeVehicleHardwareTest.cpp index e1506c7d7e..6d2efd5b5c 100644 --- a/automotive/vehicle/aidl/impl/fake_impl/hardware/test/FakeVehicleHardwareTest.cpp +++ b/automotive/vehicle/aidl/impl/fake_impl/hardware/test/FakeVehicleHardwareTest.cpp @@ -1647,6 +1647,61 @@ std::vector setSpecialValueTestCases() { }, }, }, + SetSpecialValueTestCase{ + .name = "set_electronic_stability_control_enabled_false", + .valuesToSet = + { + VehiclePropValue{ + .prop = toInt( + VehicleProperty:: + ELECTRONIC_STABILITY_CONTROL_ENABLED), + .value.int32Values = {0}, + }, + }, + .expectedValuesToGet = + { + VehiclePropValue{ + .prop = toInt( + VehicleProperty:: + ELECTRONIC_STABILITY_CONTROL_ENABLED), + .value.int32Values = {0}, + }, + VehiclePropValue{ + .prop = toInt( + VehicleProperty:: + ELECTRONIC_STABILITY_CONTROL_STATE), + .value.int32Values = {toInt( + ErrorState::NOT_AVAILABLE_DISABLED)}, + }, + }, + }, + SetSpecialValueTestCase{ + .name = "set_electronic_stability_control_enabled_true", + .valuesToSet = + { + VehiclePropValue{ + .prop = toInt( + VehicleProperty:: + ELECTRONIC_STABILITY_CONTROL_ENABLED), + .value.int32Values = {1}, + }, + }, + .expectedValuesToGet = + { + VehiclePropValue{ + .prop = toInt( + VehicleProperty:: + ELECTRONIC_STABILITY_CONTROL_ENABLED), + .value.int32Values = {1}, + }, + VehiclePropValue{ + .prop = toInt( + VehicleProperty:: + ELECTRONIC_STABILITY_CONTROL_STATE), + .value.int32Values = {1}, + }, + }, + }, SetSpecialValueTestCase{ .name = "set_shutdown_request", .valuesToSet = @@ -2211,6 +2266,13 @@ TEST_F(FakeVehicleHardwareTest, testSendAdasPropertiesState) { toInt(VehicleProperty::LOW_SPEED_COLLISION_WARNING_STATE), }, }, + // ESC + { + toInt(VehicleProperty::ELECTRONIC_STABILITY_CONTROL_ENABLED), + { + toInt(VehicleProperty::ELECTRONIC_STABILITY_CONTROL_STATE), + }, + }, }; // First subscribe to all the properties that we will change. diff --git a/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h b/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h index 1e83c8ae16..8e990fc415 100644 --- a/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h +++ b/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/ElectronicStabilityControlState.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/ElectronicStabilityControlState.aidl new file mode 100644 index 0000000000..b061a25ecf --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/ElectronicStabilityControlState.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/////////////////////////////////////////////////////////////////////////////// +// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // +/////////////////////////////////////////////////////////////////////////////// + +// This file is a snapshot of an AIDL file. Do not edit it manually. There are +// two cases: +// 1). this is a frozen version file - do not edit this in any case. +// 2). this is a 'current' file. If you make a backwards compatible change to +// the interface (from the latest frozen version), the build system will +// prompt you to update this file with `m -update-api`. +// +// You must not make a backward incompatible change to any AIDL file built +// with the aidl_interface module type with versions property set. The module +// type is used to build AIDL files in a way that they can be used across +// independently updatable components of the system. If a device is shipped +// with such a backward incompatible change, it has a high risk of breaking +// later when a module using the interface is updated, e.g., Mainline modules. + +package android.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum ElectronicStabilityControlState { + OTHER = 0, + ENABLED = 1, + ACTIVATED = 2, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl index 827aa3ec5f..79b6efb611 100644 --- a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -84,6 +84,7 @@ enum VehicleProperty { TRACTION_CONTROL_ACTIVE = (((0x040B + 0x10000000) + 0x01000000) + 0x00200000) /* 287310859 */, EV_STOPPING_MODE = (((0x040D + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289408013 */, ELECTRONIC_STABILITY_CONTROL_ENABLED = (((0x040E + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287310862 */, + ELECTRONIC_STABILITY_CONTROL_STATE = (((0x040F + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289408015 */, HVAC_FAN_SPEED = (((0x0500 + 0x10000000) + 0x05000000) + 0x00400000) /* 356517120 */, HVAC_FAN_DIRECTION = (((0x0501 + 0x10000000) + 0x05000000) + 0x00400000) /* 356517121 */, HVAC_TEMPERATURE_CURRENT = (((0x0502 + 0x10000000) + 0x05000000) + 0x00600000) /* 358614274 */, diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/ElectronicStabilityControlState.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/ElectronicStabilityControlState.aidl new file mode 100644 index 0000000000..006bbf2e70 --- /dev/null +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/ElectronicStabilityControlState.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.hardware.automotive.vehicle; + +/** + * Used to enumerate the state of Electronic Stability Control (ESC). + */ +@VintfStability +@Backing(type="int") +enum ElectronicStabilityControlState { + + /** + * This state is used as an alternative to any ElectronicStabilityControlState value that is not + * defined in the platform. Ideally, implementations of + * VehicleProperty#ELECTRONIC_STABILITY_CONTROL_STATE should not use this state. The framework + * can use this field to remain backwards compatible if ElectronicStabilityControlState is + * extended to include additional states. + */ + OTHER = 0, + /** + * ESC is enabled and monitoring safety, but is not actively controlling the tires to prevent + * the car from skidding. + */ + ENABLED = 1, + /** + * ESC is enabled and is actively controlling the tires to prevent the car from skidding. + */ + ACTIVATED = 2, +} diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl index 19537ac4c6..752770b44e 100644 --- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -708,6 +708,24 @@ enum VehicleProperty { */ ELECTRONIC_STABILITY_CONTROL_ENABLED = 0x040E + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.BOOLEAN, + /** + * Electronic Stability Control (ESC) state. + * + * Returns the current state of ESC. This property must always return a valid state defined in + * ElectronicStabilityControlState or ErrorState. It must not surface errors through StatusCode + * and must use the supported error states instead. + * + * For the global area ID (0), the VehicleAreaConfig#supportedEnumValues array must be defined + * unless all states of both ElectronicStabilityControlState (including OTHER, which is not + * recommended) and ErrorState are supported. + * + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ + * @data_enum ElectronicStabilityControlState + * @data_enum ErrorState + */ + ELECTRONIC_STABILITY_CONTROL_STATE = + 0x040F + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.INT32, /** * HVAC Properties * diff --git a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp index 5929a3911e..51c17db8de 100644 --- a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp +++ b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp @@ -993,6 +993,12 @@ TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyElectronicStabilityControlEnable VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN); } +TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyElectronicStabilityControlStateConfig) { + verifyProperty(VehicleProperty::ELECTRONIC_STABILITY_CONTROL_STATE, VehiclePropertyAccess::READ, + VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, + VehicleArea::GLOBAL, VehiclePropertyType::INT32); +} + bool VtsHalAutomotiveVehicleTargetTest::checkIsSupported(int32_t propertyId) { auto result = mVhalClient->getPropConfigs({propertyId}); return result.ok();