From 8a140238a7a23bc223009eb8a50fc1980f3bf412 Mon Sep 17 00:00:00 2001 From: shrikar Date: Tue, 7 Mar 2023 16:57:59 +0000 Subject: [PATCH] Added info to HAL docs to answer Q1 from Ford pending questions. Bug: 259309511 Test: manual build Change-Id: I246b89202c03e9472bece7c60be0f7c2f19ffc08 --- .../automotive/vehicle/VehicleProperty.aidl | 2 ++ .../VtsHalAutomotiveVehicle_TargetTest.cpp | 24 +++++++++++++++++++ 2 files changed, 26 insertions(+) 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 b628b602f1..25c1df4a5a 100644 --- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -43,6 +43,8 @@ import android.hardware.automotive.vehicle.VehiclePropertyType; enum VehicleProperty { /** * Undefined property. + * + * This property must never be used/supported. */ INVALID = 0x00000000, /** diff --git a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp index e06647da4e..8530631a66 100644 --- a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp +++ b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp @@ -296,6 +296,30 @@ TEST_P(VtsHalAutomotiveVehicleTargetTest, setNotWritableProp) { ASSERT_EQ(setValueResult.error().code(), ErrorCode::ACCESS_DENIED_FROM_VHAL); } +// Test get(), set() and getAllPropConfigs() on VehicleProperty::INVALID. +TEST_P(VtsHalAutomotiveVehicleTargetTest, getSetPropertyIdInvalid) { + ALOGD("VtsHalAutomotiveVehicleTargetTest::getSetPropertyIdInvalid"); + + int32_t propId = toInt(VehicleProperty::INVALID); + auto getValueResult = mVhalClient->getValueSync(*mVhalClient->createHalPropValue(propId)); + ASSERT_FALSE(getValueResult.ok()) << "Expect get on VehicleProperty::INVALID to fail"; + ASSERT_EQ(getValueResult.error().code(), ErrorCode::INVALID_ARG); + + auto propToSet = mVhalClient->createHalPropValue(propId); + propToSet->setInt32Values({0}); + auto setValueResult = mVhalClient->setValueSync(*propToSet); + ASSERT_FALSE(setValueResult.ok()) << "Expect set on VehicleProperty::INVALID to fail"; + ASSERT_EQ(setValueResult.error().code(), ErrorCode::INVALID_ARG); + + auto result = mVhalClient->getAllPropConfigs(); + ASSERT_TRUE(result.ok()); + for (const auto& cfgPtr : result.value()) { + const IHalPropConfig& cfg = *cfgPtr; + ASSERT_FALSE(cfg.getPropId() == propId) << "Expect VehicleProperty::INVALID to not be " + "included in propConfigs"; + } +} + // Test subscribe() and unsubscribe(). TEST_P(VtsHalAutomotiveVehicleTargetTest, subscribeAndUnsubscribe) { ALOGD("VtsHalAutomotiveVehicleTargetTest::subscribeAndUnsubscribe");