Added LOW_SPEED_COLLISION_WARNING_STATE to HAL

Bug: 310955303
Test: atest VtsHalAutomotiveVehicle_TargetTest
FakeVehicleHardwareTest

Change-Id: I30980af5af1d6b954d6a4166be4df6ac92235388
This commit is contained in:
shrikar 2023-11-14 17:33:11 +00:00
parent 45df34b615
commit 858c4e1791
15 changed files with 215 additions and 3 deletions

View file

@ -287,6 +287,7 @@ std::unordered_map<VehicleProperty, VehiclePropertyAccess> AccessForVehiclePrope
{VehicleProperty::DRIVER_DISTRACTION_WARNING_ENABLED, VehiclePropertyAccess::READ_WRITE},
{VehicleProperty::DRIVER_DISTRACTION_WARNING, VehiclePropertyAccess::READ},
{VehicleProperty::LOW_SPEED_COLLISION_WARNING_ENABLED, VehiclePropertyAccess::READ_WRITE},
{VehicleProperty::LOW_SPEED_COLLISION_WARNING_STATE, VehiclePropertyAccess::READ},
};
} // namespace vehicle

View file

@ -287,6 +287,7 @@ std::unordered_map<VehicleProperty, VehiclePropertyChangeMode> ChangeModeForVehi
{VehicleProperty::DRIVER_DISTRACTION_WARNING_ENABLED, VehiclePropertyChangeMode::ON_CHANGE},
{VehicleProperty::DRIVER_DISTRACTION_WARNING, VehiclePropertyChangeMode::ON_CHANGE},
{VehicleProperty::LOW_SPEED_COLLISION_WARNING_ENABLED, VehiclePropertyChangeMode::ON_CHANGE},
{VehicleProperty::LOW_SPEED_COLLISION_WARNING_STATE, VehiclePropertyChangeMode::ON_CHANGE},
};
} // namespace vehicle

View file

@ -278,7 +278,8 @@ public final class AccessForVehicleProperty {
Map.entry(VehicleProperty.DRIVER_DISTRACTION_STATE, VehiclePropertyAccess.READ),
Map.entry(VehicleProperty.DRIVER_DISTRACTION_WARNING_ENABLED, VehiclePropertyAccess.READ_WRITE),
Map.entry(VehicleProperty.DRIVER_DISTRACTION_WARNING, VehiclePropertyAccess.READ),
Map.entry(VehicleProperty.LOW_SPEED_COLLISION_WARNING_ENABLED, VehiclePropertyAccess.READ_WRITE)
Map.entry(VehicleProperty.LOW_SPEED_COLLISION_WARNING_ENABLED, VehiclePropertyAccess.READ_WRITE),
Map.entry(VehicleProperty.LOW_SPEED_COLLISION_WARNING_STATE, VehiclePropertyAccess.READ)
);
}

View file

@ -278,7 +278,8 @@ public final class ChangeModeForVehicleProperty {
Map.entry(VehicleProperty.DRIVER_DISTRACTION_STATE, VehiclePropertyChangeMode.ON_CHANGE),
Map.entry(VehicleProperty.DRIVER_DISTRACTION_WARNING_ENABLED, VehiclePropertyChangeMode.ON_CHANGE),
Map.entry(VehicleProperty.DRIVER_DISTRACTION_WARNING, VehiclePropertyChangeMode.ON_CHANGE),
Map.entry(VehicleProperty.LOW_SPEED_COLLISION_WARNING_ENABLED, VehiclePropertyChangeMode.ON_CHANGE)
Map.entry(VehicleProperty.LOW_SPEED_COLLISION_WARNING_ENABLED, VehiclePropertyChangeMode.ON_CHANGE),
Map.entry(VehicleProperty.LOW_SPEED_COLLISION_WARNING_STATE, VehiclePropertyChangeMode.ON_CHANGE)
);
}

View file

@ -100,7 +100,8 @@ public final class EnumForVehicleProperty {
Map.entry(VehicleProperty.DRIVER_DROWSINESS_ATTENTION_STATE, List.of(DriverDrowsinessAttentionState.class, ErrorState.class)),
Map.entry(VehicleProperty.DRIVER_DROWSINESS_ATTENTION_WARNING, List.of(DriverDrowsinessAttentionWarning.class, ErrorState.class)),
Map.entry(VehicleProperty.DRIVER_DISTRACTION_STATE, List.of(DriverDistractionState.class, ErrorState.class)),
Map.entry(VehicleProperty.DRIVER_DISTRACTION_WARNING, List.of(DriverDistractionWarning.class, ErrorState.class))
Map.entry(VehicleProperty.DRIVER_DISTRACTION_WARNING, List.of(DriverDistractionWarning.class, ErrorState.class)),
Map.entry(VehicleProperty.LOW_SPEED_COLLISION_WARNING_STATE, List.of(LowSpeedCollisionWarningState.class, ErrorState.class))
);
}

