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