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