View file

@ -61,6 +61,7 @@ using ::aidl::android::hardware::automotive::vehicle::LaneCenteringAssistState;
using ::aidl::android::hardware::automotive::vehicle::LaneDepartureWarningState;
using ::aidl::android::hardware::automotive::vehicle::LaneKeepAssistState;
using ::aidl::android::hardware::automotive::vehicle::LocationCharacterization;
using ::aidl::android::hardware::automotive::vehicle::LowSpeedCollisionWarningState;
using ::aidl::android::hardware::automotive::vehicle::RawPropValues;
using ::aidl::android::hardware::automotive::vehicle::VehicleAirbagLocation;
using ::aidl::android::hardware::automotive::vehicle::VehicleApPowerStateReport;
@ -288,6 +289,8 @@ JsonValueParser::JsonValueParser() {
std::make_unique<ConstantParser<LaneCenteringAssistCommand>>();
mConstantParsersByType["LaneCenteringAssistState"] =
std::make_unique<ConstantParser<LaneCenteringAssistState>>();
mConstantParsersByType["LowSpeedCollisionWarningState"] =
std::make_unique<ConstantParser<LowSpeedCollisionWarningState>>();
mConstantParsersByType["Constants"] = std::make_unique<LocalVariableParser>();
#ifdef ENABLE_VEHICLE_HAL_TEST_PROPERTIES
mConstantParsersByType["TestVendorProperty"] =

View file

@ -4099,6 +4099,27 @@
1
]
}
},
{
"property": "VehicleProperty::LOW_SPEED_COLLISION_WARNING_STATE",
"defaultValue": {
"int32Values": [
"LowSpeedCollisionWarningState::NO_WARNING"
]
},
"areas": [
{
"areaId": 0,
"supportedEnumValues": [
"ErrorState::NOT_AVAILABLE_SAFETY",
"ErrorState::NOT_AVAILABLE_POOR_VISIBILITY",
"ErrorState::NOT_AVAILABLE_SPEED_HIGH",
"ErrorState::NOT_AVAILABLE_DISABLED",
"LowSpeedCollisionWarningState::NO_WARNING",
"LowSpeedCollisionWarningState::WARNING"
]
}
]
}
]
}

View file

@ -225,6 +225,13 @@ const std::unordered_map<int32_t, std::vector<int32_t>> mAdasEnabledPropToAdasPr
toInt(VehicleProperty::DRIVER_DISTRACTION_WARNING),
},
},
// LSCW
{
toInt(VehicleProperty::LOW_SPEED_COLLISION_WARNING_ENABLED),
{
toInt(VehicleProperty::LOW_SPEED_COLLISION_WARNING_STATE),
},
},
};
} // namespace

View file

@ -1592,6 +1592,61 @@ std::vector<SetSpecialValueTestCase> setSpecialValueTestCases() {
},
},
},
SetSpecialValueTestCase{
.name = "set_low_speed_collision_warning_enabled_false",
.valuesToSet =
{
VehiclePropValue{
.prop = toInt(
VehicleProperty::
LOW_SPEED_COLLISION_WARNING_ENABLED),
.value.int32Values = {0},
},
},
.expectedValuesToGet =
{
VehiclePropValue{
.prop = toInt(
VehicleProperty::
LOW_SPEED_COLLISION_WARNING_ENABLED),
.value.int32Values = {0},
},
VehiclePropValue{
.prop = toInt(
VehicleProperty::
LOW_SPEED_COLLISION_WARNING_STATE),
.value.int32Values = {toInt(
ErrorState::NOT_AVAILABLE_DISABLED)},
},
},
},
SetSpecialValueTestCase{
.name = "set_low_speed_collision_warning_enabled_true",
.valuesToSet =
{
VehiclePropValue{
.prop = toInt(
VehicleProperty::
LOW_SPEED_COLLISION_WARNING_ENABLED),
.value.int32Values = {1},
},
},
.expectedValuesToGet =
{
VehiclePropValue{
.prop = toInt(
VehicleProperty::
LOW_SPEED_COLLISION_WARNING_ENABLED),
.value.int32Values = {1},
},
VehiclePropValue{
.prop = toInt(
VehicleProperty::
LOW_SPEED_COLLISION_WARNING_STATE),
.value.int32Values = {1},
},
},
},
SetSpecialValueTestCase{
.name = "set_shutdown_request",
.valuesToSet =
@ -2149,6 +2204,13 @@ TEST_F(FakeVehicleHardwareTest, testSendAdasPropertiesState) {
toInt(VehicleProperty::HANDS_ON_DETECTION_WARNING),
},
},
// LSCW
{
toInt(VehicleProperty::LOW_SPEED_COLLISION_WARNING_ENABLED),
{
toInt(VehicleProperty::LOW_SPEED_COLLISION_WARNING_STATE),
},
},
};
// First subscribe to all the properties that we will change.

