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