Merge "Added VEHICLE_DRIVING_AUTOMATION_CURRENT_LEVEL to HAL" into main

This commit is contained in:
Shrikar Amirisetty
2023-12-12 02:07:45 +00:00
committed by Android (Google) Code Review
13 changed files with 159 additions and 0 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -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<ConstantParser<WindshieldWipersState>>();
mConstantParsersByType["WindshieldWipersSwitch"] =
std::make_unique<ConstantParser<WindshieldWipersSwitch>>();
mConstantParsersByType["VehicleAutonomousState"] =
std::make_unique<ConstantParser<VehicleAutonomousState>>();
mConstantParsersByType["EmergencyLaneKeepAssistState"] =
std::make_unique<ConstantParser<EmergencyLaneKeepAssistState>>();
mConstantParsersByType["CruiseControlType"] =

View File

@@ -3785,6 +3785,14 @@
]
}
},
{
"property": "VehicleProperty::VEHICLE_DRIVING_AUTOMATION_CURRENT_LEVEL",
"defaultValue": {
"int32Values": [
"VehicleAutonomousState::LEVEL_0"
]
}
},
{
"property": "VehicleProperty::AUTOMATIC_EMERGENCY_BRAKING_ENABLED",
"defaultValue": {

View File

@@ -67,6 +67,7 @@
#include <aidl/android/hardware/automotive/vehicle/VehicleAreaSeat.h>
#include <aidl/android/hardware/automotive/vehicle/VehicleAreaWheel.h>
#include <aidl/android/hardware/automotive/vehicle/VehicleAreaWindow.h>
#include <aidl/android/hardware/automotive/vehicle/VehicleAutonomousState.h>
#include <aidl/android/hardware/automotive/vehicle/VehicleGear.h>
#include <aidl/android/hardware/automotive/vehicle/VehicleHvacFanDirection.h>
#include <aidl/android/hardware/automotive/vehicle/VehicleIgnitionState.h>

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.
*/
///////////////////////////////////////////////////////////////////////////////
// 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 VehicleAutonomousState {
LEVEL_0 = 0,
LEVEL_1 = 1,
LEVEL_2 = 2,
LEVEL_3 = 3,
LEVEL_4 = 4,
LEVEL_5 = 5,
}

View File

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

View File

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

View File

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

View File

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