From d9d6046d4524c9fadc7bde662e3cad8f8cc1627f Mon Sep 17 00:00:00 2001 From: Yifan Hong Date: Tue, 10 Nov 2020 14:53:55 -0800 Subject: 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 --- iface_fuzzer/Android.bp | 3 ++- iface_fuzzer/ProtoFuzzerRunner.cpp | 20 ++++++++------------ iface_fuzzer/ProtoFuzzerStaticParams.cpp | 13 ++++--------- 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 + #include -#include "utils/InterfaceSpecUtil.h" -#include "vintf/HalManifest.h" -#include "vintf/Version.h" -#include "vintf/VintfObject.h" +#include -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 #include #include -#include +#include #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 = -- cgit v1.2.3