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