blob: 90fc7270d3d27b5767ec016a41fb666d0c9d8587 [file] [log] [blame]
Yu Shan726d51a2022-02-22 17:37:21 -08001/*
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 Shan4569ef52022-03-18 14:34:25 -070033#include <utils/SystemClock.h>
Yu Shan726d51a2022-02-22 17:37:21 -080034
35#include <chrono>
36#include <mutex>
37#include <unordered_map>
38#include <unordered_set>
39#include <vector>
40
41using ::aidl::android::hardware::automotive::vehicle::IVehicle;
42using ::aidl::android::hardware::automotive::vehicle::StatusCode;
43using ::aidl::android::hardware::automotive::vehicle::SubscribeOptions;
44using ::aidl::android::hardware::automotive::vehicle::VehicleArea;
45using ::aidl::android::hardware::automotive::vehicle::VehicleProperty;
46using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyAccess;
Aaqib Ismail20486702022-10-27 16:58:50 -070047using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyChangeMode;
48using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyGroup;
Yu Shan726d51a2022-02-22 17:37:21 -080049using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyType;
50using ::android::getAidlHalInstanceNames;
51using ::android::base::ScopedLockAssertion;
52using ::android::base::StringPrintf;
Chen Chengfaf9adc2022-06-22 23:09:09 +000053using ::android::frameworks::automotive::vhal::ErrorCode;
Yu Shan726d51a2022-02-22 17:37:21 -080054using ::android::frameworks::automotive::vhal::HalPropError;
55using ::android::frameworks::automotive::vhal::IHalPropConfig;
56using ::android::frameworks::automotive::vhal::IHalPropValue;
57using ::android::frameworks::automotive::vhal::ISubscriptionCallback;
58using ::android::frameworks::automotive::vhal::IVhalClient;
59using ::android::hardware::getAllHalInstanceNames;
60using ::android::hardware::Sanitize;
61using ::android::hardware::automotive::vehicle::toInt;
62
63constexpr int32_t kInvalidProp = 0x31600207;
64
65struct ServiceDescriptor {
66 std::string name;
67 bool isAidlService;
68};
69
70class VtsVehicleCallback final : public ISubscriptionCallback {
71 private:
72 std::mutex mLock;
73 std::unordered_map<int32_t, size_t> mEventsCount GUARDED_BY(mLock);
Yu Shan4569ef52022-03-18 14:34:25 -070074 std::unordered_map<int32_t, std::vector<int64_t>> mEventTimestamps GUARDED_BY(mLock);
Yu Shan726d51a2022-02-22 17:37:21 -080075 std::condition_variable mEventCond;
76
77 public:
78 void onPropertyEvent(const std::vector<std::unique_ptr<IHalPropValue>>& values) override {
79 {
80 std::lock_guard<std::mutex> lockGuard(mLock);
81 for (auto& value : values) {
Yu Shan4569ef52022-03-18 14:34:25 -070082 int32_t propId = value->getPropId();
83 mEventsCount[propId] += 1;
84 mEventTimestamps[propId].push_back(value->getTimestamp());
Yu Shan726d51a2022-02-22 17:37:21 -080085 }
86 }
87 mEventCond.notify_one();
88 }
89
90 void onPropertySetError([[maybe_unused]] const std::vector<HalPropError>& errors) override {
91 // Do nothing.
92 }
93
94 template <class Rep, class Period>
95 bool waitForExpectedEvents(int32_t propId, size_t expectedEvents,
96 const std::chrono::duration<Rep, Period>& timeout) {
97 std::unique_lock<std::mutex> uniqueLock(mLock);
98 return mEventCond.wait_for(uniqueLock, timeout, [this, propId, expectedEvents] {
99 ScopedLockAssertion lockAssertion(mLock);
100 return mEventsCount[propId] >= expectedEvents;
101 });
102 }
103
Yu Shan4569ef52022-03-18 14:34:25 -0700104 std::vector<int64_t> getEventTimestamps(int32_t propId) {
105 {
106 std::lock_guard<std::mutex> lockGuard(mLock);
107 return mEventTimestamps[propId];
108 }
109 }
110
Yu Shan726d51a2022-02-22 17:37:21 -0800111 void reset() {
112 std::lock_guard<std::mutex> lockGuard(mLock);
113 mEventsCount.clear();
114 }
115};
116
117class VtsHalAutomotiveVehicleTargetTest : public testing::TestWithParam<ServiceDescriptor> {
118 public:
Aaqib Ismail20486702022-10-27 16:58:50 -0700119 void verifyProperty(VehicleProperty propId, VehiclePropertyAccess access,
120 VehiclePropertyChangeMode changeMode, VehiclePropertyGroup group,
121 VehicleArea area, VehiclePropertyType propertyType);
Yu Shan726d51a2022-02-22 17:37:21 -0800122 virtual void SetUp() override {
123 auto descriptor = GetParam();
124 if (descriptor.isAidlService) {
125 mVhalClient = IVhalClient::tryCreateAidlClient(descriptor.name.c_str());
126 } else {
127 mVhalClient = IVhalClient::tryCreateHidlClient(descriptor.name.c_str());
128 }
129
130 ASSERT_NE(mVhalClient, nullptr) << "Failed to connect to VHAL";
131
132 mCallback = std::make_shared<VtsVehicleCallback>();
133 }
134
135 static bool isBooleanGlobalProp(int32_t property) {
136 return (property & toInt(VehiclePropertyType::MASK)) ==
137 toInt(VehiclePropertyType::BOOLEAN) &&
138 (property & toInt(VehicleArea::MASK)) == toInt(VehicleArea::GLOBAL);
139 }
140
141 protected:
142 std::shared_ptr<IVhalClient> mVhalClient;
143 std::shared_ptr<VtsVehicleCallback> mCallback;
144};
145
146TEST_P(VtsHalAutomotiveVehicleTargetTest, useAidlBackend) {
147 if (!mVhalClient->isAidlVhal()) {
148 GTEST_SKIP() << "AIDL backend is not available, HIDL backend is used instead";
149 }
150}
151
152TEST_P(VtsHalAutomotiveVehicleTargetTest, useHidlBackend) {
153 if (mVhalClient->isAidlVhal()) {
154 GTEST_SKIP() << "AIDL backend is available, HIDL backend is not used";
155 }
156}
157
158// Test getAllPropConfig() returns at least 4 property configs.
159TEST_P(VtsHalAutomotiveVehicleTargetTest, getAllPropConfigs) {
160 ALOGD("VtsHalAutomotiveVehicleTargetTest::getAllPropConfigs");
161
162 auto result = mVhalClient->getAllPropConfigs();
163
164 ASSERT_TRUE(result.ok()) << "Failed to get all property configs, error: "
165 << result.error().message();
166 ASSERT_GE(result.value().size(), 4u) << StringPrintf(
167 "Expect to get at least 4 property configs, got %zu", result.value().size());
168}
169
170// Test getPropConfigs() can query all properties listed in CDD.
171TEST_P(VtsHalAutomotiveVehicleTargetTest, getRequiredPropConfigs) {
172 ALOGD("VtsHalAutomotiveVehicleTargetTest::getRequiredPropConfigs");
173
174 // Check the properties listed in CDD
175 std::vector<int32_t> properties = {
176 toInt(VehicleProperty::GEAR_SELECTION), toInt(VehicleProperty::NIGHT_MODE),
177 toInt(VehicleProperty::PARKING_BRAKE_ON), toInt(VehicleProperty::PERF_VEHICLE_SPEED)};
178
179 auto result = mVhalClient->getPropConfigs(properties);
180
181 ASSERT_TRUE(result.ok()) << "Failed to get required property config, error: "
182 << result.error().message();
183 ASSERT_EQ(result.value().size(), 4u)
184 << StringPrintf("Expect to get exactly 4 configs, got %zu", result.value().size());
185}
186
187// Test getPropConfig() with an invalid propertyId returns an error code.
188TEST_P(VtsHalAutomotiveVehicleTargetTest, getPropConfigsWithInvalidProp) {
189 ALOGD("VtsHalAutomotiveVehicleTargetTest::getPropConfigsWithInvalidProp");
190
191 auto result = mVhalClient->getPropConfigs({kInvalidProp});
192
193 ASSERT_FALSE(result.ok()) << StringPrintf(
194 "Expect failure to get prop configs for invalid prop: %" PRId32, kInvalidProp);
195 ASSERT_NE(result.error().message(), "") << "Expect error message not to be empty";
196}
197
198// Test get() return current value for properties.
199TEST_P(VtsHalAutomotiveVehicleTargetTest, get) {
200 ALOGD("VtsHalAutomotiveVehicleTargetTest::get");
201
202 int32_t propId = toInt(VehicleProperty::PERF_VEHICLE_SPEED);
203 auto result = mVhalClient->getValueSync(*mVhalClient->createHalPropValue(propId));
204
205 ASSERT_TRUE(result.ok()) << StringPrintf("Failed to get value for property: %" PRId32
206 ", error: %s",
207 propId, result.error().message().c_str());
208 ASSERT_NE(result.value(), nullptr) << "Result value must not be null";
209}
210
211// Test get() with an invalid propertyId return an error codes.
212TEST_P(VtsHalAutomotiveVehicleTargetTest, getInvalidProp) {
213 ALOGD("VtsHalAutomotiveVehicleTargetTest::getInvalidProp");
214
215 auto result = mVhalClient->getValueSync(*mVhalClient->createHalPropValue(kInvalidProp));
216
217 ASSERT_FALSE(result.ok()) << StringPrintf(
218 "Expect failure to get property for invalid prop: %" PRId32, kInvalidProp);
219}
220
221// Test set() on read_write properties.
222TEST_P(VtsHalAutomotiveVehicleTargetTest, setProp) {
223 ALOGD("VtsHalAutomotiveVehicleTargetTest::setProp");
224
225 // skip hvac related properties
226 std::unordered_set<int32_t> hvacProps = {toInt(VehicleProperty::HVAC_DEFROSTER),
227 toInt(VehicleProperty::HVAC_AC_ON),
228 toInt(VehicleProperty::HVAC_MAX_AC_ON),
229 toInt(VehicleProperty::HVAC_MAX_DEFROST_ON),
230 toInt(VehicleProperty::HVAC_RECIRC_ON),
231 toInt(VehicleProperty::HVAC_DUAL_ON),
232 toInt(VehicleProperty::HVAC_AUTO_ON),
233 toInt(VehicleProperty::HVAC_POWER_ON),
234 toInt(VehicleProperty::HVAC_AUTO_RECIRC_ON),
235 toInt(VehicleProperty::HVAC_ELECTRIC_DEFROSTER_ON)};
236 auto result = mVhalClient->getAllPropConfigs();
237 ASSERT_TRUE(result.ok());
238
239 for (const auto& cfgPtr : result.value()) {
240 const IHalPropConfig& cfg = *cfgPtr;
241 int32_t propId = cfg.getPropId();
242 // test on boolean and writable property
243 if (cfg.getAccess() == toInt(VehiclePropertyAccess::READ_WRITE) &&
244 isBooleanGlobalProp(propId) && !hvacProps.count(propId)) {
245 auto propToGet = mVhalClient->createHalPropValue(propId);
246 auto getValueResult = mVhalClient->getValueSync(*propToGet);
247
248 ASSERT_TRUE(getValueResult.ok())
249 << StringPrintf("Failed to get value for property: %" PRId32 ", error: %s",
250 propId, getValueResult.error().message().c_str());
251 ASSERT_NE(getValueResult.value(), nullptr)
252 << StringPrintf("Result value must not be null for property: %" PRId32, propId);
253
254 const IHalPropValue& value = *getValueResult.value();
255 size_t intValueSize = value.getInt32Values().size();
256 ASSERT_EQ(intValueSize, 1u) << StringPrintf(
257 "Expect exactly 1 int value for boolean property: %" PRId32 ", got %zu", propId,
258 intValueSize);
259
260 int setValue = value.getInt32Values()[0] == 1 ? 0 : 1;
261 auto propToSet = mVhalClient->createHalPropValue(propId);
262 propToSet->setInt32Values({setValue});
263 auto setValueResult = mVhalClient->setValueSync(*propToSet);
264
265 ASSERT_TRUE(setValueResult.ok())
266 << StringPrintf("Failed to set value for property: %" PRId32 ", error: %s",
267 propId, setValueResult.error().message().c_str());
268
269 // check set success
270 getValueResult = mVhalClient->getValueSync(*propToGet);
271 ASSERT_TRUE(getValueResult.ok())
272 << StringPrintf("Failed to get value for property: %" PRId32 ", error: %s",
273 propId, getValueResult.error().message().c_str());
274 ASSERT_NE(getValueResult.value(), nullptr)
275 << StringPrintf("Result value must not be null for property: %" PRId32, propId);
276 ASSERT_EQ(getValueResult.value()->getInt32Values(), std::vector<int32_t>({setValue}))
277 << StringPrintf("Boolean value not updated after set for property: %" PRId32,
278 propId);
279 }
280 }
281}
282
283// Test set() on an read_only property.
284TEST_P(VtsHalAutomotiveVehicleTargetTest, setNotWritableProp) {
285 ALOGD("VtsHalAutomotiveVehicleTargetTest::setNotWritableProp");
286
287 int32_t propId = toInt(VehicleProperty::PERF_VEHICLE_SPEED);
288 auto getValueResult = mVhalClient->getValueSync(*mVhalClient->createHalPropValue(propId));
289 ASSERT_TRUE(getValueResult.ok())
290 << StringPrintf("Failed to get value for property: %" PRId32 ", error: %s", propId,
291 getValueResult.error().message().c_str());
292
293 auto setValueResult = mVhalClient->setValueSync(*getValueResult.value());
294
295 ASSERT_FALSE(setValueResult.ok()) << "Expect set a read-only value to fail";
Chen Chengfaf9adc2022-06-22 23:09:09 +0000296 ASSERT_EQ(setValueResult.error().code(), ErrorCode::ACCESS_DENIED_FROM_VHAL);
Yu Shan726d51a2022-02-22 17:37:21 -0800297}
298
shrikar8a140232023-03-07 16:57:59 +0000299// Test get(), set() and getAllPropConfigs() on VehicleProperty::INVALID.
300TEST_P(VtsHalAutomotiveVehicleTargetTest, getSetPropertyIdInvalid) {
301 ALOGD("VtsHalAutomotiveVehicleTargetTest::getSetPropertyIdInvalid");
302
303 int32_t propId = toInt(VehicleProperty::INVALID);
304 auto getValueResult = mVhalClient->getValueSync(*mVhalClient->createHalPropValue(propId));
305 ASSERT_FALSE(getValueResult.ok()) << "Expect get on VehicleProperty::INVALID to fail";
306 ASSERT_EQ(getValueResult.error().code(), ErrorCode::INVALID_ARG);
307
308 auto propToSet = mVhalClient->createHalPropValue(propId);
309 propToSet->setInt32Values({0});
310 auto setValueResult = mVhalClient->setValueSync(*propToSet);
311 ASSERT_FALSE(setValueResult.ok()) << "Expect set on VehicleProperty::INVALID to fail";
312 ASSERT_EQ(setValueResult.error().code(), ErrorCode::INVALID_ARG);
313
314 auto result = mVhalClient->getAllPropConfigs();
315 ASSERT_TRUE(result.ok());
316 for (const auto& cfgPtr : result.value()) {
317 const IHalPropConfig& cfg = *cfgPtr;
318 ASSERT_FALSE(cfg.getPropId() == propId) << "Expect VehicleProperty::INVALID to not be "
319 "included in propConfigs";
320 }
321}
322
Yu Shan726d51a2022-02-22 17:37:21 -0800323// Test subscribe() and unsubscribe().
324TEST_P(VtsHalAutomotiveVehicleTargetTest, subscribeAndUnsubscribe) {
325 ALOGD("VtsHalAutomotiveVehicleTargetTest::subscribeAndUnsubscribe");
326
327 int32_t propId = toInt(VehicleProperty::PERF_VEHICLE_SPEED);
328
Yu Shan4569ef52022-03-18 14:34:25 -0700329 auto propConfigsResult = mVhalClient->getPropConfigs({propId});
330
331 ASSERT_TRUE(propConfigsResult.ok()) << "Failed to get property config for PERF_VEHICLE_SPEED: "
332 << "error: " << propConfigsResult.error().message();
333 ASSERT_EQ(propConfigsResult.value().size(), 1u)
334 << "Expect to return 1 config for PERF_VEHICLE_SPEED";
335 auto& propConfig = propConfigsResult.value()[0];
336 float minSampleRate = propConfig->getMinSampleRate();
337 float maxSampleRate = propConfig->getMaxSampleRate();
338
339 if (minSampleRate < 1) {
340 GTEST_SKIP() << "Sample rate for vehicle speed < 1 times/sec, skip test since it would "
341 "take too long";
342 }
Yu Shan726d51a2022-02-22 17:37:21 -0800343
344 auto client = mVhalClient->getSubscriptionClient(mCallback);
345 ASSERT_NE(client, nullptr) << "Failed to get subscription client";
346
Yu Shan4569ef52022-03-18 14:34:25 -0700347 auto result = client->subscribe({{.propId = propId, .sampleRate = minSampleRate}});
Yu Shan726d51a2022-02-22 17:37:21 -0800348
349 ASSERT_TRUE(result.ok()) << StringPrintf("Failed to subscribe to property: %" PRId32
350 ", error: %s",
351 propId, result.error().message().c_str());
Yu Shan4569ef52022-03-18 14:34:25 -0700352
353 if (mVhalClient->isAidlVhal()) {
354 // Skip checking timestamp for HIDL because the behavior for sample rate and timestamp is
355 // only specified clearly for AIDL.
356
357 // Timeout is 2 seconds, which gives a 1 second buffer.
358 ASSERT_TRUE(mCallback->waitForExpectedEvents(propId, std::floor(minSampleRate),
359 std::chrono::seconds(2)))
360 << "Didn't get enough events for subscribing to minSampleRate";
361 }
362
363 result = client->subscribe({{.propId = propId, .sampleRate = maxSampleRate}});
364
365 ASSERT_TRUE(result.ok()) << StringPrintf("Failed to subscribe to property: %" PRId32
366 ", error: %s",
367 propId, result.error().message().c_str());
368
369 if (mVhalClient->isAidlVhal()) {
370 ASSERT_TRUE(mCallback->waitForExpectedEvents(propId, std::floor(maxSampleRate),
371 std::chrono::seconds(2)))
372 << "Didn't get enough events for subscribing to maxSampleRate";
373
374 std::unordered_set<int64_t> timestamps;
375 // Event event should have a different timestamp.
376 for (const int64_t& eventTimestamp : mCallback->getEventTimestamps(propId)) {
377 ASSERT_TRUE(timestamps.find(eventTimestamp) == timestamps.end())
378 << "two events for the same property must not have the same timestamp";
379 timestamps.insert(eventTimestamp);
380 }
381 }
Yu Shan726d51a2022-02-22 17:37:21 -0800382
383 result = client->unsubscribe({propId});
384 ASSERT_TRUE(result.ok()) << StringPrintf("Failed to unsubscribe to property: %" PRId32
385 ", error: %s",
386 propId, result.error().message().c_str());
387
388 mCallback->reset();
389 ASSERT_FALSE(mCallback->waitForExpectedEvents(propId, 10, std::chrono::seconds(1)))
390 << "Expect not to get events after unsubscription";
391}
392
393// Test subscribe() with an invalid property.
394TEST_P(VtsHalAutomotiveVehicleTargetTest, subscribeInvalidProp) {
395 ALOGD("VtsHalAutomotiveVehicleTargetTest::subscribeInvalidProp");
396
397 std::vector<SubscribeOptions> options = {
398 SubscribeOptions{.propId = kInvalidProp, .sampleRate = 10.0}};
399
400 auto client = mVhalClient->getSubscriptionClient(mCallback);
401 ASSERT_NE(client, nullptr) << "Failed to get subscription client";
402
403 auto result = client->subscribe(options);
404
405 ASSERT_FALSE(result.ok()) << StringPrintf("Expect subscribing to property: %" PRId32 " to fail",
406 kInvalidProp);
407}
408
Yu Shan4569ef52022-03-18 14:34:25 -0700409// Test the timestamp returned in GetValues results is the timestamp when the value is retrieved.
410TEST_P(VtsHalAutomotiveVehicleTargetTest, testGetValuesTimestampAIDL) {
411 if (!mVhalClient->isAidlVhal()) {
412 GTEST_SKIP() << "Skip checking timestamp for HIDL because the behavior is only specified "
413 "for AIDL";
414 }
415
416 int32_t propId = toInt(VehicleProperty::PARKING_BRAKE_ON);
417 auto prop = mVhalClient->createHalPropValue(propId);
418
419 auto result = mVhalClient->getValueSync(*prop);
420
421 ASSERT_TRUE(result.ok()) << StringPrintf("Failed to get value for property: %" PRId32
422 ", error: %s",
423 propId, result.error().message().c_str());
424 ASSERT_NE(result.value(), nullptr) << "Result value must not be null";
425 ASSERT_EQ(result.value()->getInt32Values().size(), 1u) << "Result must contain 1 int value";
426
427 bool parkBrakeOnValue1 = (result.value()->getInt32Values()[0] == 1);
428 int64_t timestampValue1 = result.value()->getTimestamp();
429
430 result = mVhalClient->getValueSync(*prop);
431
432 ASSERT_TRUE(result.ok()) << StringPrintf("Failed to get value for property: %" PRId32
433 ", error: %s",
434 propId, result.error().message().c_str());
435 ASSERT_NE(result.value(), nullptr) << "Result value must not be null";
436 ASSERT_EQ(result.value()->getInt32Values().size(), 1u) << "Result must contain 1 int value";
437
438 bool parkBarkeOnValue2 = (result.value()->getInt32Values()[0] == 1);
439 int64_t timestampValue2 = result.value()->getTimestamp();
440
441 if (parkBarkeOnValue2 == parkBrakeOnValue1) {
442 ASSERT_EQ(timestampValue2, timestampValue1)
443 << "getValue result must contain a timestamp updated when the value was updated, if"
444 "the value does not change, expect the same timestamp";
445 } else {
446 ASSERT_GT(timestampValue2, timestampValue1)
447 << "getValue result must contain a timestamp updated when the value was updated, if"
448 "the value changes, expect the newer value has a larger timestamp";
449 }
450}
451
Aaqib Ismail20486702022-10-27 16:58:50 -0700452// Helper function to compare actual vs expected property config
453void VtsHalAutomotiveVehicleTargetTest::verifyProperty(VehicleProperty propId,
454 VehiclePropertyAccess access,
455 VehiclePropertyChangeMode changeMode,
456 VehiclePropertyGroup group, VehicleArea area,
457 VehiclePropertyType propertyType) {
458 int expectedPropId = toInt(propId);
459 int expectedAccess = toInt(access);
460 int expectedChangeMode = toInt(changeMode);
461 int expectedGroup = toInt(group);
462 int expectedArea = toInt(area);
463 int expectedPropertyType = toInt(propertyType);
464
Eva Chen17bc5782023-01-06 22:59:58 -0800465 auto result = mVhalClient->getAllPropConfigs();
466 ASSERT_TRUE(result.ok()) << "Failed to get all property configs, error: "
467 << result.error().message();
468
469 // Check if property is implemented by getting all configs and looking to see if the expected
470 // property id is in that list.
471 bool isExpectedPropIdImplemented = false;
472 for (const auto& cfgPtr : result.value()) {
473 const IHalPropConfig& cfg = *cfgPtr;
474 if (expectedPropId == cfg.getPropId()) {
475 isExpectedPropIdImplemented = true;
476 break;
477 }
478 }
479
480 if (!isExpectedPropIdImplemented) {
481 GTEST_SKIP() << StringPrintf("Property %" PRId32 " has not been implemented",
482 expectedPropId);
483 }
484
485 result = mVhalClient->getPropConfigs({expectedPropId});
Aaqib Ismail20486702022-10-27 16:58:50 -0700486 ASSERT_TRUE(result.ok()) << "Failed to get required property config, error: "
487 << result.error().message();
488
Aaqib Ismail20486702022-10-27 16:58:50 -0700489 ASSERT_EQ(result.value().size(), 1u)
490 << StringPrintf("Expect to get exactly 1 config, got %zu", result.value().size());
491
492 const auto& config = result.value().at(0);
493 int actualPropId = config->getPropId();
494 int actualAccess = config->getAccess();
495 int actualChangeMode = config->getChangeMode();
496 int actualGroup = actualPropId & toInt(VehiclePropertyGroup::MASK);
497 int actualArea = actualPropId & toInt(VehicleArea::MASK);
498 int actualPropertyType = actualPropId & toInt(VehiclePropertyType::MASK);
499
500 ASSERT_EQ(actualPropId, expectedPropId)
501 << StringPrintf("Expect to get property ID: %i, got %i", expectedPropId, actualPropId);
502
503 if (expectedAccess == toInt(VehiclePropertyAccess::READ_WRITE)) {
504 ASSERT_TRUE(actualAccess == expectedAccess ||
505 actualAccess == toInt(VehiclePropertyAccess::READ))
506 << StringPrintf("Expect to get VehiclePropertyAccess: %i or %i, got %i",
507 expectedAccess, toInt(VehiclePropertyAccess::READ), actualAccess);
508 } else {
509 ASSERT_EQ(actualAccess, expectedAccess) << StringPrintf(
510 "Expect to get VehiclePropertyAccess: %i, got %i", expectedAccess, actualAccess);
511 }
512
513 ASSERT_EQ(actualChangeMode, expectedChangeMode)
514 << StringPrintf("Expect to get VehiclePropertyChangeMode: %i, got %i",
515 expectedChangeMode, actualChangeMode);
516 ASSERT_EQ(actualGroup, expectedGroup) << StringPrintf(
517 "Expect to get VehiclePropertyGroup: %i, got %i", expectedGroup, actualGroup);
518 ASSERT_EQ(actualArea, expectedArea)
519 << StringPrintf("Expect to get VehicleArea: %i, got %i", expectedArea, actualArea);
520 ASSERT_EQ(actualPropertyType, expectedPropertyType)
521 << StringPrintf("Expect to get VehiclePropertyType: %i, got %i", expectedPropertyType,
522 actualPropertyType);
523}
524
shrikar34563642023-02-14 02:57:17 +0000525TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyLocationCharacterizationConfig) {
526 verifyProperty(VehicleProperty::LOCATION_CHARACTERIZATION, VehiclePropertyAccess::READ,
527 VehiclePropertyChangeMode::STATIC, VehiclePropertyGroup::SYSTEM,
528 VehicleArea::GLOBAL, VehiclePropertyType::INT32);
529}
530
shrikar668df362022-12-20 22:08:17 +0000531TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyEmergencyLaneKeepAssistEnabledConfig) {
532 verifyProperty(VehicleProperty::EMERGENCY_LANE_KEEP_ASSIST_ENABLED,
533 VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE,
534 VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN);
535}
536
shrikar80cc0c52023-01-30 16:56:53 +0000537TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyEmergencyLaneKeepAssistStateConfig) {
538 verifyProperty(VehicleProperty::EMERGENCY_LANE_KEEP_ASSIST_STATE, VehiclePropertyAccess::READ,
539 VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM,
540 VehicleArea::GLOBAL, VehiclePropertyType::INT32);
541}
542
shrikar5d1b8162023-01-25 19:31:23 +0000543TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyCruiseControlEnabledConfig) {
544 verifyProperty(VehicleProperty::CRUISE_CONTROL_ENABLED, VehiclePropertyAccess::READ_WRITE,
545 VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM,
546 VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN);
shrikar808a2942022-12-21 17:07:32 +0000547}
548
shrikard440ed42023-01-31 00:25:14 +0000549TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyCruiseControlTypeConfig) {
550 verifyProperty(VehicleProperty::CRUISE_CONTROL_TYPE, VehiclePropertyAccess::READ_WRITE,
551 VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM,
552 VehicleArea::GLOBAL, VehiclePropertyType::INT32);
553}
554
shrikar2753b9e2023-01-31 00:25:14 +0000555TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyCruiseControlStateConfig) {
556 verifyProperty(VehicleProperty::CRUISE_CONTROL_STATE, VehiclePropertyAccess::READ,
557 VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM,
558 VehicleArea::GLOBAL, VehiclePropertyType::INT32);
559}
560
shrikar5df0f952023-02-02 00:15:39 +0000561TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyCruiseControlCommandConfig) {
562 verifyProperty(VehicleProperty::CRUISE_CONTROL_COMMAND, VehiclePropertyAccess::WRITE,
563 VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM,
564 VehicleArea::GLOBAL, VehiclePropertyType::INT32);
565}
566
shrikarfde8c242023-02-02 01:10:33 +0000567TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyCruiseControlTargetSpeedConfig) {
568 verifyProperty(VehicleProperty::CRUISE_CONTROL_TARGET_SPEED, VehiclePropertyAccess::READ,
569 VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM,
570 VehicleArea::GLOBAL, VehiclePropertyType::FLOAT);
571}
572
shrikarb9661d32023-02-02 19:22:50 +0000573TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyAdaptiveCruiseControlTargetTimeGapConfig) {
574 verifyProperty(VehicleProperty::ADAPTIVE_CRUISE_CONTROL_TARGET_TIME_GAP,
575 VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE,
576 VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::INT32);
577}
578
shrikarf62d7472023-02-03 00:20:04 +0000579TEST_P(VtsHalAutomotiveVehicleTargetTest,
580 verifyAdaptiveCruiseControlLeadVehicleMeasuredDistanceConfig) {
581 verifyProperty(VehicleProperty::ADAPTIVE_CRUISE_CONTROL_LEAD_VEHICLE_MEASURED_DISTANCE,
582 VehiclePropertyAccess::READ, VehiclePropertyChangeMode::CONTINUOUS,
583 VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::INT32);
584}
585
shrikar37833e12022-12-15 20:13:14 +0000586TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyHandsOnDetectionEnabledConfig) {
587 verifyProperty(VehicleProperty::HANDS_ON_DETECTION_ENABLED, VehiclePropertyAccess::READ_WRITE,
588 VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM,
589 VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN);
590}
591
shrikar6d88bf52023-01-17 17:04:21 +0000592TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyHandsOnDetectionDriverStateConfig) {
593 verifyProperty(VehicleProperty::HANDS_ON_DETECTION_DRIVER_STATE, VehiclePropertyAccess::READ,
594 VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM,
595 VehicleArea::GLOBAL, VehiclePropertyType::INT32);
596}
597
shrikara6785992023-01-18 23:07:06 +0000598TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyHandsOnDetectionWarningConfig) {
599 verifyProperty(VehicleProperty::HANDS_ON_DETECTION_WARNING, VehiclePropertyAccess::READ,
600 VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM,
601 VehicleArea::GLOBAL, VehiclePropertyType::INT32);
602}
603
shrikar2c7aaa62022-12-15 21:05:34 +0000604TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyDriverAttentionMonitoringEnabledConfig) {
605 verifyProperty(VehicleProperty::DRIVER_ATTENTION_MONITORING_ENABLED,
606 VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE,
607 VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN);
608}
609
shrikar22164c62023-02-06 16:49:59 +0000610TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyDriverAttentionMonitoringStateConfig) {
611 verifyProperty(VehicleProperty::DRIVER_ATTENTION_MONITORING_STATE, VehiclePropertyAccess::READ,
612 VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM,
613 VehicleArea::GLOBAL, VehiclePropertyType::INT32);
614}
615
shrikar39859e92023-01-18 23:07:06 +0000616TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyDriverAttentionMonitoringWarningConfig) {
617 verifyProperty(VehicleProperty::DRIVER_ATTENTION_MONITORING_WARNING,
618 VehiclePropertyAccess::READ, VehiclePropertyChangeMode::ON_CHANGE,
619 VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::INT32);
620}
621
Aaqib Ismailc69e9682022-11-22 12:50:00 -0800622TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyEvBrakeRegenerationLevelConfig) {
623 verifyProperty(VehicleProperty::EV_BRAKE_REGENERATION_LEVEL,
624 VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE,
625 VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::INT32);
626}
627
shrikar2dae80f2022-12-21 23:50:17 +0000628TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyEvStoppingModeConfig) {
629 verifyProperty(VehicleProperty::EV_STOPPING_MODE, VehiclePropertyAccess::READ_WRITE,
630 VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM,
631 VehicleArea::GLOBAL, VehiclePropertyType::INT32);
632}
633
Aaqib Ismailaec678a2022-12-07 16:22:42 -0800634TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyEvCurrentBatteryCapacityConfig) {
635 verifyProperty(VehicleProperty::EV_CURRENT_BATTERY_CAPACITY, VehiclePropertyAccess::READ,
636 VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM,
637 VehicleArea::GLOBAL, VehiclePropertyType::FLOAT);
638}
639
shrikar83914472022-12-16 20:28:47 +0000640TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyEngineIdleAutoStopEnabledConfig) {
641 verifyProperty(VehicleProperty::ENGINE_IDLE_AUTO_STOP_ENABLED,
642 VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE,
643 VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN);
644}
645
Aaqib Ismail20486702022-10-27 16:58:50 -0700646TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyDoorChildLockEnabledConfig) {
647 verifyProperty(VehicleProperty::DOOR_CHILD_LOCK_ENABLED, VehiclePropertyAccess::READ_WRITE,
648 VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM,
649 VehicleArea::DOOR, VehiclePropertyType::BOOLEAN);
650}
651
Aaqib Ismail63d52d12023-01-30 12:35:10 -0800652TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyWindshieldWipersPeriodConfig) {
653 verifyProperty(VehicleProperty::WINDSHIELD_WIPERS_PERIOD, VehiclePropertyAccess::READ,
654 VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM,
655 VehicleArea::WINDOW, VehiclePropertyType::INT32);
656}
657
Aaqib Ismail732a1d72023-01-31 10:25:45 -0800658TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyWindshieldWipersStateConfig) {
659 verifyProperty(VehicleProperty::WINDSHIELD_WIPERS_STATE, VehiclePropertyAccess::READ,
660 VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM,
661 VehicleArea::WINDOW, VehiclePropertyType::INT32);
662}
663
Aaqib Ismailc37a2112023-02-02 11:30:08 -0800664TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyWindshieldWipersSwitchConfig) {
665 verifyProperty(VehicleProperty::WINDSHIELD_WIPERS_SWITCH, VehiclePropertyAccess::READ_WRITE,
666 VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM,
667 VehicleArea::WINDOW, VehiclePropertyType::INT32);
668}
669
Aaqib Ismail7f941b42022-11-04 14:55:13 -0700670TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySteeringWheelDepthPosConfig) {
671 verifyProperty(VehicleProperty::STEERING_WHEEL_DEPTH_POS, VehiclePropertyAccess::READ_WRITE,
672 VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM,
673 VehicleArea::GLOBAL, VehiclePropertyType::INT32);
674}
675
Aaqib Ismail34fe92f2022-11-04 21:41:23 -0700676TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySteeringWheelDepthMoveConfig) {
677 verifyProperty(VehicleProperty::STEERING_WHEEL_DEPTH_MOVE, VehiclePropertyAccess::READ_WRITE,
678 VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM,
679 VehicleArea::GLOBAL, VehiclePropertyType::INT32);
680}
681
Aaqib Ismail53b81c92022-11-07 17:47:04 -0800682TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySteeringWheelHeightPosConfig) {
683 verifyProperty(VehicleProperty::STEERING_WHEEL_HEIGHT_POS, VehiclePropertyAccess::READ_WRITE,
684 VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM,
685 VehicleArea::GLOBAL, VehiclePropertyType::INT32);
686}
687
Aaqib Ismail6c4bf192022-11-08 15:00:32 -0800688TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySteeringWheelHeightMoveConfig) {
689 verifyProperty(VehicleProperty::STEERING_WHEEL_HEIGHT_MOVE, VehiclePropertyAccess::READ_WRITE,
690 VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM,
691 VehicleArea::GLOBAL, VehiclePropertyType::INT32);
692}
693
Aaqib Ismail8d051182022-11-09 13:28:48 -0800694TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySteeringWheelTheftLockEnabledConfig) {
695 verifyProperty(VehicleProperty::STEERING_WHEEL_THEFT_LOCK_ENABLED,
696 VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE,
697 VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN);
698}
699
Aaqib Ismail68d3f122022-11-09 14:43:32 -0800700TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySteeringWheelLockedConfig) {
701 verifyProperty(VehicleProperty::STEERING_WHEEL_LOCKED, VehiclePropertyAccess::READ_WRITE,
702 VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM,
703 VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN);
704}
705
Aaqib Ismaild4d6adf2022-11-09 16:59:47 -0800706TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySteeringWheelEasyAccessEnabledConfig) {
707 verifyProperty(VehicleProperty::STEERING_WHEEL_EASY_ACCESS_ENABLED,
708 VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE,
709 VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN);
710}
711
Aaqib Ismail0dc7ba02022-11-10 14:28:09 -0800712TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySteeringWheelLightsStateConfig) {
713 verifyProperty(VehicleProperty::STEERING_WHEEL_LIGHTS_STATE, VehiclePropertyAccess::READ,
714 VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM,
715 VehicleArea::GLOBAL, VehiclePropertyType::INT32);
716}
717
Aaqib Ismail4b8688f2022-11-15 15:13:35 -0800718TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySteeringWheelLightsSwitchConfig) {
719 verifyProperty(VehicleProperty::STEERING_WHEEL_LIGHTS_SWITCH, VehiclePropertyAccess::READ_WRITE,
720 VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM,
721 VehicleArea::GLOBAL, VehiclePropertyType::INT32);
722}
723
Arati Gerdesd86c7fd2022-12-19 12:32:29 -0800724TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyGloveBoxDoorPosConfig) {
725 verifyProperty(VehicleProperty::GLOVE_BOX_DOOR_POS, VehiclePropertyAccess::READ_WRITE,
726 VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM,
727 VehicleArea::SEAT, VehiclePropertyType::INT32);
728}
729
Aaqib Ismail57be4032023-02-02 14:15:03 -0800730TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyGloveBoxLockedConfig) {
731 verifyProperty(VehicleProperty::GLOVE_BOX_LOCKED, VehiclePropertyAccess::READ_WRITE,
732 VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM,
733 VehicleArea::SEAT, VehiclePropertyType::BOOLEAN);
734}
735
shrikara1367212022-11-02 16:07:35 +0000736TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyMirrorAutoFoldEnabledConfig) {
737 verifyProperty(VehicleProperty::MIRROR_AUTO_FOLD_ENABLED, VehiclePropertyAccess::READ_WRITE,
738 VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM,
739 VehicleArea::MIRROR, VehiclePropertyType::BOOLEAN);
740}
741
742TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyMirrorAutoTiltEnabledConfig) {
743 verifyProperty(VehicleProperty::MIRROR_AUTO_TILT_ENABLED, VehiclePropertyAccess::READ_WRITE,
744 VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM,
745 VehicleArea::MIRROR, VehiclePropertyType::BOOLEAN);
746}
747
Aaqib Ismail4e6144c2022-12-15 15:32:18 -0800748TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySeatHeadrestHeightPosV2Config) {
749 verifyProperty(VehicleProperty::SEAT_HEADREST_HEIGHT_POS_V2, VehiclePropertyAccess::READ_WRITE,
750 VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM,
751 VehicleArea::SEAT, VehiclePropertyType::INT32);
752}
753
shrikar6ae79162022-12-16 03:03:25 +0000754TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySeatWalkInPosConfig) {
755 verifyProperty(VehicleProperty::SEAT_WALK_IN_POS, VehiclePropertyAccess::READ_WRITE,
756 VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM,
757 VehicleArea::SEAT, VehiclePropertyType::INT32);
758}
759
shrikarfb65ae52022-11-03 23:12:51 +0000760TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySeatFootwellLightsStateConfig) {
761 verifyProperty(VehicleProperty::SEAT_FOOTWELL_LIGHTS_STATE, VehiclePropertyAccess::READ,
762 VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM,
763 VehicleArea::SEAT, VehiclePropertyType::INT32);
764}
765
shrikar93cf1be2022-11-30 15:00:52 -0800766TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySeatFootwellLightsSwitchConfig) {
767 verifyProperty(VehicleProperty::SEAT_FOOTWELL_LIGHTS_SWITCH, VehiclePropertyAccess::READ_WRITE,
768 VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM,
769 VehicleArea::SEAT, VehiclePropertyType::INT32);
770}
771
shrikar3326de02022-11-07 23:51:20 +0000772TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySeatEasyAccessEnabledConfig) {
773 verifyProperty(VehicleProperty::SEAT_EASY_ACCESS_ENABLED, VehiclePropertyAccess::READ_WRITE,
774 VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM,
775 VehicleArea::SEAT, VehiclePropertyType::BOOLEAN);
776}
777
shrikarb96e3762022-11-08 16:49:58 -0800778TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySeatAirbagEnabledConfig) {
779 verifyProperty(VehicleProperty::SEAT_AIRBAG_ENABLED, VehiclePropertyAccess::READ_WRITE,
780 VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM,
781 VehicleArea::SEAT, VehiclePropertyType::BOOLEAN);
782}
783
shrikar802ecb52022-11-09 18:27:06 +0000784TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySeatCushionSideSupportPosConfig) {
785 verifyProperty(VehicleProperty::SEAT_CUSHION_SIDE_SUPPORT_POS,
786 VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE,
787 VehiclePropertyGroup::SYSTEM, VehicleArea::SEAT, VehiclePropertyType::INT32);
788}
789
shrikar1f0ce0d2022-11-11 17:46:06 +0000790TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySeatCushionSideSupportMoveConfig) {
791 verifyProperty(VehicleProperty::SEAT_CUSHION_SIDE_SUPPORT_MOVE,
792 VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE,
793 VehiclePropertyGroup::SYSTEM, VehicleArea::SEAT, VehiclePropertyType::INT32);
794}
795
shrikareff71b22022-11-11 11:02:43 -0800796TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySeatLumbarVerticalPosConfig) {
797 verifyProperty(VehicleProperty::SEAT_LUMBAR_VERTICAL_POS, VehiclePropertyAccess::READ_WRITE,
798 VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM,
799 VehicleArea::SEAT, VehiclePropertyType::INT32);
800}
801
shrikar2a081c52022-11-11 16:49:58 -0800802TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySeatLumbarVerticalMoveConfig) {
803 verifyProperty(VehicleProperty::SEAT_LUMBAR_VERTICAL_MOVE, VehiclePropertyAccess::READ_WRITE,
804 VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM,
805 VehicleArea::SEAT, VehiclePropertyType::INT32);
806}
807
Aaqib Ismail5d53aa32022-12-13 22:30:23 +0000808TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyAutomaticEmergencyBrakingEnabledConfig) {
809 verifyProperty(VehicleProperty::AUTOMATIC_EMERGENCY_BRAKING_ENABLED,
810 VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE,
811 VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN);
812}
813
Aaqib Ismail28ee23c2023-01-04 23:04:46 -0800814TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyAutomaticEmergencyBrakingStateConfig) {
815 verifyProperty(VehicleProperty::AUTOMATIC_EMERGENCY_BRAKING_STATE, VehiclePropertyAccess::READ,
816 VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM,
817 VehicleArea::GLOBAL, VehiclePropertyType::INT32);
818}
819
Aaqib Ismaila2513672022-12-15 00:55:27 +0000820TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyForwardCollisionWarningEnabledConfig) {
821 verifyProperty(VehicleProperty::FORWARD_COLLISION_WARNING_ENABLED,
822 VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE,
823 VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN);
824}
825
Aaqib Ismail0a1ab292023-01-19 21:33:56 +0000826TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyForwardCollisionWarningStateConfig) {
827 verifyProperty(VehicleProperty::FORWARD_COLLISION_WARNING_STATE, VehiclePropertyAccess::READ,
828 VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM,
829 VehicleArea::GLOBAL, VehiclePropertyType::INT32);
830}
831
Aaqib Ismail3f7177a2022-12-17 09:20:00 -0800832TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyBlindSpotWarningEnabledConfig) {
833 verifyProperty(VehicleProperty::BLIND_SPOT_WARNING_ENABLED, VehiclePropertyAccess::READ_WRITE,
834 VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM,
835 VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN);
836}
837
Aaqib Ismail5fc97bb2023-01-10 17:07:47 -0800838TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyBlindSpotWarningStateConfig) {
839 verifyProperty(VehicleProperty::BLIND_SPOT_WARNING_STATE, VehiclePropertyAccess::READ,
840 VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM,
841 VehicleArea::MIRROR, VehiclePropertyType::INT32);
842}
843
Aaqib Ismail7a46cef2022-12-17 10:00:59 -0800844TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyLaneDepartureWarningEnabledConfig) {
845 verifyProperty(VehicleProperty::LANE_DEPARTURE_WARNING_ENABLED,
846 VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE,
847 VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN);
848}
849
Aaqib Ismail8462db52023-01-27 19:59:49 -0800850TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyLaneDepartureWarningStateConfig) {
851 verifyProperty(VehicleProperty::LANE_DEPARTURE_WARNING_STATE, VehiclePropertyAccess::READ,
852 VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM,
853 VehicleArea::GLOBAL, VehiclePropertyType::INT32);
854}
855
Aaqib Ismail20cc66a2022-12-22 05:38:28 -0800856TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyLaneKeepAssistEnabledConfig) {
857 verifyProperty(VehicleProperty::LANE_KEEP_ASSIST_ENABLED, VehiclePropertyAccess::READ_WRITE,
858 VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM,
859 VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN);
860}
861
Aaqib Ismail78db2ca2023-01-10 17:34:28 -0800862TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyLaneKeepAssistStateConfig) {
863 verifyProperty(VehicleProperty::LANE_KEEP_ASSIST_STATE, VehiclePropertyAccess::READ,
864 VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM,
865 VehicleArea::GLOBAL, VehiclePropertyType::INT32);
866}
867
Aaqib Ismailb1680a72022-12-14 23:28:49 +0000868TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyLaneCenteringAssistEnabledConfig) {
869 verifyProperty(VehicleProperty::LANE_CENTERING_ASSIST_ENABLED,
870 VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE,
871 VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN);
872}
873
Aaqib Ismail0ffd39c2023-01-11 12:19:10 -0800874TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyLaneCenteringAssistCommandConfig) {
875 verifyProperty(VehicleProperty::LANE_CENTERING_ASSIST_COMMAND, VehiclePropertyAccess::WRITE,
876 VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM,
877 VehicleArea::GLOBAL, VehiclePropertyType::INT32);
878}
879
Aaqib Ismaildb034442023-01-10 18:14:28 -0800880TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyLaneCenteringAssistStateConfig) {
881 verifyProperty(VehicleProperty::LANE_CENTERING_ASSIST_STATE, VehiclePropertyAccess::READ,
882 VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM,
883 VehicleArea::GLOBAL, VehiclePropertyType::INT32);
884}
885
Yu Shan726d51a2022-02-22 17:37:21 -0800886std::vector<ServiceDescriptor> getDescriptors() {
887 std::vector<ServiceDescriptor> descriptors;
888 for (std::string name : getAidlHalInstanceNames(IVehicle::descriptor)) {
889 descriptors.push_back({
890 .name = name,
891 .isAidlService = true,
892 });
893 }
894 for (std::string name : getAllHalInstanceNames(IVehicle::descriptor)) {
895 descriptors.push_back({
896 .name = name,
897 .isAidlService = false,
898 });
899 }
900 return descriptors;
901}
902
903GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(VtsHalAutomotiveVehicleTargetTest);
904
905INSTANTIATE_TEST_SUITE_P(PerInstance, VtsHalAutomotiveVehicleTargetTest,
906 testing::ValuesIn(getDescriptors()),
907 [](const testing::TestParamInfo<ServiceDescriptor>& info) {
908 std::string name = "";
909 if (info.param.isAidlService) {
910 name += "aidl_";
911 } else {
912 name += "hidl_";
913 }
914 name += info.param.name;
915 return Sanitize(name);
916 });
917
918int main(int argc, char** argv) {
919 ::testing::InitGoogleTest(&argc, argv);
920 ABinderProcess_setThreadPoolMaxThreadCount(1);
921 return RUN_ALL_TESTS();
922}