summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYifan Hong <elsk@google.com>2020-11-10 14:53:55 -0800
committerYifan Hong <elsk@google.com>2020-11-16 10:16:34 -0800
commitd9d6046d4524c9fadc7bde662e3cad8f8cc1627f (patch)
treeea2265037d3761a63e5a4f82638b2510301cf5d3
parent08c509674a6e56ec906c55ee2f3e6c84aa52bf0c (diff)
downloadfuzz-d9d6046d4524c9fadc7bde662e3cad8f8cc1627f.tar.gz
VTS proto fuzz: decouple with libvintf.
libvintf is not available to product. Service manager is. Hence, call into service manager to get the list of instance names. Test: mmma system/tools/hidl/test/build_variants/2.0/ Test: m vts_proto_fuzzer Test: m android.hardware.atrace@1.0-vts.fuzzer && adb sync data && adb shell /data/fuzz/x86/android.hardware.atrace@1.0-vts.fuzzer/android.hardware.atrace@1.0-vts.fuzzer \ -max_len=20000 Change-Id: I0158c66b0fcd3894089c66d887d7a54d09dae52a
-rw-r--r--iface_fuzzer/Android.bp3
-rw-r--r--iface_fuzzer/ProtoFuzzerRunner.cpp20
-rw-r--r--iface_fuzzer/ProtoFuzzerStaticParams.cpp13
3 files changed, 14 insertions, 22 deletions
diff --git a/iface_fuzzer/Android.bp b/iface_fuzzer/Android.bp
index a93d564..d8eab99 100644
--- a/iface_fuzzer/Android.bp
+++ b/iface_fuzzer/Android.bp
@@ -37,8 +37,9 @@ cc_defaults {
],
shared_libs: [
"libbase",
+ "libhidlbase",
"libprotobuf-cpp-full",
- "libvintf",
+ "libutils",
"libvts_common",
"libvts_multidevice_proto",
"libvts_proto_fuzzer_proto",
diff --git a/iface_fuzzer/ProtoFuzzerRunner.cpp b/iface_fuzzer/ProtoFuzzerRunner.cpp
index ed822a2..ff373b1 100644
--- a/iface_fuzzer/ProtoFuzzerRunner.cpp
+++ b/iface_fuzzer/ProtoFuzzerRunner.cpp
@@ -17,16 +17,14 @@
#include "ProtoFuzzerRunner.h"
#include <dlfcn.h>
+
#include <sstream>
-#include "utils/InterfaceSpecUtil.h"
-#include "vintf/HalManifest.h"
-#include "vintf/Version.h"
-#include "vintf/VintfObject.h"
+#include <hidl/ServiceManagement.h>
-using android::vintf::HalManifest;
-using android::vintf::Version;
+#include "utils/InterfaceSpecUtil.h"
+using android::hardware::getAllHalInstanceNames;
using std::cerr;
using std::cout;
using std::string;
@@ -55,12 +53,10 @@ static string GetServiceName(const CompSpec &comp_spec) {
string hal_name = comp_spec.package();
string iface_name = comp_spec.component_name();
- auto instance_names =
- ::android::vintf::VintfObject::GetDeviceHalManifest()->getHidlInstances(
- hal_name,
- Version(comp_spec.component_type_version_major(),
- comp_spec.component_type_version_minor()),
- iface_name);
+ auto descriptor =
+ hal_name + "@" + GetVersionString(comp_spec) + "::" + iface_name;
+ auto instance_names = getAllHalInstanceNames(descriptor);
+
if (instance_names.empty()) {
cerr << "HAL service name not available in VINTF." << endl;
std::abort();
diff --git a/iface_fuzzer/ProtoFuzzerStaticParams.cpp b/iface_fuzzer/ProtoFuzzerStaticParams.cpp
index 27a1e9e..2f0133a 100644
--- a/iface_fuzzer/ProtoFuzzerStaticParams.cpp
+++ b/iface_fuzzer/ProtoFuzzerStaticParams.cpp
@@ -19,7 +19,7 @@
#include <android-base/file.h>
#include <android-base/macros.h>
#include <android-base/strings.h>
-#include <vintf/VintfObject.h>
+#include <hidl/ServiceManagement.h>
#define STRINGIFY(x) STRINGIFY_INTERNAL(x)
#define STRINGIFY_INTERNAL(x) #x
@@ -28,8 +28,7 @@ using android::FQName;
using android::base::GetExecutableDirectory;
using android::base::Join;
using android::base::Split;
-using android::vintf::Version;
-using android::vintf::VintfObject;
+using android::hardware::getAllHalInstanceNames;
using std::cerr;
using std::cout;
using std::string;
@@ -51,12 +50,8 @@ static FQName FindAnyIfaceFQName(const FQName &package_and_version,
major_version == spec.component_type_version_major() &&
minor_version == spec.component_type_version_minor()) {
auto iface_name = spec.component_name();
- auto instance_names =
- VintfObject::GetDeviceHalManifest()->getHidlInstances(
- package,
- Version(spec.component_type_version_major(),
- spec.component_type_version_minor()),
- iface_name);
+ auto descriptor = package_and_version.string() + "::" + iface_name;
+ auto instance_names = getAllHalInstanceNames(descriptor);
if (!instance_names.empty()) {
auto version =