View file

@ -48,6 +48,7 @@
#include <aidl/android/hardware/automotive/vehicle/LaneDepartureWarningState.h>
#include <aidl/android/hardware/automotive/vehicle/LaneKeepAssistState.h>
#include <aidl/android/hardware/automotive/vehicle/LocationCharacterization.h>
#include <aidl/android/hardware/automotive/vehicle/LowSpeedCollisionWarningState.h>
#include <aidl/android/hardware/automotive/vehicle/Obd2CommonIgnitionMonitors.h>
#include <aidl/android/hardware/automotive/vehicle/Obd2FuelSystemStatus.h>
#include <aidl/android/hardware/automotive/vehicle/Obd2FuelType.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 LowSpeedCollisionWarningState {
OTHER = 0,
NO_WARNING = 1,
WARNING = 2,
}

View file

@ -285,4 +285,5 @@ enum VehicleProperty {
DRIVER_DISTRACTION_WARNING_ENABLED = (((0x101F + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287313951 */,
DRIVER_DISTRACTION_WARNING = (((0x1020 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289411104 */,
LOW_SPEED_COLLISION_WARNING_ENABLED = (((0x1021 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287313953 */,
LOW_SPEED_COLLISION_WARNING_STATE = (((0x1022 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289411106 */,
}

View file

@ -0,0 +1,44 @@
/*
* 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 Low Speed Collision Warning State.
*/
@VintfStability
@Backing(type="int")
enum LowSpeedCollisionWarningState {
/**
* This state is used as an alternative to any LowSpeedCollisionWarningState value that is not
* defined in the platform. Ideally, implementations of
* VehicleProperty#LOW_SPEED_COLLISION_WARNING_STATE should not use this state. The framework
* can use this field to remain backwards compatible if LowSpeedCollisionWarningState is
* extended to include additional states.
*/
OTHER = 0,
/**
* Low Speed Collision Warning is enabled and monitoring for potential collision, but no
* potential collision is detected.
*/
NO_WARNING = 1,
/**
* Low Speed Collision Warning is enabled, detects a potential collision, and is actively
* warning the user.
*/
WARNING = 2,
}

View file

@ -5383,6 +5383,28 @@ enum VehicleProperty {
LOW_SPEED_COLLISION_WARNING_ENABLED =
0x1021 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.BOOLEAN,
/**
* Low Speed Collision Warning state.
*
* Returns the current state of Low Speed Collision Warning. This property must always return a
* valid state defined in LowSpeedCollisionWarningState or ErrorState. It must not surface
* errors through StatusCode and must use the supported error states instead. This property is
* different from the pre-existing FORWARD_COLLISION_WARNING_STATE, which should apply to higher
* speed applications only. If the vehicle doesn't have a separate collision detection system
* for low speed environments, this property should not be implemented.
*
* For the global area ID (0), the VehicleAreaConfig#supportedEnumValues array must be defined
* unless all states of both LowSpeedCollisionWarningState (including OTHER, which is not
* recommended) and ErrorState are supported.
*
* @change_mode VehiclePropertyChangeMode.ON_CHANGE
* @access VehiclePropertyAccess.READ
* @data_enum LowSpeedCollisionWarningState
* @data_enum ErrorState
*/
LOW_SPEED_COLLISION_WARNING_STATE =
0x1022 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.INT32,
/***************************************************************************
* End of ADAS Properties
**************************************************************************/

View file

@ -975,6 +975,12 @@ TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyLowSpeedCollisionWarningEnabledC
VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN);
}
TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyLowSpeedCollisionWarningStateConfig) {
verifyProperty(VehicleProperty::LOW_SPEED_COLLISION_WARNING_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();