Handle prop not supported correctly.

getPropConfigs() will return error when the property is not supported
instead of returning an empty array. Also make sure GTEST_SKIP is called
directly in the test function, not the helper function since it
will only abort the current function.

Test: atest VtsHalAutomotiveVehicle_TargetTest
Bug: 301577794
Change-Id: I99e2cb8bd00430fe9668e8a911a60bbfe97bc4e0
diff --git a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp
index bc9a527..3dca0ae 100644
--- a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp
+++ b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp
@@ -116,7 +116,7 @@
 
 class VtsHalAutomotiveVehicleTargetTest : public testing::TestWithParam<ServiceDescriptor> {
   protected:
-    void checkIsSupported(int32_t propertyId);
+    bool checkIsSupported(int32_t propertyId);
 
   public:
     void verifyProperty(VehicleProperty propId, VehiclePropertyAccess access,
@@ -207,7 +207,9 @@
     ALOGD("VtsHalAutomotiveVehicleTargetTest::get");
 
     int32_t propId = toInt(VehicleProperty::PERF_VEHICLE_SPEED);
-    checkIsSupported(propId);
+    if (!checkIsSupported(propId)) {
+        GTEST_SKIP() << "Property: " << propId << " is not supported, skip the test";
+    }
     auto result = mVhalClient->getValueSync(*mVhalClient->createHalPropValue(propId));
 
     ASSERT_TRUE(result.ok()) << StringPrintf("Failed to get value for property: %" PRId32
@@ -293,7 +295,9 @@
     ALOGD("VtsHalAutomotiveVehicleTargetTest::setNotWritableProp");
 
     int32_t propId = toInt(VehicleProperty::PERF_VEHICLE_SPEED);
-    checkIsSupported(propId);
+    if (!checkIsSupported(propId)) {
+        GTEST_SKIP() << "Property: " << propId << " is not supported, skip the test";
+    }
 
     auto getValueResult = mVhalClient->getValueSync(*mVhalClient->createHalPropValue(propId));
     ASSERT_TRUE(getValueResult.ok())
@@ -335,7 +339,9 @@
     ALOGD("VtsHalAutomotiveVehicleTargetTest::subscribeAndUnsubscribe");
 
     int32_t propId = toInt(VehicleProperty::PERF_VEHICLE_SPEED);
-    checkIsSupported(propId);
+    if (!checkIsSupported(propId)) {
+        GTEST_SKIP() << "Property: " << propId << " is not supported, skip the test";
+    }
 
     auto propConfigsResult = mVhalClient->getPropConfigs({propId});
 
@@ -425,7 +431,9 @@
     }
 
     int32_t propId = toInt(VehicleProperty::PARKING_BRAKE_ON);
-    checkIsSupported(propId);
+    if (!checkIsSupported(propId)) {
+        GTEST_SKIP() << "Property: " << propId << " is not supported, skip the test";
+    }
     auto prop = mVhalClient->createHalPropValue(propId);
 
     auto result = mVhalClient->getValueSync(*prop);
@@ -883,13 +891,9 @@
                    VehicleArea::GLOBAL, VehiclePropertyType::MIXED);
 }
 
-void VtsHalAutomotiveVehicleTargetTest::checkIsSupported(int32_t propertyId) {
+bool VtsHalAutomotiveVehicleTargetTest::checkIsSupported(int32_t propertyId) {
     auto result = mVhalClient->getPropConfigs({propertyId});
-    ASSERT_TRUE(result.ok()) << "Failed to get required property config, error: "
-                             << result.error().message();
-    if (result.value().size() == 0) {
-        GTEST_SKIP() << "Property: " << propertyId << " is not supported, skip the test";
-    }
+    return result.ok();
 }
 
 std::vector<ServiceDescriptor> getDescriptors() {