Merge "Push prebuilt libvtswidevine to device for drm HAL tests" into rvc-dev
diff --git a/TEST_MAPPING b/TEST_MAPPING
index 543acf6..acae4f3 100644
--- a/TEST_MAPPING
+++ b/TEST_MAPPING
@@ -8,6 +8,9 @@
},
{
"name": "hal_implementation_test"
+ },
+ {
+ "name": "VtsHalTvInputV1_0TargetTest"
}
]
}
diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleHal.cpp b/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleHal.cpp
index 84354c1..bdc5244 100644
--- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleHal.cpp
+++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleHal.cpp
@@ -16,8 +16,12 @@
#define LOG_TAG "DefaultVehicleHal_v2_0"
#include <android-base/macros.h>
+#include <android-base/properties.h>
#include <android/log.h>
+#include <dirent.h>
#include <sys/system_properties.h>
+#include <fstream>
+#include <regex>
#include "EmulatedVehicleHal.h"
#include "JsonFakeValueGenerator.h"
@@ -101,6 +105,30 @@
mVehicleClient->registerPropertyValueCallback(std::bind(&EmulatedVehicleHal::onPropertyValue,
this, std::placeholders::_1,
std::placeholders::_2));
+
+ mInitVhalValueOverride =
+ android::base::GetBoolProperty("persist.vendor.vhal_init_value_override", false);
+ if (mInitVhalValueOverride) {
+ getAllPropertiesOverride();
+ }
+}
+
+void EmulatedVehicleHal::getAllPropertiesOverride() {
+ if (auto dir = opendir("/vendor/etc/vhaloverride/")) {
+ std::regex reg_json(".*[.]json", std::regex::icase);
+ while (auto f = readdir(dir)) {
+ if (!regex_match(f->d_name, reg_json)) {
+ continue;
+ }
+ std::string file = "/vendor/etc/vhaloverride/" + std::string(f->d_name);
+ JsonFakeValueGenerator tmpGenerator(file);
+
+ std::vector<VehiclePropValue> propvalues = tmpGenerator.getAllEvents();
+ mVehiclePropertiesOverride.insert(std::end(mVehiclePropertiesOverride),
+ std::begin(propvalues), std::end(propvalues));
+ }
+ closedir(dir);
+ }
}
VehicleHal::VehiclePropValuePtr EmulatedVehicleHal::get(
@@ -277,6 +305,13 @@
}
} else {
prop.value = it.initialValue;
+ if (mInitVhalValueOverride) {
+ for (auto& itOverride : mVehiclePropertiesOverride) {
+ if (itOverride.prop == cfg.prop) {
+ prop.value = itOverride.value;
+ }
+ }
+ }
}
mPropStore->writeValue(prop, shouldUpdateStatus);
}
diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleHal.h b/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleHal.h
index dc05145..cba4b8a 100644
--- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleHal.h
+++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleHal.h
@@ -62,6 +62,7 @@
// Methods from EmulatedVehicleHalIface
bool setPropertyFromVehicle(const VehiclePropValue& propValue) override;
std::vector<VehiclePropValue> getAllProperties() const override;
+ void getAllPropertiesOverride();
private:
constexpr std::chrono::nanoseconds hertzToNanoseconds(float hz) const {
@@ -87,6 +88,8 @@
RecurrentTimer mRecurrentTimer;
VehicleHalClient* mVehicleClient;
bool mInEmulator;
+ bool mInitVhalValueOverride;
+ std::vector<VehiclePropValue> mVehiclePropertiesOverride;
};
} // impl
diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/JsonFakeValueGenerator.cpp b/automotive/vehicle/2.0/default/impl/vhal_v2_0/JsonFakeValueGenerator.cpp
index 8677f83..890eb33 100644
--- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/JsonFakeValueGenerator.cpp
+++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/JsonFakeValueGenerator.cpp
@@ -48,6 +48,22 @@
mNumOfIterations = v.int32Values.size() < 2 ? -1 : v.int32Values[1];
}
+JsonFakeValueGenerator::JsonFakeValueGenerator(std::string path) {
+ std::ifstream ifs(path);
+ if (!ifs) {
+ ALOGE("%s: couldn't open %s for parsing.", __func__, path.c_str());
+ }
+ mGenCfg = {
+ .index = 0,
+ .events = parseFakeValueJson(ifs),
+ };
+ mNumOfIterations = mGenCfg.events.size();
+}
+
+std::vector<VehiclePropValue> JsonFakeValueGenerator::getAllEvents() {
+ return mGenCfg.events;
+}
+
VehiclePropValue JsonFakeValueGenerator::nextEvent() {
VehiclePropValue generatedValue;
if (!hasNext()) {
@@ -109,6 +125,7 @@
Json::Value rawEventValue = rawEvent["value"];
auto& value = event.value;
+ int32_t count;
switch (getPropType(event.prop)) {
case VehiclePropertyType::BOOLEAN:
case VehiclePropertyType::INT32:
@@ -126,6 +143,13 @@
case VehiclePropertyType::STRING:
value.stringValue = rawEventValue.asString();
break;
+ case VehiclePropertyType::INT32_VEC:
+ value.int32Values.resize(rawEventValue.size());
+ count = 0;
+ for (auto& it : rawEventValue) {
+ value.int32Values[count++] = it.asInt();
+ }
+ break;
case VehiclePropertyType::MIXED:
copyMixedValueJson(value, rawEventValue);
if (isDiagnosticProperty(event.prop)) {
diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/JsonFakeValueGenerator.h b/automotive/vehicle/2.0/default/impl/vhal_v2_0/JsonFakeValueGenerator.h
index 70575f7..dc8ff66 100644
--- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/JsonFakeValueGenerator.h
+++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/JsonFakeValueGenerator.h
@@ -41,9 +41,12 @@
public:
JsonFakeValueGenerator(const VehiclePropValue& request);
+ JsonFakeValueGenerator(std::string path);
+
~JsonFakeValueGenerator() = default;
VehiclePropValue nextEvent();
+ std::vector<VehiclePropValue> getAllEvents();
bool hasNext();
diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/proto/Android.bp b/automotive/vehicle/2.0/default/impl/vhal_v2_0/proto/Android.bp
index 2eedecd..9784f75 100644
--- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/proto/Android.bp
+++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/proto/Android.bp
@@ -27,7 +27,17 @@
"-Wall",
"-Werror",
],
- srcs: ["VehicleHalProto.proto"]
+ srcs: ["VehicleHalProto.proto"],
+}
+
+filegroup {
+ name: "vhal-proto-src",
+ visibility: [
+ "//device/google/trout/hal/vehicle/2.0:__subpackages__",
+ ],
+ srcs: [
+ "VehicleHalProto.proto",
+ ],
}
cc_library_static {
@@ -49,7 +59,7 @@
"libgrpc++_unsecure",
],
cflags: [
- "-Wno-unused-parameter"
+ "-Wno-unused-parameter",
],
}
diff --git a/drm/1.3/vts/functional/AndroidTest.xml b/drm/1.3/vts/functional/AndroidTest.xml
new file mode 100644
index 0000000..338430f
--- /dev/null
+++ b/drm/1.3/vts/functional/AndroidTest.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2020 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<configuration description="Runs VtsHalDrmV1_3TargetTest.">
+ <option name="test-suite-tag" value="apct" />
+ <option name="test-suite-tag" value="apct-native" />
+
+ <target_preparer class="com.android.tradefed.targetprep.RootTargetPreparer"/>
+
+ <target_preparer class="com.android.tradefed.targetprep.PushFilePreparer">
+ <option name="cleanup" value="true" />
+ <option name="push-file" key="VtsHalDrmV1_3TargetTest" value="/data/local/tmp/VtsHalDrmV1_3TargetTest" />
+ <option name="push-file" key="libvtswidevine64.so" value="/data/local/tmp/64/lib/libvtswidevine.so" />
+ <option name="push-file" key="libvtswidevine32.so" value="/data/local/tmp/32/lib/libvtswidevine.so" />
+ </target_preparer>
+
+ <test class="com.android.tradefed.testtype.GTest" >
+ <option name="native-test-device-path" value="/data/local/tmp" />
+ <option name="module-name" value="VtsHalDrmV1_3TargetTest" />
+ </test>
+</configuration>
diff --git a/neuralnetworks/1.3/vts/functional/Android.bp b/neuralnetworks/1.3/vts/functional/Android.bp
index 545a5be..2c1be0b 100644
--- a/neuralnetworks/1.3/vts/functional/Android.bp
+++ b/neuralnetworks/1.3/vts/functional/Android.bp
@@ -77,5 +77,8 @@
header_libs: [
"libneuralnetworks_headers",
],
- test_suites: ["general-tests"],
+ test_suites: [
+ "general-tests",
+ "vts",
+ ],
}