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