diff --git a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h index 2624437e6e..1d2d910031 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h @@ -262,6 +262,7 @@ std::unordered_map AccessForVehiclePrope {VehicleProperty::CRUISE_CONTROL_ENABLED, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::CRUISE_CONTROL_TYPE, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::CRUISE_CONTROL_STATE, VehiclePropertyAccess::READ}, + {VehicleProperty::CRUISE_CONTROL_COMMAND, VehiclePropertyAccess::WRITE}, {VehicleProperty::HANDS_ON_DETECTION_ENABLED, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::DRIVER_ATTENTION_MONITORING_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 d2603808da..613636e81c 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h @@ -262,6 +262,7 @@ std::unordered_map ChangeModeForVehi {VehicleProperty::CRUISE_CONTROL_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::CRUISE_CONTROL_TYPE, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::CRUISE_CONTROL_STATE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::CRUISE_CONTROL_COMMAND, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::HANDS_ON_DETECTION_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::DRIVER_ATTENTION_MONITORING_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 3eed9749c3..f83f1c260e 100644 --- a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java @@ -254,6 +254,7 @@ public final class AccessForVehicleProperty { Map.entry(VehicleProperty.CRUISE_CONTROL_ENABLED, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.CRUISE_CONTROL_TYPE, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.CRUISE_CONTROL_STATE, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.CRUISE_CONTROL_COMMAND, VehiclePropertyAccess.WRITE), Map.entry(VehicleProperty.HANDS_ON_DETECTION_ENABLED, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.DRIVER_ATTENTION_MONITORING_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 4e6de42710..f0642fe379 100644 --- a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java @@ -254,6 +254,7 @@ public final class ChangeModeForVehicleProperty { Map.entry(VehicleProperty.CRUISE_CONTROL_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.CRUISE_CONTROL_TYPE, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.CRUISE_CONTROL_STATE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.CRUISE_CONTROL_COMMAND, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.HANDS_ON_DETECTION_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.DRIVER_ATTENTION_MONITORING_ENABLED, VehiclePropertyChangeMode.ON_CHANGE) ); 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 4e53b68d55..7531589311 100644 --- a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp +++ b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp @@ -38,6 +38,7 @@ using ::aidl::android::hardware::automotive::vehicle::AccessForVehicleProperty; using ::aidl::android::hardware::automotive::vehicle::AutomaticEmergencyBrakingState; using ::aidl::android::hardware::automotive::vehicle::BlindSpotWarningState; using ::aidl::android::hardware::automotive::vehicle::ChangeModeForVehicleProperty; +using ::aidl::android::hardware::automotive::vehicle::CruiseControlCommand; using ::aidl::android::hardware::automotive::vehicle::CruiseControlState; using ::aidl::android::hardware::automotive::vehicle::CruiseControlType; using ::aidl::android::hardware::automotive::vehicle::EmergencyLaneKeepAssistState; @@ -227,6 +228,8 @@ JsonValueParser::JsonValueParser() { std::make_unique>(); mConstantParsersByType["CruiseControlState"] = std::make_unique>(); + mConstantParsersByType["CruiseControlCommand"] = + std::make_unique>(); mConstantParsersByType["ErrorState"] = std::make_unique>(); mConstantParsersByType["AutomaticEmergencyBrakingState"] = std::make_unique>(); diff --git a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json index ca06c9b73e..a0e811579a 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json +++ b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json @@ -3191,6 +3191,22 @@ } ] }, + { + "property": "VehicleProperty::CRUISE_CONTROL_COMMAND", + "areas": [ + { + "areaId": 0, + "supportedEnumValues": [ + "CruiseControlCommand::ACTIVATE", + "CruiseControlCommand::SUSPEND", + "CruiseControlCommand::INCREASE_TARGET_SPEED", + "CruiseControlCommand::DECREASE_TARGET_SPEED", + "CruiseControlCommand::INCREASE_TARGET_TIME_GAP", + "CruiseControlCommand::DECREASE_TARGET_TIME_GAP" + ] + } + ] + }, { "property": "VehicleProperty::HANDS_ON_DETECTION_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 f12f6d7db2..3b26aa6999 100644 --- a/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h +++ b/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h @@ -19,6 +19,7 @@ #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/CruiseControlCommand.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/CruiseControlCommand.aidl new file mode 100644 index 0000000000..d6a104d25b --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/CruiseControlCommand.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 CruiseControlCommand { + ACTIVATE = 1, + SUSPEND = 2, + INCREASE_TARGET_SPEED = 3, + DECREASE_TARGET_SPEED = 4, + INCREASE_TARGET_TIME_GAP = 5, + DECREASE_TARGET_TIME_GAP = 6, +} 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 15d11e21fe..bbec4bf595 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 @@ -260,6 +260,7 @@ enum VehicleProperty { CRUISE_CONTROL_ENABLED = (((0x100F + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287313935 */, CRUISE_CONTROL_TYPE = (((0x1010 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289411088 */, CRUISE_CONTROL_STATE = (((0x1011 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289411089 */, + CRUISE_CONTROL_COMMAND = (((0x1012 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289411090 */, HANDS_ON_DETECTION_ENABLED = (((0x1016 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287313942 */, DRIVER_ATTENTION_MONITORING_ENABLED = (((0x1019 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287313945 */, } diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/CruiseControlCommand.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/CruiseControlCommand.aidl new file mode 100644 index 0000000000..18e140506d --- /dev/null +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/CruiseControlCommand.aidl @@ -0,0 +1,62 @@ +/* + * 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 Cruise Control (CC) commands. + * + * This enum could be extended in future releases to include additional feature states. + */ +@VintfStability +@Backing(type="int") +enum CruiseControlCommand { + /** + * Activate cruise control, which means CC takes control of maintaining the vehicle's target + * speed without the driver having to keep their foot on the accelerator. The target speed for + * CC is generally set to the vehicle's speed at the time of activation. + */ + ACTIVATE = 1, + /** + * Suspend cruise control, but still keep it enabled. Once CC is activated again, the + * target speed should resume to the previous setting. + */ + SUSPEND = 2, + /** + * Increase the target speed when CC is activated. The increment value should be decided by the + * OEM. The updated value can be read from CRUISE_CONTROL_TARGET_SPEED. + */ + INCREASE_TARGET_SPEED = 3, + /** + * Decrease the target speed when CC is activated. The decrement value should be decided by the + * OEM. The updated value can be read from CRUISE_CONTROL_TARGET_SPEED. + */ + DECREASE_TARGET_SPEED = 4, + /** + * Increase the target time gap or distance from the vehicle ahead when adaptive/predictive CC + * is activated. The increment value should be decided by the OEM. The updated value can be read + * from ADAPTIVE_CRUISE_CONTROL_TARGET_TIME_GAP. Setting this command on a standard CC vehicle + * should return StatusCode.NOT_AVAILABLE. + */ + INCREASE_TARGET_TIME_GAP = 5, + /** + * Decrease the target time gap or distance from the vehicle ahead when adaptive/predictive CC + * is activated. The decrement value should be decided by the 0EM. The updated value can be read + * from ADAPTIVE_CRUISE_CONTROL_TARGET_TIME_GAP. Setting this command on a standard CC vehicle + * should return StatusCode.NOT_AVAILABLE. + */ + DECREASE_TARGET_TIME_GAP = 6, +} 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 179e57fe42..68a1e324ee 100644 --- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -3914,6 +3914,22 @@ enum VehicleProperty { CRUISE_CONTROL_STATE = 0x1011 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.INT32, + /** + * Write Cruise Control (CC) commands. + * + * See CruiseControlCommand for the details about each supported command. + * + * For the global area ID (0), the VehicleAreaConfig#supportedEnumValues array must be defined + * unless all states of CruiseControlState are supported. Any unsupported commands sent through + * this property should return StatusCode.INVALID_ARG. + * + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.WRITE + * @data_enum CruiseControlCommand + */ + CRUISE_CONTROL_COMMAND = + 0x1012 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.INT32, + /** * Enable or disable hands on detection (HOD). * diff --git a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp index 2ee00d68df..efbcf47680 100644 --- a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp +++ b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp @@ -528,6 +528,12 @@ TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyCruiseControlStateConfig) { VehicleArea::GLOBAL, VehiclePropertyType::INT32); } +TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyCruiseControlCommandConfig) { + verifyProperty(VehicleProperty::CRUISE_CONTROL_COMMAND, VehiclePropertyAccess::WRITE, + VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, + VehicleArea::GLOBAL, VehiclePropertyType::INT32); +} + TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyHandsOnDetectionEnabledConfig) { verifyProperty(VehicleProperty::HANDS_ON_DETECTION_ENABLED, VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM,