Add HAL changes for FORWARD_COLLISION_WARNING_STATE

This property supports error states in addition to its own state.
This is why the comments mention two @data_enums for this property.
This works because states are integer values so as long as all states
have distinct integer values, this functions correctly.

Bug: 264946034
Test: atest VtsHalAutomotiveVehicle_TargetTest
Test: atest CtsCarTestCases:CarPropertyManagerTest
Test: atest CtsCarTestCases:VehiclePropertyIdsTest
Test: atest ForwardCollisionWarningStateTest
Change-Id: Ib9292d8e64cc0d404065efccbfcf7fabd9fd1f69
This commit is contained in:
Aaqib Ismail 2023-01-10 16:03:07 -08:00
parent cf854badaf
commit f59b886f80
13 changed files with 139 additions and 0 deletions

View file

@ -240,6 +240,7 @@ std::unordered_map<VehicleProperty, VehiclePropertyAccess> AccessForVehiclePrope
{VehicleProperty::AUTOMATIC_EMERGENCY_BRAKING_ENABLED, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::AUTOMATIC_EMERGENCY_BRAKING_ENABLED, VehiclePropertyAccess::READ_WRITE},
{VehicleProperty::AUTOMATIC_EMERGENCY_BRAKING_STATE, VehiclePropertyAccess::READ}, {VehicleProperty::AUTOMATIC_EMERGENCY_BRAKING_STATE, VehiclePropertyAccess::READ},
{VehicleProperty::FORWARD_COLLISION_WARNING_ENABLED, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::FORWARD_COLLISION_WARNING_ENABLED, VehiclePropertyAccess::READ_WRITE},
{VehicleProperty::FORWARD_COLLISION_WARNING_STATE, VehiclePropertyAccess::READ},
{VehicleProperty::BLIND_SPOT_WARNING_ENABLED, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::BLIND_SPOT_WARNING_ENABLED, VehiclePropertyAccess::READ_WRITE},
{VehicleProperty::LANE_DEPARTURE_WARNING_ENABLED, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::LANE_DEPARTURE_WARNING_ENABLED, VehiclePropertyAccess::READ_WRITE},
{VehicleProperty::LANE_KEEP_ASSIST_ENABLED, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::LANE_KEEP_ASSIST_ENABLED, VehiclePropertyAccess::READ_WRITE},

View file

@ -240,6 +240,7 @@ std::unordered_map<VehicleProperty, VehiclePropertyChangeMode> ChangeModeForVehi
{VehicleProperty::AUTOMATIC_EMERGENCY_BRAKING_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::AUTOMATIC_EMERGENCY_BRAKING_ENABLED, VehiclePropertyChangeMode::ON_CHANGE},
{VehicleProperty::AUTOMATIC_EMERGENCY_BRAKING_STATE, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::AUTOMATIC_EMERGENCY_BRAKING_STATE, VehiclePropertyChangeMode::ON_CHANGE},
{VehicleProperty::FORWARD_COLLISION_WARNING_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::FORWARD_COLLISION_WARNING_ENABLED, VehiclePropertyChangeMode::ON_CHANGE},
{VehicleProperty::FORWARD_COLLISION_WARNING_STATE, VehiclePropertyChangeMode::ON_CHANGE},
{VehicleProperty::BLIND_SPOT_WARNING_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::BLIND_SPOT_WARNING_ENABLED, VehiclePropertyChangeMode::ON_CHANGE},
{VehicleProperty::LANE_DEPARTURE_WARNING_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::LANE_DEPARTURE_WARNING_ENABLED, VehiclePropertyChangeMode::ON_CHANGE},
{VehicleProperty::LANE_KEEP_ASSIST_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::LANE_KEEP_ASSIST_ENABLED, VehiclePropertyChangeMode::ON_CHANGE},

View file

@ -232,6 +232,7 @@ public final class AccessForVehicleProperty {
Map.entry(VehicleProperty.AUTOMATIC_EMERGENCY_BRAKING_ENABLED, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.AUTOMATIC_EMERGENCY_BRAKING_ENABLED, VehiclePropertyAccess.READ_WRITE),
Map.entry(VehicleProperty.AUTOMATIC_EMERGENCY_BRAKING_STATE, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.AUTOMATIC_EMERGENCY_BRAKING_STATE, VehiclePropertyAccess.READ),
Map.entry(VehicleProperty.FORWARD_COLLISION_WARNING_ENABLED, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.FORWARD_COLLISION_WARNING_ENABLED, VehiclePropertyAccess.READ_WRITE),
Map.entry(VehicleProperty.FORWARD_COLLISION_WARNING_STATE, VehiclePropertyAccess.READ),
Map.entry(VehicleProperty.BLIND_SPOT_WARNING_ENABLED, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.BLIND_SPOT_WARNING_ENABLED, VehiclePropertyAccess.READ_WRITE),
Map.entry(VehicleProperty.LANE_DEPARTURE_WARNING_ENABLED, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.LANE_DEPARTURE_WARNING_ENABLED, VehiclePropertyAccess.READ_WRITE),
Map.entry(VehicleProperty.LANE_KEEP_ASSIST_ENABLED, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.LANE_KEEP_ASSIST_ENABLED, VehiclePropertyAccess.READ_WRITE),

View file

@ -232,6 +232,7 @@ public final class ChangeModeForVehicleProperty {
Map.entry(VehicleProperty.AUTOMATIC_EMERGENCY_BRAKING_ENABLED, 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.AUTOMATIC_EMERGENCY_BRAKING_STATE, VehiclePropertyChangeMode.ON_CHANGE),
Map.entry(VehicleProperty.FORWARD_COLLISION_WARNING_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.FORWARD_COLLISION_WARNING_ENABLED, VehiclePropertyChangeMode.ON_CHANGE),
Map.entry(VehicleProperty.FORWARD_COLLISION_WARNING_STATE, VehiclePropertyChangeMode.ON_CHANGE),
Map.entry(VehicleProperty.BLIND_SPOT_WARNING_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.BLIND_SPOT_WARNING_ENABLED, VehiclePropertyChangeMode.ON_CHANGE),
Map.entry(VehicleProperty.LANE_DEPARTURE_WARNING_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.LANE_DEPARTURE_WARNING_ENABLED, VehiclePropertyChangeMode.ON_CHANGE),
Map.entry(VehicleProperty.LANE_KEEP_ASSIST_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.LANE_KEEP_ASSIST_ENABLED, VehiclePropertyChangeMode.ON_CHANGE),

View file

@ -41,6 +41,7 @@ using ::aidl::android::hardware::automotive::vehicle::ErrorState;
using ::aidl::android::hardware::automotive::vehicle::EvConnectorType; using ::aidl::android::hardware::automotive::vehicle::EvConnectorType;
using ::aidl::android::hardware::automotive::vehicle::EvsServiceState; using ::aidl::android::hardware::automotive::vehicle::EvsServiceState;
using ::aidl::android::hardware::automotive::vehicle::EvsServiceType; using ::aidl::android::hardware::automotive::vehicle::EvsServiceType;
using ::aidl::android::hardware::automotive::vehicle::ForwardCollisionWarningState;
using ::aidl::android::hardware::automotive::vehicle::FuelType; using ::aidl::android::hardware::automotive::vehicle::FuelType;
using ::aidl::android::hardware::automotive::vehicle::GsrComplianceRequirementType; using ::aidl::android::hardware::automotive::vehicle::GsrComplianceRequirementType;
using ::aidl::android::hardware::automotive::vehicle::RawPropValues; using ::aidl::android::hardware::automotive::vehicle::RawPropValues;
@ -212,6 +213,8 @@ JsonValueParser::JsonValueParser() {
mConstantParsersByType["ErrorState"] = std::make_unique<ConstantParser<ErrorState>>(); mConstantParsersByType["ErrorState"] = std::make_unique<ConstantParser<ErrorState>>();
mConstantParsersByType["AutomaticEmergencyBrakingState"] = mConstantParsersByType["AutomaticEmergencyBrakingState"] =
std::make_unique<ConstantParser<AutomaticEmergencyBrakingState>>(); std::make_unique<ConstantParser<AutomaticEmergencyBrakingState>>();
mConstantParsersByType["ForwardCollisionWarningState"] =
std::make_unique<ConstantParser<ForwardCollisionWarningState>>();
mConstantParsersByType["Constants"] = std::make_unique<LocalVariableParser>(); mConstantParsersByType["Constants"] = std::make_unique<LocalVariableParser>();
} }

View file

@ -3192,6 +3192,27 @@
] ]
} }
}, },
{
"property": "VehicleProperty::FORWARD_COLLISION_WARNING_STATE",
"defaultValue": {
"int32Values": [
"ForwardCollisionWarningState::NO_WARNING"
]
},
"areas": [
{
"areaId": 0,
"supportedEnumValues": [
"ErrorState::NOT_AVAILABLE_SAFETY",
"ErrorState::NOT_AVAILABLE_SPEED_HIGH",
"ErrorState::NOT_AVAILABLE_SPEED_LOW",
"ErrorState::NOT_AVAILABLE_DISABLED",
"ForwardCollisionWarningState::NO_WARNING",
"ForwardCollisionWarningState::WARNING"
]
}
]
},
{ {
"property": "VehicleProperty::BLIND_SPOT_WARNING_ENABLED", "property": "VehicleProperty::BLIND_SPOT_WARNING_ENABLED",
"defaultValue": { "defaultValue": {

View file

@ -143,6 +143,8 @@ We support the following constant types:
* AutomaticEmergencyBrakingState * AutomaticEmergencyBrakingState
* ForwardCollisionWarningState
* ErrorState * ErrorState
* Constants * Constants

View file

@ -25,6 +25,7 @@
#include <aidl/android/hardware/automotive/vehicle/EvStoppingMode.h> #include <aidl/android/hardware/automotive/vehicle/EvStoppingMode.h>
#include <aidl/android/hardware/automotive/vehicle/EvsServiceState.h> #include <aidl/android/hardware/automotive/vehicle/EvsServiceState.h>
#include <aidl/android/hardware/automotive/vehicle/EvsServiceType.h> #include <aidl/android/hardware/automotive/vehicle/EvsServiceType.h>
#include <aidl/android/hardware/automotive/vehicle/ForwardCollisionWarningState.h>
#include <aidl/android/hardware/automotive/vehicle/FuelType.h> #include <aidl/android/hardware/automotive/vehicle/FuelType.h>
#include <aidl/android/hardware/automotive/vehicle/GetValueRequest.h> #include <aidl/android/hardware/automotive/vehicle/GetValueRequest.h>
#include <aidl/android/hardware/automotive/vehicle/GetValueResult.h> #include <aidl/android/hardware/automotive/vehicle/GetValueResult.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 ForwardCollisionWarningState {
OTHER = 0,
NO_WARNING = 1,
WARNING = 2,
}

View file

@ -240,6 +240,7 @@ enum VehicleProperty {
AUTOMATIC_EMERGENCY_BRAKING_ENABLED = 287313920, AUTOMATIC_EMERGENCY_BRAKING_ENABLED = 287313920,
AUTOMATIC_EMERGENCY_BRAKING_STATE = 289411073, AUTOMATIC_EMERGENCY_BRAKING_STATE = 289411073,
FORWARD_COLLISION_WARNING_ENABLED = 287313922, FORWARD_COLLISION_WARNING_ENABLED = 287313922,
FORWARD_COLLISION_WARNING_STATE = 289411075,
BLIND_SPOT_WARNING_ENABLED = 287313924, BLIND_SPOT_WARNING_ENABLED = 287313924,
LANE_DEPARTURE_WARNING_ENABLED = 287313926, LANE_DEPARTURE_WARNING_ENABLED = 287313926,
LANE_KEEP_ASSIST_ENABLED = 287313928, LANE_KEEP_ASSIST_ENABLED = 287313928,

View file

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

View file

@ -3479,6 +3479,25 @@ enum VehicleProperty {
FORWARD_COLLISION_WARNING_ENABLED = FORWARD_COLLISION_WARNING_ENABLED =
0x1002 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.BOOLEAN, 0x1002 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.BOOLEAN,
/**
* Forward Collision Warning (FCW) state.
*
* Returns the current state of FCW. This property must always return a valid state defined in
* ForwardCollisionWarningState 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 ForwardCollisionWarningState (including OTHER, which is not
* recommended) and ErrorState are supported.
*
* @change_mode VehiclePropertyChangeMode.ON_CHANGE
* @access VehiclePropertyAccess.READ
* @data_enum ForwardCollisionWarningState
* @data_enum ErrorState
*/
FORWARD_COLLISION_WARNING_STATE =
0x1003 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.INT32,
/** /**
* Enable and disable blind spot warning (BSW). * Enable and disable blind spot warning (BSW).
* *

View file

@ -696,6 +696,12 @@ TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyForwardCollisionWarningEnabledCo
VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN); VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN);
} }
TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyForwardCollisionWarningStateConfig) {
verifyProperty(VehicleProperty::FORWARD_COLLISION_WARNING_STATE, VehiclePropertyAccess::READ,
VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM,
VehicleArea::GLOBAL, VehiclePropertyType::INT32);
}
TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyBlindSpotWarningEnabledConfig) { TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyBlindSpotWarningEnabledConfig) {
verifyProperty(VehicleProperty::BLIND_SPOT_WARNING_ENABLED, VehiclePropertyAccess::READ_WRITE, verifyProperty(VehicleProperty::BLIND_SPOT_WARNING_ENABLED, VehiclePropertyAccess::READ_WRITE,
VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM,