diff --git a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h index 3a1f098cda..ef38432f5a 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h @@ -248,6 +248,7 @@ std::unordered_map AccessForVehiclePrope {VehicleProperty::SHUTDOWN_REQUEST, VehiclePropertyAccess::WRITE}, {VehicleProperty::VEHICLE_IN_USE, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::CLUSTER_HEARTBEAT, VehiclePropertyAccess::WRITE}, + {VehicleProperty::VEHICLE_DRIVING_AUTOMATION_CURRENT_LEVEL, VehiclePropertyAccess::READ}, {VehicleProperty::AUTOMATIC_EMERGENCY_BRAKING_ENABLED, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::AUTOMATIC_EMERGENCY_BRAKING_STATE, VehiclePropertyAccess::READ}, {VehicleProperty::FORWARD_COLLISION_WARNING_ENABLED, VehiclePropertyAccess::READ_WRITE}, diff --git a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h index 5a5829875d..22f3e647db 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h @@ -248,6 +248,7 @@ std::unordered_map ChangeModeForVehi {VehicleProperty::SHUTDOWN_REQUEST, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::VEHICLE_IN_USE, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::CLUSTER_HEARTBEAT, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::VEHICLE_DRIVING_AUTOMATION_CURRENT_LEVEL, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::AUTOMATIC_EMERGENCY_BRAKING_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::AUTOMATIC_EMERGENCY_BRAKING_STATE, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::FORWARD_COLLISION_WARNING_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, diff --git a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java index 4bc18524aa..acadf7d28c 100644 --- a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java @@ -240,6 +240,7 @@ public final class AccessForVehicleProperty { Map.entry(VehicleProperty.SHUTDOWN_REQUEST, VehiclePropertyAccess.WRITE), Map.entry(VehicleProperty.VEHICLE_IN_USE, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.CLUSTER_HEARTBEAT, VehiclePropertyAccess.WRITE), + Map.entry(VehicleProperty.VEHICLE_DRIVING_AUTOMATION_CURRENT_LEVEL, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.AUTOMATIC_EMERGENCY_BRAKING_ENABLED, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.AUTOMATIC_EMERGENCY_BRAKING_STATE, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.FORWARD_COLLISION_WARNING_ENABLED, VehiclePropertyAccess.READ_WRITE), diff --git a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java index 1e00d9f36f..dfdb85b723 100644 --- a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java @@ -240,6 +240,7 @@ public final class ChangeModeForVehicleProperty { Map.entry(VehicleProperty.SHUTDOWN_REQUEST, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.VEHICLE_IN_USE, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.CLUSTER_HEARTBEAT, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.VEHICLE_DRIVING_AUTOMATION_CURRENT_LEVEL, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.AUTOMATIC_EMERGENCY_BRAKING_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.AUTOMATIC_EMERGENCY_BRAKING_STATE, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.FORWARD_COLLISION_WARNING_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), diff --git a/automotive/vehicle/aidl/generated_lib/java/EnumForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/EnumForVehicleProperty.java index 958d84b7c5..3c2cfa2eb2 100644 --- a/automotive/vehicle/aidl/generated_lib/java/EnumForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/EnumForVehicleProperty.java @@ -81,6 +81,7 @@ public final class EnumForVehicleProperty { Map.entry(VehicleProperty.TRAILER_PRESENT, List.of(TrailerState.class)), Map.entry(VehicleProperty.GENERAL_SAFETY_REGULATION_COMPLIANCE_REQUIREMENT, List.of(GsrComplianceRequirementType.class)), Map.entry(VehicleProperty.SHUTDOWN_REQUEST, List.of(VehicleApPowerStateShutdownParam.class)), + Map.entry(VehicleProperty.VEHICLE_DRIVING_AUTOMATION_CURRENT_LEVEL, List.of(VehicleAutonomousState.class)), Map.entry(VehicleProperty.AUTOMATIC_EMERGENCY_BRAKING_STATE, List.of(AutomaticEmergencyBrakingState.class, ErrorState.class)), Map.entry(VehicleProperty.FORWARD_COLLISION_WARNING_STATE, List.of(ForwardCollisionWarningState.class, ErrorState.class)), Map.entry(VehicleProperty.BLIND_SPOT_WARNING_STATE, List.of(BlindSpotWarningState.class, ErrorState.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 e4d134e893..26bda22b66 100644 --- a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp +++ b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp @@ -66,6 +66,7 @@ using ::aidl::android::hardware::automotive::vehicle::VehicleApPowerStateReq; using ::aidl::android::hardware::automotive::vehicle::VehicleAreaConfig; using ::aidl::android::hardware::automotive::vehicle::VehicleAreaMirror; using ::aidl::android::hardware::automotive::vehicle::VehicleAreaWindow; +using ::aidl::android::hardware::automotive::vehicle::VehicleAutonomousState; using ::aidl::android::hardware::automotive::vehicle::VehicleGear; using ::aidl::android::hardware::automotive::vehicle::VehicleHvacFanDirection; using ::aidl::android::hardware::automotive::vehicle::VehicleIgnitionState; @@ -244,6 +245,8 @@ JsonValueParser::JsonValueParser() { std::make_unique>(); mConstantParsersByType["WindshieldWipersSwitch"] = std::make_unique>(); + mConstantParsersByType["VehicleAutonomousState"] = + std::make_unique>(); mConstantParsersByType["EmergencyLaneKeepAssistState"] = std::make_unique>(); mConstantParsersByType["CruiseControlType"] = diff --git a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json index e462609390..88541d8f7b 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json +++ b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json @@ -3785,6 +3785,14 @@ ] } }, + { + "property": "VehicleProperty::VEHICLE_DRIVING_AUTOMATION_CURRENT_LEVEL", + "defaultValue": { + "int32Values": [ + "VehicleAutonomousState::LEVEL_0" + ] + } + }, { "property": "VehicleProperty::AUTOMATIC_EMERGENCY_BRAKING_ENABLED", "defaultValue": { diff --git a/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h b/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h index 6c1d0a040a..42cd993267 100644 --- a/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h +++ b/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h @@ -67,6 +67,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/VehicleAutonomousState.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleAutonomousState.aidl new file mode 100644 index 0000000000..e15e71ed3e --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleAutonomousState.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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 VehicleAutonomousState { + LEVEL_0 = 0, + LEVEL_1 = 1, + LEVEL_2 = 2, + LEVEL_3 = 3, + LEVEL_4 = 4, + LEVEL_5 = 5, +} 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 649396a6b0..84df77472c 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 @@ -246,6 +246,7 @@ enum VehicleProperty { SHUTDOWN_REQUEST = (((0x0F49 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289410889 */, VEHICLE_IN_USE = (((0x0F4A + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287313738 */, CLUSTER_HEARTBEAT = (((0x0F4B + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.MIXED) /* 299896651 */, + VEHICLE_DRIVING_AUTOMATION_CURRENT_LEVEL = (((0x0F4C + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289410892 */, AUTOMATIC_EMERGENCY_BRAKING_ENABLED = (((0x1000 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287313920 */, AUTOMATIC_EMERGENCY_BRAKING_STATE = (((0x1001 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289411073 */, FORWARD_COLLISION_WARNING_ENABLED = (((0x1002 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287313922 */, diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleAutonomousState.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleAutonomousState.aidl new file mode 100644 index 0000000000..3860e7f222 --- /dev/null +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleAutonomousState.aidl @@ -0,0 +1,73 @@ +/* + * 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 various level of automation that can be expressed by the + * VEHICLE_DRIVING_AUTOMATION_CURRENT_LEVEL property. + */ +@VintfStability +@Backing(type="int") +enum VehicleAutonomousState { + /** + * No automation. ADAS systems are limited to providing warnings and momentary assistance. The + * driver is in constant supervision of all driving tasks and must steer, brake or accelerate as + * needed to maintain safety, and is still responsible for driving while the ADAS systems are + * engaged. Usage should be in accordance to Level 0 definition in J3016_202104 version of + * vehicle autonomy levels defined by SAE. + */ + LEVEL_0 = 0, + /** + * Driver assistance. ADAS systems can provide steering or brake/acceleration support to the + * driver. The driver is in constant supervision of all driving tasks and must steer, brake or + * accelerate as needed to maintain safety, and is still responsible for driving while the ADAS + * systems are engaged. Usage should be in accordance to Level 1 definition in J3016_202104 + * version of vehicle autonomy levels defined by SAE. + */ + LEVEL_1 = 1, + /** + * Partial automation. ADAS systems can provide both steering and brake/acceleration support to + * the driver at the same time. The driver is in constant supervision of all driving tasks and + * must steer, brake or accelerate as needed to maintain safety, and is still responsible for + * driving while the ADAS systems are engaged. Usage should be in accordance to Level 2 + * definition in J3016_202104 version of vehicle autonomy levels defined by SAE. + */ + LEVEL_2 = 2, + /** + * Conditional automation. ADAS systems can drive the vehicle under limited conditions and will + * not operate unless all required conditions are met. The driver is required to take over + * control of the vehicle when requested to do so by the ADAS systems, however is not + * responsible for driving while the ADAS systems are engaged. Usage should be in accordance to + * Level 3 definition in J3016_202104 version of vehicle autonomy levels defined by SAE. + */ + LEVEL_3 = 3, + /** + * High automation. ADAS systems can drive the vehicle under limited conditions and will not + * operate unless all required conditions are met. The driver is not required to take over + * control of the vehicle and is not responsible for driving while the ADAS systems are engaged. + * Usage should be in accordance to Level 4 definition in J3016_202104 version of vehicle + * autonomy levels defined by SAE. + */ + LEVEL_4 = 4, + /** + * Full automation. ADAS systems can drive the vehicle under all conditions. The driver is not + * required to take over control of the vehicle and is not responsible for driving while the + * ADAS systems are engaged. Usage should be in accordance to Level 5 definition in J3016_202104 + * version of vehicle autonomy levels defined by SAE. + */ + LEVEL_5 = 5, +} 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 8784fc8bdb..1827c8923f 100644 --- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -4501,6 +4501,25 @@ enum VehicleProperty { CLUSTER_HEARTBEAT = 0x0F4B + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.MIXED, + /** + * Current state of vehicle autonomy. + * + * Defines the level of autonomy currently engaged in the vehicle from the J3016_202104 revision + * of the SAE standard levels 0-5, with 0 representing no autonomy and 5 representing full + * driving automation. These levels should be used in accordance with the standards defined in + * https://www.sae.org/standards/content/j3016_202104/ and + * https://www.sae.org/blog/sae-j3016-update + * + * For the global area ID (0), the VehicleAreaConfig#supportedEnumValues array must be defined + * unless all states of VehicleAutonomousState are supported. + * + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ + * @data_enum VehicleAutonomousState + */ + VEHICLE_DRIVING_AUTOMATION_CURRENT_LEVEL = + 0x0F4C + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.INT32, + /*********************************************************************************************** * Start of ADAS Properties * diff --git a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp index 6f81807ce9..c216e76ca7 100644 --- a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp +++ b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp @@ -939,6 +939,12 @@ TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyClusterHeartbeatConfig) { VehicleArea::GLOBAL, VehiclePropertyType::MIXED); } +TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyVehicleDrivingAutomationCurrentLevelConfig) { + verifyProperty(VehicleProperty::VEHICLE_DRIVING_AUTOMATION_CURRENT_LEVEL, + 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();