Yu Shan | 726d51a | 2022-02-22 17:37:21 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2022 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #define LOG_TAG "VtsHalAutomotiveVehicle" |
| 18 | |
| 19 | #include <IVhalClient.h> |
| 20 | #include <VehicleHalTypes.h> |
| 21 | #include <VehicleUtils.h> |
Yu Shan | f3698fd | 2023-12-18 12:29:00 -0800 | [diff] [blame^] | 22 | #include <VersionForVehicleProperty.h> |
Yu Shan | 726d51a | 2022-02-22 17:37:21 -0800 | [diff] [blame] | 23 | #include <aidl/Gtest.h> |
| 24 | #include <aidl/Vintf.h> |
| 25 | #include <aidl/android/hardware/automotive/vehicle/IVehicle.h> |
| 26 | #include <android-base/stringprintf.h> |
| 27 | #include <android-base/thread_annotations.h> |
| 28 | #include <android/binder_process.h> |
Yu Shan | f3698fd | 2023-12-18 12:29:00 -0800 | [diff] [blame^] | 29 | #include <gmock/gmock.h> |
Yu Shan | 726d51a | 2022-02-22 17:37:21 -0800 | [diff] [blame] | 30 | #include <gtest/gtest.h> |
| 31 | #include <hidl/GtestPrinter.h> |
| 32 | #include <hidl/ServiceManagement.h> |
| 33 | #include <inttypes.h> |
| 34 | #include <utils/Log.h> |
Yu Shan | 4569ef5 | 2022-03-18 14:34:25 -0700 | [diff] [blame] | 35 | #include <utils/SystemClock.h> |
Yu Shan | 726d51a | 2022-02-22 17:37:21 -0800 | [diff] [blame] | 36 | |
| 37 | #include <chrono> |
| 38 | #include <mutex> |
| 39 | #include <unordered_map> |
| 40 | #include <unordered_set> |
| 41 | #include <vector> |
| 42 | |
| 43 | using ::aidl::android::hardware::automotive::vehicle::IVehicle; |
| 44 | using ::aidl::android::hardware::automotive::vehicle::StatusCode; |
| 45 | using ::aidl::android::hardware::automotive::vehicle::SubscribeOptions; |
| 46 | using ::aidl::android::hardware::automotive::vehicle::VehicleArea; |
| 47 | using ::aidl::android::hardware::automotive::vehicle::VehicleProperty; |
| 48 | using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyAccess; |
Aaqib Ismail | 2048670 | 2022-10-27 16:58:50 -0700 | [diff] [blame] | 49 | using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyChangeMode; |
| 50 | using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyGroup; |
Yu Shan | 726d51a | 2022-02-22 17:37:21 -0800 | [diff] [blame] | 51 | using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyType; |
Yu Shan | f3698fd | 2023-12-18 12:29:00 -0800 | [diff] [blame^] | 52 | using ::aidl::android::hardware::automotive::vehicle::VersionForVehicleProperty; |
Yu Shan | 726d51a | 2022-02-22 17:37:21 -0800 | [diff] [blame] | 53 | using ::android::getAidlHalInstanceNames; |
| 54 | using ::android::base::ScopedLockAssertion; |
| 55 | using ::android::base::StringPrintf; |
Chen Cheng | faf9adc | 2022-06-22 23:09:09 +0000 | [diff] [blame] | 56 | using ::android::frameworks::automotive::vhal::ErrorCode; |
Yu Shan | 726d51a | 2022-02-22 17:37:21 -0800 | [diff] [blame] | 57 | using ::android::frameworks::automotive::vhal::HalPropError; |
| 58 | using ::android::frameworks::automotive::vhal::IHalPropConfig; |
| 59 | using ::android::frameworks::automotive::vhal::IHalPropValue; |
| 60 | using ::android::frameworks::automotive::vhal::ISubscriptionCallback; |
| 61 | using ::android::frameworks::automotive::vhal::IVhalClient; |
| 62 | using ::android::hardware::getAllHalInstanceNames; |
| 63 | using ::android::hardware::Sanitize; |
Yu Shan | f3698fd | 2023-12-18 12:29:00 -0800 | [diff] [blame^] | 64 | using ::android::hardware::automotive::vehicle::isSystemProp; |
| 65 | using ::android::hardware::automotive::vehicle::propIdToString; |
Yu Shan | 726d51a | 2022-02-22 17:37:21 -0800 | [diff] [blame] | 66 | using ::android::hardware::automotive::vehicle::toInt; |
Yu Shan | f3698fd | 2023-12-18 12:29:00 -0800 | [diff] [blame^] | 67 | using ::testing::Ge; |
Yu Shan | 726d51a | 2022-02-22 17:37:21 -0800 | [diff] [blame] | 68 | |
| 69 | constexpr int32_t kInvalidProp = 0x31600207; |
| 70 | |
| 71 | struct ServiceDescriptor { |
| 72 | std::string name; |
| 73 | bool isAidlService; |
| 74 | }; |
| 75 | |
| 76 | class VtsVehicleCallback final : public ISubscriptionCallback { |
| 77 | private: |
| 78 | std::mutex mLock; |
| 79 | std::unordered_map<int32_t, size_t> mEventsCount GUARDED_BY(mLock); |
Yu Shan | 4569ef5 | 2022-03-18 14:34:25 -0700 | [diff] [blame] | 80 | std::unordered_map<int32_t, std::vector<int64_t>> mEventTimestamps GUARDED_BY(mLock); |
Yu Shan | 726d51a | 2022-02-22 17:37:21 -0800 | [diff] [blame] | 81 | std::condition_variable mEventCond; |
| 82 | |
| 83 | public: |
| 84 | void onPropertyEvent(const std::vector<std::unique_ptr<IHalPropValue>>& values) override { |
| 85 | { |
| 86 | std::lock_guard<std::mutex> lockGuard(mLock); |
| 87 | for (auto& value : values) { |
Yu Shan | 4569ef5 | 2022-03-18 14:34:25 -0700 | [diff] [blame] | 88 | int32_t propId = value->getPropId(); |
| 89 | mEventsCount[propId] += 1; |
| 90 | mEventTimestamps[propId].push_back(value->getTimestamp()); |
Yu Shan | 726d51a | 2022-02-22 17:37:21 -0800 | [diff] [blame] | 91 | } |
| 92 | } |
| 93 | mEventCond.notify_one(); |
| 94 | } |
| 95 | |
| 96 | void onPropertySetError([[maybe_unused]] const std::vector<HalPropError>& errors) override { |
| 97 | // Do nothing. |
| 98 | } |
| 99 | |
| 100 | template <class Rep, class Period> |
| 101 | bool waitForExpectedEvents(int32_t propId, size_t expectedEvents, |
| 102 | const std::chrono::duration<Rep, Period>& timeout) { |
| 103 | std::unique_lock<std::mutex> uniqueLock(mLock); |
| 104 | return mEventCond.wait_for(uniqueLock, timeout, [this, propId, expectedEvents] { |
| 105 | ScopedLockAssertion lockAssertion(mLock); |
| 106 | return mEventsCount[propId] >= expectedEvents; |
| 107 | }); |
| 108 | } |
| 109 | |
Yu Shan | 4569ef5 | 2022-03-18 14:34:25 -0700 | [diff] [blame] | 110 | std::vector<int64_t> getEventTimestamps(int32_t propId) { |
| 111 | { |
| 112 | std::lock_guard<std::mutex> lockGuard(mLock); |
| 113 | return mEventTimestamps[propId]; |
| 114 | } |
| 115 | } |
| 116 | |
Yu Shan | 726d51a | 2022-02-22 17:37:21 -0800 | [diff] [blame] | 117 | void reset() { |
| 118 | std::lock_guard<std::mutex> lockGuard(mLock); |
| 119 | mEventsCount.clear(); |
| 120 | } |
| 121 | }; |
| 122 | |
| 123 | class VtsHalAutomotiveVehicleTargetTest : public testing::TestWithParam<ServiceDescriptor> { |
Yu Shan | ec5d5b0 | 2023-10-09 14:43:36 -0700 | [diff] [blame] | 124 | protected: |
Yu Shan | 0ebd876 | 2023-10-11 11:31:04 -0700 | [diff] [blame] | 125 | bool checkIsSupported(int32_t propertyId); |
Yu Shan | ec5d5b0 | 2023-10-09 14:43:36 -0700 | [diff] [blame] | 126 | |
Yu Shan | 726d51a | 2022-02-22 17:37:21 -0800 | [diff] [blame] | 127 | public: |
Aaqib Ismail | 2048670 | 2022-10-27 16:58:50 -0700 | [diff] [blame] | 128 | void verifyProperty(VehicleProperty propId, VehiclePropertyAccess access, |
| 129 | VehiclePropertyChangeMode changeMode, VehiclePropertyGroup group, |
| 130 | VehicleArea area, VehiclePropertyType propertyType); |
Yu Shan | 726d51a | 2022-02-22 17:37:21 -0800 | [diff] [blame] | 131 | virtual void SetUp() override { |
| 132 | auto descriptor = GetParam(); |
| 133 | if (descriptor.isAidlService) { |
| 134 | mVhalClient = IVhalClient::tryCreateAidlClient(descriptor.name.c_str()); |
| 135 | } else { |
| 136 | mVhalClient = IVhalClient::tryCreateHidlClient(descriptor.name.c_str()); |
| 137 | } |
| 138 | |
| 139 | ASSERT_NE(mVhalClient, nullptr) << "Failed to connect to VHAL"; |
| 140 | |
| 141 | mCallback = std::make_shared<VtsVehicleCallback>(); |
| 142 | } |
| 143 | |
| 144 | static bool isBooleanGlobalProp(int32_t property) { |
| 145 | return (property & toInt(VehiclePropertyType::MASK)) == |
| 146 | toInt(VehiclePropertyType::BOOLEAN) && |
| 147 | (property & toInt(VehicleArea::MASK)) == toInt(VehicleArea::GLOBAL); |
| 148 | } |
| 149 | |
| 150 | protected: |
| 151 | std::shared_ptr<IVhalClient> mVhalClient; |
| 152 | std::shared_ptr<VtsVehicleCallback> mCallback; |
| 153 | }; |
| 154 | |
| 155 | TEST_P(VtsHalAutomotiveVehicleTargetTest, useAidlBackend) { |
| 156 | if (!mVhalClient->isAidlVhal()) { |
| 157 | GTEST_SKIP() << "AIDL backend is not available, HIDL backend is used instead"; |
| 158 | } |
| 159 | } |
| 160 | |
| 161 | TEST_P(VtsHalAutomotiveVehicleTargetTest, useHidlBackend) { |
| 162 | if (mVhalClient->isAidlVhal()) { |
| 163 | GTEST_SKIP() << "AIDL backend is available, HIDL backend is not used"; |
| 164 | } |
| 165 | } |
| 166 | |
Yu Shan | ec5d5b0 | 2023-10-09 14:43:36 -0700 | [diff] [blame] | 167 | // Test getAllPropConfigs() returns at least 1 property configs. |
Yu Shan | 726d51a | 2022-02-22 17:37:21 -0800 | [diff] [blame] | 168 | TEST_P(VtsHalAutomotiveVehicleTargetTest, getAllPropConfigs) { |
| 169 | ALOGD("VtsHalAutomotiveVehicleTargetTest::getAllPropConfigs"); |
| 170 | |
| 171 | auto result = mVhalClient->getAllPropConfigs(); |
| 172 | |
| 173 | ASSERT_TRUE(result.ok()) << "Failed to get all property configs, error: " |
| 174 | << result.error().message(); |
Yu Shan | ec5d5b0 | 2023-10-09 14:43:36 -0700 | [diff] [blame] | 175 | ASSERT_GE(result.value().size(), 1u) << StringPrintf( |
| 176 | "Expect to get at least 1 property config, got %zu", result.value().size()); |
Yu Shan | 726d51a | 2022-02-22 17:37:21 -0800 | [diff] [blame] | 177 | } |
| 178 | |
Yu Shan | ec5d5b0 | 2023-10-09 14:43:36 -0700 | [diff] [blame] | 179 | // Test getPropConfigs() can query properties returned by getAllPropConfigs. |
| 180 | TEST_P(VtsHalAutomotiveVehicleTargetTest, getPropConfigsWithValidProps) { |
Yu Shan | 726d51a | 2022-02-22 17:37:21 -0800 | [diff] [blame] | 181 | ALOGD("VtsHalAutomotiveVehicleTargetTest::getRequiredPropConfigs"); |
| 182 | |
Yu Shan | ec5d5b0 | 2023-10-09 14:43:36 -0700 | [diff] [blame] | 183 | std::vector<int32_t> properties; |
| 184 | auto result = mVhalClient->getAllPropConfigs(); |
Yu Shan | 726d51a | 2022-02-22 17:37:21 -0800 | [diff] [blame] | 185 | |
Yu Shan | ec5d5b0 | 2023-10-09 14:43:36 -0700 | [diff] [blame] | 186 | ASSERT_TRUE(result.ok()) << "Failed to get all property configs, error: " |
| 187 | << result.error().message(); |
| 188 | for (const auto& cfgPtr : result.value()) { |
| 189 | properties.push_back(cfgPtr->getPropId()); |
| 190 | } |
| 191 | |
| 192 | result = mVhalClient->getPropConfigs(properties); |
Yu Shan | 726d51a | 2022-02-22 17:37:21 -0800 | [diff] [blame] | 193 | |
| 194 | ASSERT_TRUE(result.ok()) << "Failed to get required property config, error: " |
| 195 | << result.error().message(); |
Yu Shan | ec5d5b0 | 2023-10-09 14:43:36 -0700 | [diff] [blame] | 196 | ASSERT_EQ(result.value().size(), properties.size()) << StringPrintf( |
| 197 | "Expect to get exactly %zu configs, got %zu", properties.size(), result.value().size()); |
Yu Shan | 726d51a | 2022-02-22 17:37:21 -0800 | [diff] [blame] | 198 | } |
| 199 | |
| 200 | // Test getPropConfig() with an invalid propertyId returns an error code. |
| 201 | TEST_P(VtsHalAutomotiveVehicleTargetTest, getPropConfigsWithInvalidProp) { |
| 202 | ALOGD("VtsHalAutomotiveVehicleTargetTest::getPropConfigsWithInvalidProp"); |
| 203 | |
| 204 | auto result = mVhalClient->getPropConfigs({kInvalidProp}); |
| 205 | |
| 206 | ASSERT_FALSE(result.ok()) << StringPrintf( |
| 207 | "Expect failure to get prop configs for invalid prop: %" PRId32, kInvalidProp); |
| 208 | ASSERT_NE(result.error().message(), "") << "Expect error message not to be empty"; |
| 209 | } |
| 210 | |
Yu Shan | f3698fd | 2023-12-18 12:29:00 -0800 | [diff] [blame^] | 211 | // Test system property IDs returned by getPropConfigs() are defined in the VHAL property interface. |
| 212 | TEST_P(VtsHalAutomotiveVehicleTargetTest, testPropConfigs_onlyDefinedSystemPropertyIdsReturned) { |
| 213 | if (!mVhalClient->isAidlVhal()) { |
| 214 | GTEST_SKIP() << "Skip for HIDL VHAL because HAL interface run-time version is only" |
| 215 | << "introduced for AIDL"; |
| 216 | } |
| 217 | |
| 218 | auto result = mVhalClient->getAllPropConfigs(); |
| 219 | ASSERT_TRUE(result.ok()) << "Failed to get all property configs, error: " |
| 220 | << result.error().message(); |
| 221 | |
| 222 | int32_t vhalVersion = mVhalClient->getRemoteInterfaceVersion(); |
| 223 | const auto& configs = result.value(); |
| 224 | for (size_t i = 0; i < configs.size(); i++) { |
| 225 | int32_t propId = configs[i]->getPropId(); |
| 226 | if (!isSystemProp(propId)) { |
| 227 | continue; |
| 228 | } |
| 229 | |
| 230 | std::string propName = propIdToString(propId); |
| 231 | auto it = VersionForVehicleProperty.find(static_cast<VehicleProperty>(propId)); |
| 232 | bool found = (it != VersionForVehicleProperty.end()); |
| 233 | EXPECT_TRUE(found) << "System Property: " << propName |
| 234 | << " is not defined in VHAL property interface"; |
| 235 | if (!found) { |
| 236 | continue; |
| 237 | } |
| 238 | int32_t requiredVersion = it->second; |
| 239 | EXPECT_THAT(vhalVersion, Ge(requiredVersion)) |
| 240 | << "System Property: " << propName << " requires VHAL version: " << requiredVersion |
| 241 | << ", but the current VHAL version" |
| 242 | << " is " << vhalVersion << ", must not be supported"; |
| 243 | } |
| 244 | } |
| 245 | |
Yu Shan | 726d51a | 2022-02-22 17:37:21 -0800 | [diff] [blame] | 246 | // Test get() return current value for properties. |
| 247 | TEST_P(VtsHalAutomotiveVehicleTargetTest, get) { |
| 248 | ALOGD("VtsHalAutomotiveVehicleTargetTest::get"); |
| 249 | |
| 250 | int32_t propId = toInt(VehicleProperty::PERF_VEHICLE_SPEED); |
Yu Shan | 0ebd876 | 2023-10-11 11:31:04 -0700 | [diff] [blame] | 251 | if (!checkIsSupported(propId)) { |
| 252 | GTEST_SKIP() << "Property: " << propId << " is not supported, skip the test"; |
| 253 | } |
Yu Shan | 726d51a | 2022-02-22 17:37:21 -0800 | [diff] [blame] | 254 | auto result = mVhalClient->getValueSync(*mVhalClient->createHalPropValue(propId)); |
| 255 | |
| 256 | ASSERT_TRUE(result.ok()) << StringPrintf("Failed to get value for property: %" PRId32 |
| 257 | ", error: %s", |
| 258 | propId, result.error().message().c_str()); |
| 259 | ASSERT_NE(result.value(), nullptr) << "Result value must not be null"; |
| 260 | } |
| 261 | |
| 262 | // Test get() with an invalid propertyId return an error codes. |
| 263 | TEST_P(VtsHalAutomotiveVehicleTargetTest, getInvalidProp) { |
| 264 | ALOGD("VtsHalAutomotiveVehicleTargetTest::getInvalidProp"); |
| 265 | |
| 266 | auto result = mVhalClient->getValueSync(*mVhalClient->createHalPropValue(kInvalidProp)); |
| 267 | |
| 268 | ASSERT_FALSE(result.ok()) << StringPrintf( |
| 269 | "Expect failure to get property for invalid prop: %" PRId32, kInvalidProp); |
| 270 | } |
| 271 | |
| 272 | // Test set() on read_write properties. |
| 273 | TEST_P(VtsHalAutomotiveVehicleTargetTest, setProp) { |
| 274 | ALOGD("VtsHalAutomotiveVehicleTargetTest::setProp"); |
| 275 | |
| 276 | // skip hvac related properties |
| 277 | std::unordered_set<int32_t> hvacProps = {toInt(VehicleProperty::HVAC_DEFROSTER), |
| 278 | toInt(VehicleProperty::HVAC_AC_ON), |
| 279 | toInt(VehicleProperty::HVAC_MAX_AC_ON), |
| 280 | toInt(VehicleProperty::HVAC_MAX_DEFROST_ON), |
| 281 | toInt(VehicleProperty::HVAC_RECIRC_ON), |
| 282 | toInt(VehicleProperty::HVAC_DUAL_ON), |
| 283 | toInt(VehicleProperty::HVAC_AUTO_ON), |
| 284 | toInt(VehicleProperty::HVAC_POWER_ON), |
| 285 | toInt(VehicleProperty::HVAC_AUTO_RECIRC_ON), |
| 286 | toInt(VehicleProperty::HVAC_ELECTRIC_DEFROSTER_ON)}; |
| 287 | auto result = mVhalClient->getAllPropConfigs(); |
| 288 | ASSERT_TRUE(result.ok()); |
| 289 | |
| 290 | for (const auto& cfgPtr : result.value()) { |
| 291 | const IHalPropConfig& cfg = *cfgPtr; |
| 292 | int32_t propId = cfg.getPropId(); |
| 293 | // test on boolean and writable property |
| 294 | if (cfg.getAccess() == toInt(VehiclePropertyAccess::READ_WRITE) && |
| 295 | isBooleanGlobalProp(propId) && !hvacProps.count(propId)) { |
| 296 | auto propToGet = mVhalClient->createHalPropValue(propId); |
| 297 | auto getValueResult = mVhalClient->getValueSync(*propToGet); |
| 298 | |
| 299 | ASSERT_TRUE(getValueResult.ok()) |
| 300 | << StringPrintf("Failed to get value for property: %" PRId32 ", error: %s", |
| 301 | propId, getValueResult.error().message().c_str()); |
| 302 | ASSERT_NE(getValueResult.value(), nullptr) |
| 303 | << StringPrintf("Result value must not be null for property: %" PRId32, propId); |
| 304 | |
| 305 | const IHalPropValue& value = *getValueResult.value(); |
| 306 | size_t intValueSize = value.getInt32Values().size(); |
| 307 | ASSERT_EQ(intValueSize, 1u) << StringPrintf( |
| 308 | "Expect exactly 1 int value for boolean property: %" PRId32 ", got %zu", propId, |
| 309 | intValueSize); |
| 310 | |
| 311 | int setValue = value.getInt32Values()[0] == 1 ? 0 : 1; |
| 312 | auto propToSet = mVhalClient->createHalPropValue(propId); |
| 313 | propToSet->setInt32Values({setValue}); |
| 314 | auto setValueResult = mVhalClient->setValueSync(*propToSet); |
| 315 | |
| 316 | ASSERT_TRUE(setValueResult.ok()) |
| 317 | << StringPrintf("Failed to set value for property: %" PRId32 ", error: %s", |
| 318 | propId, setValueResult.error().message().c_str()); |
| 319 | |
| 320 | // check set success |
| 321 | getValueResult = mVhalClient->getValueSync(*propToGet); |
| 322 | ASSERT_TRUE(getValueResult.ok()) |
| 323 | << StringPrintf("Failed to get value for property: %" PRId32 ", error: %s", |
| 324 | propId, getValueResult.error().message().c_str()); |
| 325 | ASSERT_NE(getValueResult.value(), nullptr) |
| 326 | << StringPrintf("Result value must not be null for property: %" PRId32, propId); |
| 327 | ASSERT_EQ(getValueResult.value()->getInt32Values(), std::vector<int32_t>({setValue})) |
| 328 | << StringPrintf("Boolean value not updated after set for property: %" PRId32, |
| 329 | propId); |
| 330 | } |
| 331 | } |
| 332 | } |
| 333 | |
| 334 | // Test set() on an read_only property. |
| 335 | TEST_P(VtsHalAutomotiveVehicleTargetTest, setNotWritableProp) { |
| 336 | ALOGD("VtsHalAutomotiveVehicleTargetTest::setNotWritableProp"); |
| 337 | |
| 338 | int32_t propId = toInt(VehicleProperty::PERF_VEHICLE_SPEED); |
Yu Shan | 0ebd876 | 2023-10-11 11:31:04 -0700 | [diff] [blame] | 339 | if (!checkIsSupported(propId)) { |
| 340 | GTEST_SKIP() << "Property: " << propId << " is not supported, skip the test"; |
| 341 | } |
Yu Shan | ec5d5b0 | 2023-10-09 14:43:36 -0700 | [diff] [blame] | 342 | |
Yu Shan | 726d51a | 2022-02-22 17:37:21 -0800 | [diff] [blame] | 343 | auto getValueResult = mVhalClient->getValueSync(*mVhalClient->createHalPropValue(propId)); |
| 344 | ASSERT_TRUE(getValueResult.ok()) |
| 345 | << StringPrintf("Failed to get value for property: %" PRId32 ", error: %s", propId, |
| 346 | getValueResult.error().message().c_str()); |
| 347 | |
| 348 | auto setValueResult = mVhalClient->setValueSync(*getValueResult.value()); |
| 349 | |
| 350 | ASSERT_FALSE(setValueResult.ok()) << "Expect set a read-only value to fail"; |
Chen Cheng | faf9adc | 2022-06-22 23:09:09 +0000 | [diff] [blame] | 351 | ASSERT_EQ(setValueResult.error().code(), ErrorCode::ACCESS_DENIED_FROM_VHAL); |
Yu Shan | 726d51a | 2022-02-22 17:37:21 -0800 | [diff] [blame] | 352 | } |
| 353 | |
shrikar | 8a14023 | 2023-03-07 16:57:59 +0000 | [diff] [blame] | 354 | // Test get(), set() and getAllPropConfigs() on VehicleProperty::INVALID. |
| 355 | TEST_P(VtsHalAutomotiveVehicleTargetTest, getSetPropertyIdInvalid) { |
| 356 | ALOGD("VtsHalAutomotiveVehicleTargetTest::getSetPropertyIdInvalid"); |
| 357 | |
| 358 | int32_t propId = toInt(VehicleProperty::INVALID); |
| 359 | auto getValueResult = mVhalClient->getValueSync(*mVhalClient->createHalPropValue(propId)); |
| 360 | ASSERT_FALSE(getValueResult.ok()) << "Expect get on VehicleProperty::INVALID to fail"; |
| 361 | ASSERT_EQ(getValueResult.error().code(), ErrorCode::INVALID_ARG); |
| 362 | |
| 363 | auto propToSet = mVhalClient->createHalPropValue(propId); |
| 364 | propToSet->setInt32Values({0}); |
| 365 | auto setValueResult = mVhalClient->setValueSync(*propToSet); |
| 366 | ASSERT_FALSE(setValueResult.ok()) << "Expect set on VehicleProperty::INVALID to fail"; |
| 367 | ASSERT_EQ(setValueResult.error().code(), ErrorCode::INVALID_ARG); |
| 368 | |
| 369 | auto result = mVhalClient->getAllPropConfigs(); |
| 370 | ASSERT_TRUE(result.ok()); |
| 371 | for (const auto& cfgPtr : result.value()) { |
| 372 | const IHalPropConfig& cfg = *cfgPtr; |
| 373 | ASSERT_FALSE(cfg.getPropId() == propId) << "Expect VehicleProperty::INVALID to not be " |
| 374 | "included in propConfigs"; |
| 375 | } |
| 376 | } |
| 377 | |
Yu Shan | 726d51a | 2022-02-22 17:37:21 -0800 | [diff] [blame] | 378 | // Test subscribe() and unsubscribe(). |
| 379 | TEST_P(VtsHalAutomotiveVehicleTargetTest, subscribeAndUnsubscribe) { |
| 380 | ALOGD("VtsHalAutomotiveVehicleTargetTest::subscribeAndUnsubscribe"); |
| 381 | |
| 382 | int32_t propId = toInt(VehicleProperty::PERF_VEHICLE_SPEED); |
Yu Shan | 0ebd876 | 2023-10-11 11:31:04 -0700 | [diff] [blame] | 383 | if (!checkIsSupported(propId)) { |
| 384 | GTEST_SKIP() << "Property: " << propId << " is not supported, skip the test"; |
| 385 | } |
Yu Shan | 726d51a | 2022-02-22 17:37:21 -0800 | [diff] [blame] | 386 | |
Yu Shan | 4569ef5 | 2022-03-18 14:34:25 -0700 | [diff] [blame] | 387 | auto propConfigsResult = mVhalClient->getPropConfigs({propId}); |
| 388 | |
| 389 | ASSERT_TRUE(propConfigsResult.ok()) << "Failed to get property config for PERF_VEHICLE_SPEED: " |
| 390 | << "error: " << propConfigsResult.error().message(); |
| 391 | ASSERT_EQ(propConfigsResult.value().size(), 1u) |
| 392 | << "Expect to return 1 config for PERF_VEHICLE_SPEED"; |
| 393 | auto& propConfig = propConfigsResult.value()[0]; |
| 394 | float minSampleRate = propConfig->getMinSampleRate(); |
| 395 | float maxSampleRate = propConfig->getMaxSampleRate(); |
| 396 | |
| 397 | if (minSampleRate < 1) { |
| 398 | GTEST_SKIP() << "Sample rate for vehicle speed < 1 times/sec, skip test since it would " |
| 399 | "take too long"; |
| 400 | } |
Yu Shan | 726d51a | 2022-02-22 17:37:21 -0800 | [diff] [blame] | 401 | |
| 402 | auto client = mVhalClient->getSubscriptionClient(mCallback); |
| 403 | ASSERT_NE(client, nullptr) << "Failed to get subscription client"; |
| 404 | |
Yu Shan | 4569ef5 | 2022-03-18 14:34:25 -0700 | [diff] [blame] | 405 | auto result = client->subscribe({{.propId = propId, .sampleRate = minSampleRate}}); |
Yu Shan | 726d51a | 2022-02-22 17:37:21 -0800 | [diff] [blame] | 406 | |
| 407 | ASSERT_TRUE(result.ok()) << StringPrintf("Failed to subscribe to property: %" PRId32 |
| 408 | ", error: %s", |
| 409 | propId, result.error().message().c_str()); |
Yu Shan | 4569ef5 | 2022-03-18 14:34:25 -0700 | [diff] [blame] | 410 | |
| 411 | if (mVhalClient->isAidlVhal()) { |
| 412 | // Skip checking timestamp for HIDL because the behavior for sample rate and timestamp is |
| 413 | // only specified clearly for AIDL. |
| 414 | |
| 415 | // Timeout is 2 seconds, which gives a 1 second buffer. |
| 416 | ASSERT_TRUE(mCallback->waitForExpectedEvents(propId, std::floor(minSampleRate), |
| 417 | std::chrono::seconds(2))) |
| 418 | << "Didn't get enough events for subscribing to minSampleRate"; |
| 419 | } |
| 420 | |
| 421 | result = client->subscribe({{.propId = propId, .sampleRate = maxSampleRate}}); |
| 422 | |
| 423 | ASSERT_TRUE(result.ok()) << StringPrintf("Failed to subscribe to property: %" PRId32 |
| 424 | ", error: %s", |
| 425 | propId, result.error().message().c_str()); |
| 426 | |
| 427 | if (mVhalClient->isAidlVhal()) { |
| 428 | ASSERT_TRUE(mCallback->waitForExpectedEvents(propId, std::floor(maxSampleRate), |
| 429 | std::chrono::seconds(2))) |
| 430 | << "Didn't get enough events for subscribing to maxSampleRate"; |
| 431 | |
| 432 | std::unordered_set<int64_t> timestamps; |
| 433 | // Event event should have a different timestamp. |
| 434 | for (const int64_t& eventTimestamp : mCallback->getEventTimestamps(propId)) { |
| 435 | ASSERT_TRUE(timestamps.find(eventTimestamp) == timestamps.end()) |
| 436 | << "two events for the same property must not have the same timestamp"; |
| 437 | timestamps.insert(eventTimestamp); |
| 438 | } |
| 439 | } |
Yu Shan | 726d51a | 2022-02-22 17:37:21 -0800 | [diff] [blame] | 440 | |
| 441 | result = client->unsubscribe({propId}); |
| 442 | ASSERT_TRUE(result.ok()) << StringPrintf("Failed to unsubscribe to property: %" PRId32 |
| 443 | ", error: %s", |
| 444 | propId, result.error().message().c_str()); |
| 445 | |
| 446 | mCallback->reset(); |
| 447 | ASSERT_FALSE(mCallback->waitForExpectedEvents(propId, 10, std::chrono::seconds(1))) |
| 448 | << "Expect not to get events after unsubscription"; |
| 449 | } |
| 450 | |
| 451 | // Test subscribe() with an invalid property. |
| 452 | TEST_P(VtsHalAutomotiveVehicleTargetTest, subscribeInvalidProp) { |
| 453 | ALOGD("VtsHalAutomotiveVehicleTargetTest::subscribeInvalidProp"); |
| 454 | |
| 455 | std::vector<SubscribeOptions> options = { |
| 456 | SubscribeOptions{.propId = kInvalidProp, .sampleRate = 10.0}}; |
| 457 | |
| 458 | auto client = mVhalClient->getSubscriptionClient(mCallback); |
| 459 | ASSERT_NE(client, nullptr) << "Failed to get subscription client"; |
| 460 | |
| 461 | auto result = client->subscribe(options); |
| 462 | |
| 463 | ASSERT_FALSE(result.ok()) << StringPrintf("Expect subscribing to property: %" PRId32 " to fail", |
| 464 | kInvalidProp); |
| 465 | } |
| 466 | |
Yu Shan | 4569ef5 | 2022-03-18 14:34:25 -0700 | [diff] [blame] | 467 | // Test the timestamp returned in GetValues results is the timestamp when the value is retrieved. |
| 468 | TEST_P(VtsHalAutomotiveVehicleTargetTest, testGetValuesTimestampAIDL) { |
| 469 | if (!mVhalClient->isAidlVhal()) { |
| 470 | GTEST_SKIP() << "Skip checking timestamp for HIDL because the behavior is only specified " |
| 471 | "for AIDL"; |
| 472 | } |
| 473 | |
| 474 | int32_t propId = toInt(VehicleProperty::PARKING_BRAKE_ON); |
Yu Shan | 0ebd876 | 2023-10-11 11:31:04 -0700 | [diff] [blame] | 475 | if (!checkIsSupported(propId)) { |
| 476 | GTEST_SKIP() << "Property: " << propId << " is not supported, skip the test"; |
| 477 | } |
Yu Shan | 4569ef5 | 2022-03-18 14:34:25 -0700 | [diff] [blame] | 478 | auto prop = mVhalClient->createHalPropValue(propId); |
| 479 | |
| 480 | auto result = mVhalClient->getValueSync(*prop); |
| 481 | |
| 482 | ASSERT_TRUE(result.ok()) << StringPrintf("Failed to get value for property: %" PRId32 |
| 483 | ", error: %s", |
| 484 | propId, result.error().message().c_str()); |
| 485 | ASSERT_NE(result.value(), nullptr) << "Result value must not be null"; |
| 486 | ASSERT_EQ(result.value()->getInt32Values().size(), 1u) << "Result must contain 1 int value"; |
| 487 | |
| 488 | bool parkBrakeOnValue1 = (result.value()->getInt32Values()[0] == 1); |
| 489 | int64_t timestampValue1 = result.value()->getTimestamp(); |
| 490 | |
| 491 | result = mVhalClient->getValueSync(*prop); |
| 492 | |
| 493 | ASSERT_TRUE(result.ok()) << StringPrintf("Failed to get value for property: %" PRId32 |
| 494 | ", error: %s", |
| 495 | propId, result.error().message().c_str()); |
| 496 | ASSERT_NE(result.value(), nullptr) << "Result value must not be null"; |
| 497 | ASSERT_EQ(result.value()->getInt32Values().size(), 1u) << "Result must contain 1 int value"; |
| 498 | |
| 499 | bool parkBarkeOnValue2 = (result.value()->getInt32Values()[0] == 1); |
| 500 | int64_t timestampValue2 = result.value()->getTimestamp(); |
| 501 | |
| 502 | if (parkBarkeOnValue2 == parkBrakeOnValue1) { |
| 503 | ASSERT_EQ(timestampValue2, timestampValue1) |
| 504 | << "getValue result must contain a timestamp updated when the value was updated, if" |
| 505 | "the value does not change, expect the same timestamp"; |
| 506 | } else { |
| 507 | ASSERT_GT(timestampValue2, timestampValue1) |
| 508 | << "getValue result must contain a timestamp updated when the value was updated, if" |
| 509 | "the value changes, expect the newer value has a larger timestamp"; |
| 510 | } |
| 511 | } |
| 512 | |
Aaqib Ismail | 2048670 | 2022-10-27 16:58:50 -0700 | [diff] [blame] | 513 | // Helper function to compare actual vs expected property config |
| 514 | void VtsHalAutomotiveVehicleTargetTest::verifyProperty(VehicleProperty propId, |
| 515 | VehiclePropertyAccess access, |
| 516 | VehiclePropertyChangeMode changeMode, |
| 517 | VehiclePropertyGroup group, VehicleArea area, |
| 518 | VehiclePropertyType propertyType) { |
| 519 | int expectedPropId = toInt(propId); |
| 520 | int expectedAccess = toInt(access); |
| 521 | int expectedChangeMode = toInt(changeMode); |
| 522 | int expectedGroup = toInt(group); |
| 523 | int expectedArea = toInt(area); |
| 524 | int expectedPropertyType = toInt(propertyType); |
| 525 | |
Eva Chen | 17bc578 | 2023-01-06 22:59:58 -0800 | [diff] [blame] | 526 | auto result = mVhalClient->getAllPropConfigs(); |
| 527 | ASSERT_TRUE(result.ok()) << "Failed to get all property configs, error: " |
| 528 | << result.error().message(); |
| 529 | |
| 530 | // Check if property is implemented by getting all configs and looking to see if the expected |
| 531 | // property id is in that list. |
| 532 | bool isExpectedPropIdImplemented = false; |
| 533 | for (const auto& cfgPtr : result.value()) { |
| 534 | const IHalPropConfig& cfg = *cfgPtr; |
| 535 | if (expectedPropId == cfg.getPropId()) { |
| 536 | isExpectedPropIdImplemented = true; |
| 537 | break; |
| 538 | } |
| 539 | } |
| 540 | |
| 541 | if (!isExpectedPropIdImplemented) { |
| 542 | GTEST_SKIP() << StringPrintf("Property %" PRId32 " has not been implemented", |
| 543 | expectedPropId); |
| 544 | } |
| 545 | |
| 546 | result = mVhalClient->getPropConfigs({expectedPropId}); |
Aaqib Ismail | 2048670 | 2022-10-27 16:58:50 -0700 | [diff] [blame] | 547 | ASSERT_TRUE(result.ok()) << "Failed to get required property config, error: " |
| 548 | << result.error().message(); |
| 549 | |
Aaqib Ismail | 2048670 | 2022-10-27 16:58:50 -0700 | [diff] [blame] | 550 | ASSERT_EQ(result.value().size(), 1u) |
| 551 | << StringPrintf("Expect to get exactly 1 config, got %zu", result.value().size()); |
| 552 | |
| 553 | const auto& config = result.value().at(0); |
| 554 | int actualPropId = config->getPropId(); |
| 555 | int actualAccess = config->getAccess(); |
| 556 | int actualChangeMode = config->getChangeMode(); |
| 557 | int actualGroup = actualPropId & toInt(VehiclePropertyGroup::MASK); |
| 558 | int actualArea = actualPropId & toInt(VehicleArea::MASK); |
| 559 | int actualPropertyType = actualPropId & toInt(VehiclePropertyType::MASK); |
| 560 | |
| 561 | ASSERT_EQ(actualPropId, expectedPropId) |
| 562 | << StringPrintf("Expect to get property ID: %i, got %i", expectedPropId, actualPropId); |
| 563 | |
| 564 | if (expectedAccess == toInt(VehiclePropertyAccess::READ_WRITE)) { |
| 565 | ASSERT_TRUE(actualAccess == expectedAccess || |
| 566 | actualAccess == toInt(VehiclePropertyAccess::READ)) |
| 567 | << StringPrintf("Expect to get VehiclePropertyAccess: %i or %i, got %i", |
| 568 | expectedAccess, toInt(VehiclePropertyAccess::READ), actualAccess); |
| 569 | } else { |
| 570 | ASSERT_EQ(actualAccess, expectedAccess) << StringPrintf( |
| 571 | "Expect to get VehiclePropertyAccess: %i, got %i", expectedAccess, actualAccess); |
| 572 | } |
| 573 | |
| 574 | ASSERT_EQ(actualChangeMode, expectedChangeMode) |
| 575 | << StringPrintf("Expect to get VehiclePropertyChangeMode: %i, got %i", |
| 576 | expectedChangeMode, actualChangeMode); |
| 577 | ASSERT_EQ(actualGroup, expectedGroup) << StringPrintf( |
| 578 | "Expect to get VehiclePropertyGroup: %i, got %i", expectedGroup, actualGroup); |
| 579 | ASSERT_EQ(actualArea, expectedArea) |
| 580 | << StringPrintf("Expect to get VehicleArea: %i, got %i", expectedArea, actualArea); |
| 581 | ASSERT_EQ(actualPropertyType, expectedPropertyType) |
| 582 | << StringPrintf("Expect to get VehiclePropertyType: %i, got %i", expectedPropertyType, |
| 583 | actualPropertyType); |
| 584 | } |
| 585 | |
shrikar | 3456364 | 2023-02-14 02:57:17 +0000 | [diff] [blame] | 586 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyLocationCharacterizationConfig) { |
| 587 | verifyProperty(VehicleProperty::LOCATION_CHARACTERIZATION, VehiclePropertyAccess::READ, |
| 588 | VehiclePropertyChangeMode::STATIC, VehiclePropertyGroup::SYSTEM, |
| 589 | VehicleArea::GLOBAL, VehiclePropertyType::INT32); |
| 590 | } |
| 591 | |
Eva Chen | 544b24b | 2023-12-05 00:13:53 -0800 | [diff] [blame] | 592 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyUltrasonicsSensorPositionConfig) { |
| 593 | verifyProperty(VehicleProperty::ULTRASONICS_SENSOR_POSITION, VehiclePropertyAccess::READ, |
| 594 | VehiclePropertyChangeMode::STATIC, VehiclePropertyGroup::SYSTEM, |
| 595 | VehicleArea::VENDOR, VehiclePropertyType::INT32_VEC); |
| 596 | } |
| 597 | |
Eva Chen | 9e226e5 | 2023-12-06 00:23:18 -0800 | [diff] [blame] | 598 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyUltrasonicsSensorOrientationConfig) { |
| 599 | verifyProperty(VehicleProperty::ULTRASONICS_SENSOR_ORIENTATION, VehiclePropertyAccess::READ, |
| 600 | VehiclePropertyChangeMode::STATIC, VehiclePropertyGroup::SYSTEM, |
| 601 | VehicleArea::VENDOR, VehiclePropertyType::INT32_VEC); |
| 602 | } |
| 603 | |
Eva Chen | 727aa3f | 2023-12-06 01:13:29 -0800 | [diff] [blame] | 604 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyUltrasonicsSensorFieldOfViewConfig) { |
| 605 | verifyProperty(VehicleProperty::ULTRASONICS_SENSOR_FIELD_OF_VIEW, VehiclePropertyAccess::READ, |
| 606 | VehiclePropertyChangeMode::STATIC, VehiclePropertyGroup::SYSTEM, |
| 607 | VehicleArea::VENDOR, VehiclePropertyType::INT32_VEC); |
| 608 | } |
| 609 | |
Eva Chen | 968bf44 | 2023-12-06 01:21:51 -0800 | [diff] [blame] | 610 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyUltrasonicsSensorDetectionRangeConfig) { |
| 611 | verifyProperty(VehicleProperty::ULTRASONICS_SENSOR_DETECTION_RANGE, VehiclePropertyAccess::READ, |
| 612 | VehiclePropertyChangeMode::STATIC, VehiclePropertyGroup::SYSTEM, |
| 613 | VehicleArea::VENDOR, VehiclePropertyType::INT32_VEC); |
| 614 | } |
| 615 | |
Eva Chen | df05df5 | 2023-12-06 01:42:55 -0800 | [diff] [blame] | 616 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyUltrasonicsSensorSupportedRangesConfig) { |
| 617 | verifyProperty(VehicleProperty::ULTRASONICS_SENSOR_SUPPORTED_RANGES, |
| 618 | VehiclePropertyAccess::READ, VehiclePropertyChangeMode::STATIC, |
| 619 | VehiclePropertyGroup::SYSTEM, VehicleArea::VENDOR, |
| 620 | VehiclePropertyType::INT32_VEC); |
| 621 | } |
| 622 | |
Eva Chen | 7566173 | 2023-12-06 01:51:40 -0800 | [diff] [blame] | 623 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyUltrasonicsSensorMeasuredDistanceConfig) { |
| 624 | verifyProperty(VehicleProperty::ULTRASONICS_SENSOR_MEASURED_DISTANCE, |
| 625 | VehiclePropertyAccess::READ, VehiclePropertyChangeMode::CONTINUOUS, |
| 626 | VehiclePropertyGroup::SYSTEM, VehicleArea::VENDOR, |
| 627 | VehiclePropertyType::INT32_VEC); |
| 628 | } |
| 629 | |
shrikar | 668df36 | 2022-12-20 22:08:17 +0000 | [diff] [blame] | 630 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyEmergencyLaneKeepAssistEnabledConfig) { |
| 631 | verifyProperty(VehicleProperty::EMERGENCY_LANE_KEEP_ASSIST_ENABLED, |
| 632 | VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE, |
| 633 | VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN); |
| 634 | } |
| 635 | |
shrikar | 80cc0c5 | 2023-01-30 16:56:53 +0000 | [diff] [blame] | 636 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyEmergencyLaneKeepAssistStateConfig) { |
| 637 | verifyProperty(VehicleProperty::EMERGENCY_LANE_KEEP_ASSIST_STATE, VehiclePropertyAccess::READ, |
| 638 | VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, |
| 639 | VehicleArea::GLOBAL, VehiclePropertyType::INT32); |
| 640 | } |
| 641 | |
shrikar | 5d1b816 | 2023-01-25 19:31:23 +0000 | [diff] [blame] | 642 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyCruiseControlEnabledConfig) { |
| 643 | verifyProperty(VehicleProperty::CRUISE_CONTROL_ENABLED, VehiclePropertyAccess::READ_WRITE, |
| 644 | VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, |
| 645 | VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN); |
shrikar | 808a294 | 2022-12-21 17:07:32 +0000 | [diff] [blame] | 646 | } |
| 647 | |
shrikar | d440ed4 | 2023-01-31 00:25:14 +0000 | [diff] [blame] | 648 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyCruiseControlTypeConfig) { |
| 649 | verifyProperty(VehicleProperty::CRUISE_CONTROL_TYPE, VehiclePropertyAccess::READ_WRITE, |
| 650 | VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, |
| 651 | VehicleArea::GLOBAL, VehiclePropertyType::INT32); |
| 652 | } |
| 653 | |
shrikar | 2753b9e | 2023-01-31 00:25:14 +0000 | [diff] [blame] | 654 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyCruiseControlStateConfig) { |
| 655 | verifyProperty(VehicleProperty::CRUISE_CONTROL_STATE, VehiclePropertyAccess::READ, |
| 656 | VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, |
| 657 | VehicleArea::GLOBAL, VehiclePropertyType::INT32); |
| 658 | } |
| 659 | |
shrikar | 5df0f95 | 2023-02-02 00:15:39 +0000 | [diff] [blame] | 660 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyCruiseControlCommandConfig) { |
| 661 | verifyProperty(VehicleProperty::CRUISE_CONTROL_COMMAND, VehiclePropertyAccess::WRITE, |
| 662 | VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, |
| 663 | VehicleArea::GLOBAL, VehiclePropertyType::INT32); |
| 664 | } |
| 665 | |
shrikar | fde8c24 | 2023-02-02 01:10:33 +0000 | [diff] [blame] | 666 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyCruiseControlTargetSpeedConfig) { |
| 667 | verifyProperty(VehicleProperty::CRUISE_CONTROL_TARGET_SPEED, VehiclePropertyAccess::READ, |
| 668 | VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, |
| 669 | VehicleArea::GLOBAL, VehiclePropertyType::FLOAT); |
| 670 | } |
| 671 | |
shrikar | b9661d3 | 2023-02-02 19:22:50 +0000 | [diff] [blame] | 672 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyAdaptiveCruiseControlTargetTimeGapConfig) { |
| 673 | verifyProperty(VehicleProperty::ADAPTIVE_CRUISE_CONTROL_TARGET_TIME_GAP, |
| 674 | VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE, |
| 675 | VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::INT32); |
| 676 | } |
| 677 | |
shrikar | f62d747 | 2023-02-03 00:20:04 +0000 | [diff] [blame] | 678 | TEST_P(VtsHalAutomotiveVehicleTargetTest, |
| 679 | verifyAdaptiveCruiseControlLeadVehicleMeasuredDistanceConfig) { |
| 680 | verifyProperty(VehicleProperty::ADAPTIVE_CRUISE_CONTROL_LEAD_VEHICLE_MEASURED_DISTANCE, |
| 681 | VehiclePropertyAccess::READ, VehiclePropertyChangeMode::CONTINUOUS, |
| 682 | VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::INT32); |
| 683 | } |
| 684 | |
shrikar | 37833e1 | 2022-12-15 20:13:14 +0000 | [diff] [blame] | 685 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyHandsOnDetectionEnabledConfig) { |
| 686 | verifyProperty(VehicleProperty::HANDS_ON_DETECTION_ENABLED, VehiclePropertyAccess::READ_WRITE, |
| 687 | VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, |
| 688 | VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN); |
| 689 | } |
| 690 | |
shrikar | 6d88bf5 | 2023-01-17 17:04:21 +0000 | [diff] [blame] | 691 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyHandsOnDetectionDriverStateConfig) { |
| 692 | verifyProperty(VehicleProperty::HANDS_ON_DETECTION_DRIVER_STATE, VehiclePropertyAccess::READ, |
| 693 | VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, |
| 694 | VehicleArea::GLOBAL, VehiclePropertyType::INT32); |
| 695 | } |
| 696 | |
shrikar | a678599 | 2023-01-18 23:07:06 +0000 | [diff] [blame] | 697 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyHandsOnDetectionWarningConfig) { |
| 698 | verifyProperty(VehicleProperty::HANDS_ON_DETECTION_WARNING, VehiclePropertyAccess::READ, |
| 699 | VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, |
| 700 | VehicleArea::GLOBAL, VehiclePropertyType::INT32); |
| 701 | } |
| 702 | |
Eva Chen | bbb7b6d | 2023-11-21 00:07:14 -0800 | [diff] [blame] | 703 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyDriverDrowsinessAttentionSystemEnabledConfig) { |
| 704 | verifyProperty(VehicleProperty::DRIVER_DROWSINESS_ATTENTION_SYSTEM_ENABLED, |
| 705 | VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE, |
| 706 | VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN); |
| 707 | } |
| 708 | |
Eva Chen | 9f1d8c0 | 2023-11-28 16:50:14 -0800 | [diff] [blame] | 709 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyDriverDrowsinessAttentionStateConfig) { |
| 710 | verifyProperty(VehicleProperty::DRIVER_DROWSINESS_ATTENTION_STATE, VehiclePropertyAccess::READ, |
| 711 | VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, |
| 712 | VehicleArea::GLOBAL, VehiclePropertyType::INT32); |
| 713 | } |
| 714 | |
Eva Chen | 6ec790b | 2023-12-01 23:37:29 -0800 | [diff] [blame] | 715 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyDriverDrowsinessAttentionWarningEnabledConfig) { |
| 716 | verifyProperty(VehicleProperty::DRIVER_DROWSINESS_ATTENTION_WARNING_ENABLED, |
| 717 | VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE, |
| 718 | VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN); |
| 719 | } |
| 720 | |
Eva Chen | 05c548c | 2023-12-02 01:20:10 -0800 | [diff] [blame] | 721 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyDriverDrowsinessAttentionWarningConfig) { |
| 722 | verifyProperty(VehicleProperty::DRIVER_DROWSINESS_ATTENTION_WARNING, |
| 723 | VehiclePropertyAccess::READ, VehiclePropertyChangeMode::ON_CHANGE, |
| 724 | VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::INT32); |
| 725 | } |
| 726 | |
Eva Chen | 51770b0 | 2023-12-02 15:27:31 -0800 | [diff] [blame] | 727 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyDriverDistractionSystemEnabledConfig) { |
| 728 | verifyProperty(VehicleProperty::DRIVER_DISTRACTION_SYSTEM_ENABLED, |
| 729 | VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE, |
| 730 | VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN); |
| 731 | } |
| 732 | |
Eva Chen | a342b72 | 2023-12-04 00:40:45 -0800 | [diff] [blame] | 733 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyDriverDistractionStateConfig) { |
| 734 | verifyProperty(VehicleProperty::DRIVER_DISTRACTION_STATE, VehiclePropertyAccess::READ, |
| 735 | VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, |
| 736 | VehicleArea::GLOBAL, VehiclePropertyType::INT32); |
| 737 | } |
| 738 | |
Eva Chen | c62166e | 2023-12-04 02:17:36 -0800 | [diff] [blame] | 739 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyDriverDistractionWarningEnabledConfig) { |
| 740 | verifyProperty(VehicleProperty::DRIVER_DISTRACTION_WARNING_ENABLED, |
| 741 | VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE, |
| 742 | VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN); |
| 743 | } |
| 744 | |
Eva Chen | 9a0925e | 2023-12-04 03:52:23 -0800 | [diff] [blame] | 745 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyDriverDistractionWarningConfig) { |
| 746 | verifyProperty(VehicleProperty::DRIVER_DISTRACTION_WARNING, VehiclePropertyAccess::READ, |
| 747 | VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, |
| 748 | VehicleArea::GLOBAL, VehiclePropertyType::INT32); |
| 749 | } |
| 750 | |
Aaqib Ismail | c69e968 | 2022-11-22 12:50:00 -0800 | [diff] [blame] | 751 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyEvBrakeRegenerationLevelConfig) { |
| 752 | verifyProperty(VehicleProperty::EV_BRAKE_REGENERATION_LEVEL, |
| 753 | VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE, |
| 754 | VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::INT32); |
| 755 | } |
| 756 | |
shrikar | 2dae80f | 2022-12-21 23:50:17 +0000 | [diff] [blame] | 757 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyEvStoppingModeConfig) { |
| 758 | verifyProperty(VehicleProperty::EV_STOPPING_MODE, VehiclePropertyAccess::READ_WRITE, |
| 759 | VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, |
| 760 | VehicleArea::GLOBAL, VehiclePropertyType::INT32); |
| 761 | } |
| 762 | |
Aaqib Ismail | aec678a | 2022-12-07 16:22:42 -0800 | [diff] [blame] | 763 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyEvCurrentBatteryCapacityConfig) { |
| 764 | verifyProperty(VehicleProperty::EV_CURRENT_BATTERY_CAPACITY, VehiclePropertyAccess::READ, |
| 765 | VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, |
| 766 | VehicleArea::GLOBAL, VehiclePropertyType::FLOAT); |
| 767 | } |
| 768 | |
shrikar | 8391447 | 2022-12-16 20:28:47 +0000 | [diff] [blame] | 769 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyEngineIdleAutoStopEnabledConfig) { |
| 770 | verifyProperty(VehicleProperty::ENGINE_IDLE_AUTO_STOP_ENABLED, |
| 771 | VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE, |
| 772 | VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN); |
| 773 | } |
| 774 | |
Aaqib Ismail | 2048670 | 2022-10-27 16:58:50 -0700 | [diff] [blame] | 775 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyDoorChildLockEnabledConfig) { |
| 776 | verifyProperty(VehicleProperty::DOOR_CHILD_LOCK_ENABLED, VehiclePropertyAccess::READ_WRITE, |
| 777 | VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, |
| 778 | VehicleArea::DOOR, VehiclePropertyType::BOOLEAN); |
| 779 | } |
| 780 | |
Aaqib Ismail | 63d52d1 | 2023-01-30 12:35:10 -0800 | [diff] [blame] | 781 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyWindshieldWipersPeriodConfig) { |
| 782 | verifyProperty(VehicleProperty::WINDSHIELD_WIPERS_PERIOD, VehiclePropertyAccess::READ, |
| 783 | VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, |
| 784 | VehicleArea::WINDOW, VehiclePropertyType::INT32); |
| 785 | } |
| 786 | |
Aaqib Ismail | 732a1d7 | 2023-01-31 10:25:45 -0800 | [diff] [blame] | 787 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyWindshieldWipersStateConfig) { |
| 788 | verifyProperty(VehicleProperty::WINDSHIELD_WIPERS_STATE, VehiclePropertyAccess::READ, |
| 789 | VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, |
| 790 | VehicleArea::WINDOW, VehiclePropertyType::INT32); |
| 791 | } |
| 792 | |
Aaqib Ismail | c37a211 | 2023-02-02 11:30:08 -0800 | [diff] [blame] | 793 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyWindshieldWipersSwitchConfig) { |
| 794 | verifyProperty(VehicleProperty::WINDSHIELD_WIPERS_SWITCH, VehiclePropertyAccess::READ_WRITE, |
| 795 | VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, |
| 796 | VehicleArea::WINDOW, VehiclePropertyType::INT32); |
| 797 | } |
| 798 | |
Aaqib Ismail | 7f941b4 | 2022-11-04 14:55:13 -0700 | [diff] [blame] | 799 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySteeringWheelDepthPosConfig) { |
| 800 | verifyProperty(VehicleProperty::STEERING_WHEEL_DEPTH_POS, VehiclePropertyAccess::READ_WRITE, |
| 801 | VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, |
| 802 | VehicleArea::GLOBAL, VehiclePropertyType::INT32); |
| 803 | } |
| 804 | |
Aaqib Ismail | 34fe92f | 2022-11-04 21:41:23 -0700 | [diff] [blame] | 805 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySteeringWheelDepthMoveConfig) { |
| 806 | verifyProperty(VehicleProperty::STEERING_WHEEL_DEPTH_MOVE, VehiclePropertyAccess::READ_WRITE, |
| 807 | VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, |
| 808 | VehicleArea::GLOBAL, VehiclePropertyType::INT32); |
| 809 | } |
| 810 | |
Aaqib Ismail | 53b81c9 | 2022-11-07 17:47:04 -0800 | [diff] [blame] | 811 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySteeringWheelHeightPosConfig) { |
| 812 | verifyProperty(VehicleProperty::STEERING_WHEEL_HEIGHT_POS, VehiclePropertyAccess::READ_WRITE, |
| 813 | VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, |
| 814 | VehicleArea::GLOBAL, VehiclePropertyType::INT32); |
| 815 | } |
| 816 | |
Aaqib Ismail | 6c4bf19 | 2022-11-08 15:00:32 -0800 | [diff] [blame] | 817 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySteeringWheelHeightMoveConfig) { |
| 818 | verifyProperty(VehicleProperty::STEERING_WHEEL_HEIGHT_MOVE, VehiclePropertyAccess::READ_WRITE, |
| 819 | VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, |
| 820 | VehicleArea::GLOBAL, VehiclePropertyType::INT32); |
| 821 | } |
| 822 | |
Aaqib Ismail | 8d05118 | 2022-11-09 13:28:48 -0800 | [diff] [blame] | 823 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySteeringWheelTheftLockEnabledConfig) { |
| 824 | verifyProperty(VehicleProperty::STEERING_WHEEL_THEFT_LOCK_ENABLED, |
| 825 | VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE, |
| 826 | VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN); |
| 827 | } |
| 828 | |
Aaqib Ismail | 68d3f12 | 2022-11-09 14:43:32 -0800 | [diff] [blame] | 829 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySteeringWheelLockedConfig) { |
| 830 | verifyProperty(VehicleProperty::STEERING_WHEEL_LOCKED, VehiclePropertyAccess::READ_WRITE, |
| 831 | VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, |
| 832 | VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN); |
| 833 | } |
| 834 | |
Aaqib Ismail | d4d6adf | 2022-11-09 16:59:47 -0800 | [diff] [blame] | 835 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySteeringWheelEasyAccessEnabledConfig) { |
| 836 | verifyProperty(VehicleProperty::STEERING_WHEEL_EASY_ACCESS_ENABLED, |
| 837 | VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE, |
| 838 | VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN); |
| 839 | } |
| 840 | |
Aaqib Ismail | 0dc7ba0 | 2022-11-10 14:28:09 -0800 | [diff] [blame] | 841 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySteeringWheelLightsStateConfig) { |
| 842 | verifyProperty(VehicleProperty::STEERING_WHEEL_LIGHTS_STATE, VehiclePropertyAccess::READ, |
| 843 | VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, |
| 844 | VehicleArea::GLOBAL, VehiclePropertyType::INT32); |
| 845 | } |
| 846 | |
Aaqib Ismail | 4b8688f | 2022-11-15 15:13:35 -0800 | [diff] [blame] | 847 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySteeringWheelLightsSwitchConfig) { |
| 848 | verifyProperty(VehicleProperty::STEERING_WHEEL_LIGHTS_SWITCH, VehiclePropertyAccess::READ_WRITE, |
| 849 | VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, |
| 850 | VehicleArea::GLOBAL, VehiclePropertyType::INT32); |
| 851 | } |
| 852 | |
Arati Gerdes | d86c7fd | 2022-12-19 12:32:29 -0800 | [diff] [blame] | 853 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyGloveBoxDoorPosConfig) { |
| 854 | verifyProperty(VehicleProperty::GLOVE_BOX_DOOR_POS, VehiclePropertyAccess::READ_WRITE, |
| 855 | VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, |
| 856 | VehicleArea::SEAT, VehiclePropertyType::INT32); |
| 857 | } |
| 858 | |
Aaqib Ismail | 57be403 | 2023-02-02 14:15:03 -0800 | [diff] [blame] | 859 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyGloveBoxLockedConfig) { |
| 860 | verifyProperty(VehicleProperty::GLOVE_BOX_LOCKED, VehiclePropertyAccess::READ_WRITE, |
| 861 | VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, |
| 862 | VehicleArea::SEAT, VehiclePropertyType::BOOLEAN); |
| 863 | } |
| 864 | |
shrikar | a136721 | 2022-11-02 16:07:35 +0000 | [diff] [blame] | 865 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyMirrorAutoFoldEnabledConfig) { |
| 866 | verifyProperty(VehicleProperty::MIRROR_AUTO_FOLD_ENABLED, VehiclePropertyAccess::READ_WRITE, |
| 867 | VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, |
| 868 | VehicleArea::MIRROR, VehiclePropertyType::BOOLEAN); |
| 869 | } |
| 870 | |
| 871 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyMirrorAutoTiltEnabledConfig) { |
| 872 | verifyProperty(VehicleProperty::MIRROR_AUTO_TILT_ENABLED, VehiclePropertyAccess::READ_WRITE, |
| 873 | VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, |
| 874 | VehicleArea::MIRROR, VehiclePropertyType::BOOLEAN); |
| 875 | } |
| 876 | |
Aaqib Ismail | 4e6144c | 2022-12-15 15:32:18 -0800 | [diff] [blame] | 877 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySeatHeadrestHeightPosV2Config) { |
| 878 | verifyProperty(VehicleProperty::SEAT_HEADREST_HEIGHT_POS_V2, VehiclePropertyAccess::READ_WRITE, |
| 879 | VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, |
| 880 | VehicleArea::SEAT, VehiclePropertyType::INT32); |
| 881 | } |
| 882 | |
shrikar | 6ae7916 | 2022-12-16 03:03:25 +0000 | [diff] [blame] | 883 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySeatWalkInPosConfig) { |
| 884 | verifyProperty(VehicleProperty::SEAT_WALK_IN_POS, VehiclePropertyAccess::READ_WRITE, |
| 885 | VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, |
| 886 | VehicleArea::SEAT, VehiclePropertyType::INT32); |
| 887 | } |
| 888 | |
shrikar | fb65ae5 | 2022-11-03 23:12:51 +0000 | [diff] [blame] | 889 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySeatFootwellLightsStateConfig) { |
| 890 | verifyProperty(VehicleProperty::SEAT_FOOTWELL_LIGHTS_STATE, VehiclePropertyAccess::READ, |
| 891 | VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, |
| 892 | VehicleArea::SEAT, VehiclePropertyType::INT32); |
| 893 | } |
| 894 | |
shrikar | 93cf1be | 2022-11-30 15:00:52 -0800 | [diff] [blame] | 895 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySeatFootwellLightsSwitchConfig) { |
| 896 | verifyProperty(VehicleProperty::SEAT_FOOTWELL_LIGHTS_SWITCH, VehiclePropertyAccess::READ_WRITE, |
| 897 | VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, |
| 898 | VehicleArea::SEAT, VehiclePropertyType::INT32); |
| 899 | } |
| 900 | |
shrikar | 3326de0 | 2022-11-07 23:51:20 +0000 | [diff] [blame] | 901 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySeatEasyAccessEnabledConfig) { |
| 902 | verifyProperty(VehicleProperty::SEAT_EASY_ACCESS_ENABLED, VehiclePropertyAccess::READ_WRITE, |
| 903 | VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, |
| 904 | VehicleArea::SEAT, VehiclePropertyType::BOOLEAN); |
| 905 | } |
| 906 | |
shrikar | b96e376 | 2022-11-08 16:49:58 -0800 | [diff] [blame] | 907 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySeatAirbagEnabledConfig) { |
| 908 | verifyProperty(VehicleProperty::SEAT_AIRBAG_ENABLED, VehiclePropertyAccess::READ_WRITE, |
| 909 | VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, |
| 910 | VehicleArea::SEAT, VehiclePropertyType::BOOLEAN); |
| 911 | } |
| 912 | |
shrikar | 802ecb5 | 2022-11-09 18:27:06 +0000 | [diff] [blame] | 913 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySeatCushionSideSupportPosConfig) { |
| 914 | verifyProperty(VehicleProperty::SEAT_CUSHION_SIDE_SUPPORT_POS, |
| 915 | VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE, |
| 916 | VehiclePropertyGroup::SYSTEM, VehicleArea::SEAT, VehiclePropertyType::INT32); |
| 917 | } |
| 918 | |
shrikar | 1f0ce0d | 2022-11-11 17:46:06 +0000 | [diff] [blame] | 919 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySeatCushionSideSupportMoveConfig) { |
| 920 | verifyProperty(VehicleProperty::SEAT_CUSHION_SIDE_SUPPORT_MOVE, |
| 921 | VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE, |
| 922 | VehiclePropertyGroup::SYSTEM, VehicleArea::SEAT, VehiclePropertyType::INT32); |
| 923 | } |
| 924 | |
shrikar | eff71b2 | 2022-11-11 11:02:43 -0800 | [diff] [blame] | 925 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySeatLumbarVerticalPosConfig) { |
| 926 | verifyProperty(VehicleProperty::SEAT_LUMBAR_VERTICAL_POS, VehiclePropertyAccess::READ_WRITE, |
| 927 | VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, |
| 928 | VehicleArea::SEAT, VehiclePropertyType::INT32); |
| 929 | } |
| 930 | |
shrikar | 2a081c5 | 2022-11-11 16:49:58 -0800 | [diff] [blame] | 931 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySeatLumbarVerticalMoveConfig) { |
| 932 | verifyProperty(VehicleProperty::SEAT_LUMBAR_VERTICAL_MOVE, VehiclePropertyAccess::READ_WRITE, |
| 933 | VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, |
| 934 | VehicleArea::SEAT, VehiclePropertyType::INT32); |
| 935 | } |
| 936 | |
Aaqib Ismail | 5d53aa3 | 2022-12-13 22:30:23 +0000 | [diff] [blame] | 937 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyAutomaticEmergencyBrakingEnabledConfig) { |
| 938 | verifyProperty(VehicleProperty::AUTOMATIC_EMERGENCY_BRAKING_ENABLED, |
| 939 | VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE, |
| 940 | VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN); |
| 941 | } |
| 942 | |
Aaqib Ismail | 28ee23c | 2023-01-04 23:04:46 -0800 | [diff] [blame] | 943 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyAutomaticEmergencyBrakingStateConfig) { |
| 944 | verifyProperty(VehicleProperty::AUTOMATIC_EMERGENCY_BRAKING_STATE, VehiclePropertyAccess::READ, |
| 945 | VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, |
| 946 | VehicleArea::GLOBAL, VehiclePropertyType::INT32); |
| 947 | } |
| 948 | |
Aaqib Ismail | a251367 | 2022-12-15 00:55:27 +0000 | [diff] [blame] | 949 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyForwardCollisionWarningEnabledConfig) { |
| 950 | verifyProperty(VehicleProperty::FORWARD_COLLISION_WARNING_ENABLED, |
| 951 | VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE, |
| 952 | VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN); |
| 953 | } |
| 954 | |
Aaqib Ismail | 0a1ab29 | 2023-01-19 21:33:56 +0000 | [diff] [blame] | 955 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyForwardCollisionWarningStateConfig) { |
| 956 | verifyProperty(VehicleProperty::FORWARD_COLLISION_WARNING_STATE, VehiclePropertyAccess::READ, |
| 957 | VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, |
| 958 | VehicleArea::GLOBAL, VehiclePropertyType::INT32); |
| 959 | } |
| 960 | |
Aaqib Ismail | 3f7177a | 2022-12-17 09:20:00 -0800 | [diff] [blame] | 961 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyBlindSpotWarningEnabledConfig) { |
| 962 | verifyProperty(VehicleProperty::BLIND_SPOT_WARNING_ENABLED, VehiclePropertyAccess::READ_WRITE, |
| 963 | VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, |
| 964 | VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN); |
| 965 | } |
| 966 | |
Aaqib Ismail | 5fc97bb | 2023-01-10 17:07:47 -0800 | [diff] [blame] | 967 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyBlindSpotWarningStateConfig) { |
| 968 | verifyProperty(VehicleProperty::BLIND_SPOT_WARNING_STATE, VehiclePropertyAccess::READ, |
| 969 | VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, |
| 970 | VehicleArea::MIRROR, VehiclePropertyType::INT32); |
| 971 | } |
| 972 | |
Aaqib Ismail | 7a46cef | 2022-12-17 10:00:59 -0800 | [diff] [blame] | 973 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyLaneDepartureWarningEnabledConfig) { |
| 974 | verifyProperty(VehicleProperty::LANE_DEPARTURE_WARNING_ENABLED, |
| 975 | VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE, |
| 976 | VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN); |
| 977 | } |
| 978 | |
Aaqib Ismail | 8462db5 | 2023-01-27 19:59:49 -0800 | [diff] [blame] | 979 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyLaneDepartureWarningStateConfig) { |
| 980 | verifyProperty(VehicleProperty::LANE_DEPARTURE_WARNING_STATE, VehiclePropertyAccess::READ, |
| 981 | VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, |
| 982 | VehicleArea::GLOBAL, VehiclePropertyType::INT32); |
| 983 | } |
| 984 | |
Aaqib Ismail | 20cc66a | 2022-12-22 05:38:28 -0800 | [diff] [blame] | 985 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyLaneKeepAssistEnabledConfig) { |
| 986 | verifyProperty(VehicleProperty::LANE_KEEP_ASSIST_ENABLED, VehiclePropertyAccess::READ_WRITE, |
| 987 | VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, |
| 988 | VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN); |
| 989 | } |
| 990 | |
Aaqib Ismail | 78db2ca | 2023-01-10 17:34:28 -0800 | [diff] [blame] | 991 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyLaneKeepAssistStateConfig) { |
| 992 | verifyProperty(VehicleProperty::LANE_KEEP_ASSIST_STATE, VehiclePropertyAccess::READ, |
| 993 | VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, |
| 994 | VehicleArea::GLOBAL, VehiclePropertyType::INT32); |
| 995 | } |
| 996 | |
Aaqib Ismail | b1680a7 | 2022-12-14 23:28:49 +0000 | [diff] [blame] | 997 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyLaneCenteringAssistEnabledConfig) { |
| 998 | verifyProperty(VehicleProperty::LANE_CENTERING_ASSIST_ENABLED, |
| 999 | VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE, |
| 1000 | VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN); |
| 1001 | } |
| 1002 | |
Aaqib Ismail | 0ffd39c | 2023-01-11 12:19:10 -0800 | [diff] [blame] | 1003 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyLaneCenteringAssistCommandConfig) { |
| 1004 | verifyProperty(VehicleProperty::LANE_CENTERING_ASSIST_COMMAND, VehiclePropertyAccess::WRITE, |
| 1005 | VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, |
| 1006 | VehicleArea::GLOBAL, VehiclePropertyType::INT32); |
| 1007 | } |
| 1008 | |
Aaqib Ismail | db03444 | 2023-01-10 18:14:28 -0800 | [diff] [blame] | 1009 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyLaneCenteringAssistStateConfig) { |
| 1010 | verifyProperty(VehicleProperty::LANE_CENTERING_ASSIST_STATE, VehiclePropertyAccess::READ, |
| 1011 | VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, |
| 1012 | VehicleArea::GLOBAL, VehiclePropertyType::INT32); |
| 1013 | } |
| 1014 | |
Yuncheol Heo | 8fbbfd1 | 2023-09-27 15:43:59 -0700 | [diff] [blame] | 1015 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyClusterHeartbeatConfig) { |
| 1016 | verifyProperty(VehicleProperty::CLUSTER_HEARTBEAT, VehiclePropertyAccess::WRITE, |
| 1017 | VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, |
| 1018 | VehicleArea::GLOBAL, VehiclePropertyType::MIXED); |
| 1019 | } |
| 1020 | |
shrikar | d6f9f8e | 2023-11-02 22:35:28 +0000 | [diff] [blame] | 1021 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyVehicleDrivingAutomationCurrentLevelConfig) { |
| 1022 | verifyProperty(VehicleProperty::VEHICLE_DRIVING_AUTOMATION_CURRENT_LEVEL, |
| 1023 | VehiclePropertyAccess::READ, VehiclePropertyChangeMode::ON_CHANGE, |
| 1024 | VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::INT32); |
| 1025 | } |
| 1026 | |
shrikar | 420b31d | 2023-11-07 16:15:35 +0000 | [diff] [blame] | 1027 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySeatAirbagsDeployedConfig) { |
| 1028 | verifyProperty(VehicleProperty::SEAT_AIRBAGS_DEPLOYED, VehiclePropertyAccess::READ, |
| 1029 | VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, |
| 1030 | VehicleArea::SEAT, VehiclePropertyType::INT32); |
| 1031 | } |
| 1032 | |
shrikar | 7717aa8 | 2023-11-07 21:05:46 +0000 | [diff] [blame] | 1033 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySeatBeltPretensionerDeployedConfig) { |
| 1034 | verifyProperty(VehicleProperty::SEAT_BELT_PRETENSIONER_DEPLOYED, VehiclePropertyAccess::READ, |
| 1035 | VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, |
| 1036 | VehicleArea::SEAT, VehiclePropertyType::BOOLEAN); |
| 1037 | } |
| 1038 | |
shrikar | d816e04 | 2023-11-08 20:12:55 +0000 | [diff] [blame] | 1039 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyImpactDetectedConfig) { |
| 1040 | verifyProperty(VehicleProperty::IMPACT_DETECTED, VehiclePropertyAccess::READ, |
| 1041 | VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, |
| 1042 | VehicleArea::GLOBAL, VehiclePropertyType::INT32); |
| 1043 | } |
| 1044 | |
shrikar | a492e7d | 2023-11-09 00:27:54 +0000 | [diff] [blame] | 1045 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyEvBatteryAverageTemperatureConfig) { |
| 1046 | verifyProperty(VehicleProperty::EV_BATTERY_AVERAGE_TEMPERATURE, VehiclePropertyAccess::READ, |
| 1047 | VehiclePropertyChangeMode::CONTINUOUS, VehiclePropertyGroup::SYSTEM, |
| 1048 | VehicleArea::GLOBAL, VehiclePropertyType::FLOAT); |
| 1049 | } |
| 1050 | |
shrikar | 45df34b | 2023-11-10 21:14:17 +0000 | [diff] [blame] | 1051 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyLowSpeedCollisionWarningEnabledConfig) { |
| 1052 | verifyProperty(VehicleProperty::LOW_SPEED_COLLISION_WARNING_ENABLED, |
| 1053 | VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE, |
| 1054 | VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN); |
| 1055 | } |
| 1056 | |
shrikar | 858c4e1 | 2023-11-14 17:33:11 +0000 | [diff] [blame] | 1057 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyLowSpeedCollisionWarningStateConfig) { |
| 1058 | verifyProperty(VehicleProperty::LOW_SPEED_COLLISION_WARNING_STATE, VehiclePropertyAccess::READ, |
| 1059 | VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, |
| 1060 | VehicleArea::GLOBAL, VehiclePropertyType::INT32); |
| 1061 | } |
| 1062 | |
shrikar | 84866f7 | 2023-11-27 00:30:59 +0000 | [diff] [blame] | 1063 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyValetModeEnabledConfig) { |
| 1064 | verifyProperty(VehicleProperty::VALET_MODE_ENABLED, VehiclePropertyAccess::READ_WRITE, |
| 1065 | VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, |
| 1066 | VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN); |
| 1067 | } |
| 1068 | |
shrikar | 33a3369 | 2023-11-30 01:38:01 +0000 | [diff] [blame] | 1069 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyElectronicStabilityControlEnabledConfig) { |
| 1070 | verifyProperty(VehicleProperty::ELECTRONIC_STABILITY_CONTROL_ENABLED, |
| 1071 | VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE, |
| 1072 | VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN); |
| 1073 | } |
| 1074 | |
shrikar | a45d1cf | 2023-11-27 17:40:46 +0000 | [diff] [blame] | 1075 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyElectronicStabilityControlStateConfig) { |
| 1076 | verifyProperty(VehicleProperty::ELECTRONIC_STABILITY_CONTROL_STATE, VehiclePropertyAccess::READ, |
| 1077 | VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, |
| 1078 | VehicleArea::GLOBAL, VehiclePropertyType::INT32); |
| 1079 | } |
| 1080 | |
shrikar | 7fde8f5 | 2023-11-27 22:47:53 +0000 | [diff] [blame] | 1081 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyCrossTrafficMonitoringEnabledConfig) { |
| 1082 | verifyProperty(VehicleProperty::CROSS_TRAFFIC_MONITORING_ENABLED, |
| 1083 | VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE, |
| 1084 | VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN); |
| 1085 | } |
| 1086 | |
shrikar | 813ba7c | 2023-11-28 18:35:34 +0000 | [diff] [blame] | 1087 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyCrossTrafficMonitoringWarningStateConfig) { |
| 1088 | verifyProperty(VehicleProperty::CROSS_TRAFFIC_MONITORING_WARNING_STATE, |
| 1089 | VehiclePropertyAccess::READ, VehiclePropertyChangeMode::ON_CHANGE, |
| 1090 | VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::INT32); |
| 1091 | } |
| 1092 | |
shrikar | 5555989 | 2023-12-01 23:35:06 +0000 | [diff] [blame] | 1093 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyHeadUpDisplayEnabledConfig) { |
| 1094 | verifyProperty(VehicleProperty::HEAD_UP_DISPLAY_ENABLED, VehiclePropertyAccess::READ_WRITE, |
| 1095 | VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, |
| 1096 | VehicleArea::SEAT, VehiclePropertyType::BOOLEAN); |
| 1097 | } |
| 1098 | |
shrikar | d11b9f8 | 2023-12-04 17:39:28 +0000 | [diff] [blame] | 1099 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyLowSpeedAutomaticEmergencyBrakingEnabledConfig) { |
| 1100 | verifyProperty(VehicleProperty::LOW_SPEED_AUTOMATIC_EMERGENCY_BRAKING_ENABLED, |
| 1101 | VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE, |
| 1102 | VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN); |
| 1103 | } |
| 1104 | |
shrikar | bd6ab73 | 2023-12-04 19:07:26 +0000 | [diff] [blame] | 1105 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyLowSpeedAutomaticEmergencyBrakingStateConfig) { |
| 1106 | verifyProperty(VehicleProperty::LOW_SPEED_AUTOMATIC_EMERGENCY_BRAKING_STATE, |
| 1107 | VehiclePropertyAccess::READ, VehiclePropertyChangeMode::ON_CHANGE, |
| 1108 | VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::INT32); |
| 1109 | } |
| 1110 | |
Yu Shan | 0ebd876 | 2023-10-11 11:31:04 -0700 | [diff] [blame] | 1111 | bool VtsHalAutomotiveVehicleTargetTest::checkIsSupported(int32_t propertyId) { |
Yu Shan | ec5d5b0 | 2023-10-09 14:43:36 -0700 | [diff] [blame] | 1112 | auto result = mVhalClient->getPropConfigs({propertyId}); |
Yu Shan | 0ebd876 | 2023-10-11 11:31:04 -0700 | [diff] [blame] | 1113 | return result.ok(); |
Yu Shan | ec5d5b0 | 2023-10-09 14:43:36 -0700 | [diff] [blame] | 1114 | } |
| 1115 | |
Yu Shan | 726d51a | 2022-02-22 17:37:21 -0800 | [diff] [blame] | 1116 | std::vector<ServiceDescriptor> getDescriptors() { |
| 1117 | std::vector<ServiceDescriptor> descriptors; |
| 1118 | for (std::string name : getAidlHalInstanceNames(IVehicle::descriptor)) { |
| 1119 | descriptors.push_back({ |
| 1120 | .name = name, |
| 1121 | .isAidlService = true, |
| 1122 | }); |
| 1123 | } |
| 1124 | for (std::string name : getAllHalInstanceNames(IVehicle::descriptor)) { |
| 1125 | descriptors.push_back({ |
| 1126 | .name = name, |
| 1127 | .isAidlService = false, |
| 1128 | }); |
| 1129 | } |
| 1130 | return descriptors; |
| 1131 | } |
| 1132 | |
| 1133 | GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(VtsHalAutomotiveVehicleTargetTest); |
| 1134 | |
| 1135 | INSTANTIATE_TEST_SUITE_P(PerInstance, VtsHalAutomotiveVehicleTargetTest, |
| 1136 | testing::ValuesIn(getDescriptors()), |
| 1137 | [](const testing::TestParamInfo<ServiceDescriptor>& info) { |
| 1138 | std::string name = ""; |
| 1139 | if (info.param.isAidlService) { |
| 1140 | name += "aidl_"; |
| 1141 | } else { |
| 1142 | name += "hidl_"; |
| 1143 | } |
| 1144 | name += info.param.name; |
| 1145 | return Sanitize(name); |
| 1146 | }); |
| 1147 | |
| 1148 | int main(int argc, char** argv) { |
| 1149 | ::testing::InitGoogleTest(&argc, argv); |
| 1150 | ABinderProcess_setThreadPoolMaxThreadCount(1); |
| 1151 | return RUN_ALL_TESTS(); |
| 1152 | } |