Added ELECTRONIC_STABILITY_CONTROL_STATE to HAL

Bug: 313455695
Test: atest VtsHalAutomotiveVehicle_TargetTest
FakeVehicleHardwareTest

Change-Id: I8d8d7d749f530a7c738c8a9dfd712496d118715a
This commit is contained in:
shrikar
2023-11-27 17:40:46 +00:00
parent 33a3369d18
commit a45d1cfdc9
15 changed files with 207 additions and 0 deletions

View File

@@ -86,6 +86,7 @@ std::unordered_map<VehicleProperty, VehiclePropertyAccess> 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},

View File

@@ -86,6 +86,7 @@ std::unordered_map<VehicleProperty, VehiclePropertyChangeMode> 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},

View File

@@ -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),

View File

@@ -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),

View File

@@ -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)),

View File

@@ -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<ConstantParser<LaneCenteringAssistState>>();
mConstantParsersByType["LowSpeedCollisionWarningState"] =
std::make_unique<ConstantParser<LowSpeedCollisionWarningState>>();
mConstantParsersByType["ElectronicStabilityControlState"] =
std::make_unique<ConstantParser<ElectronicStabilityControlState>>();
mConstantParsersByType["Constants"] = std::make_unique<LocalVariableParser>();
#ifdef ENABLE_VEHICLE_HAL_TEST_PROPERTIES
mConstantParsersByType["TestVendorProperty"] =

View File

@@ -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"
]
}
]
}
]
}

View File

@@ -232,6 +232,13 @@ const std::unordered_map<int32_t, std::vector<int32_t>> mAdasEnabledPropToAdasPr
toInt(VehicleProperty::LOW_SPEED_COLLISION_WARNING_STATE),
},
},
// ESC
{
toInt(VehicleProperty::ELECTRONIC_STABILITY_CONTROL_ENABLED),
{
toInt(VehicleProperty::ELECTRONIC_STABILITY_CONTROL_STATE),
},
},
};
} // namespace

View File

@@ -1647,6 +1647,61 @@ std::vector<SetSpecialValueTestCase> 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.

View File

@@ -28,6 +28,7 @@
#include <aidl/android/hardware/automotive/vehicle/DriverDistractionWarning.h>
#include <aidl/android/hardware/automotive/vehicle/DriverDrowsinessAttentionState.h>
#include <aidl/android/hardware/automotive/vehicle/DriverDrowsinessAttentionWarning.h>
#include <aidl/android/hardware/automotive/vehicle/ElectronicStabilityControlState.h>
#include <aidl/android/hardware/automotive/vehicle/EmergencyLaneKeepAssistState.h>
#include <aidl/android/hardware/automotive/vehicle/ErrorState.h>
#include <aidl/android/hardware/automotive/vehicle/EvConnectorType.h>

View File

@@ -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 <name>-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,
}

View File

@@ -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 */,

View File

@@ -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,
}

View File

@@ -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
*

View File

@@ -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();