summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteven Moreland <smoreland@google.com>2017-04-06 09:26:07 -0700
committerSteven Moreland <smoreland@google.com>2017-04-06 13:11:07 -0700
commitc601c5f21808844e614015eabc03e9c71f5aae42 (patch)
treea686fa185843bbb923957fffe2e83298551b0bd1
parent5ee6250a015a7cefd8a8f6ebbbf4f79a42efc0eb (diff)
downloadlibhidl-c601c5f21808844e614015eabc03e9c71f5aae42.tar.gz
libhidl: remove libvintf dependency
Now hwservicemanager deals with libvintf and provides an IPC call for the same information. This dependency on libvintf must be moved in order to remove it from vndk-stable. Test: extensive, see Ia5d1eb41b057ab5d6800f6c3fd22658adecc4be7 Bug: 36377072 Change-Id: I05d40e2bf2a467c75e51a133b4799c0fd7fa74cb
-rw-r--r--base/Android.bp2
-rw-r--r--base/HidlSupport.cpp48
-rw-r--r--base/include/hidl/HidlSupport.h8
-rw-r--r--transport/ServiceManagement.cpp6
-rw-r--r--transport/manager/1.0/IServiceManager.hal16
5 files changed, 22 insertions, 58 deletions
diff --git a/base/Android.bp b/base/Android.bp
index 321f499..25b2a80 100644
--- a/base/Android.bp
+++ b/base/Android.bp
@@ -21,12 +21,10 @@ cc_library_shared {
"libhidl-gen-utils",
"liblog",
"libutils",
- "libvintf",
],
export_shared_lib_headers: [
"libbase",
"libutils",
- "libvintf",
],
local_include_dirs: ["include"],
export_include_dirs: ["include"],
diff --git a/base/HidlSupport.cpp b/base/HidlSupport.cpp
index 91c9717..45dd8d1 100644
--- a/base/HidlSupport.cpp
+++ b/base/HidlSupport.cpp
@@ -21,58 +21,10 @@
#include <android-base/logging.h>
#include <android-base/parseint.h>
-#include <hidl-util/FQName.h>
-#include <vintf/VintfObject.h>
-#include <vintf/parse_string.h>
namespace android {
namespace hardware {
-vintf::Transport getTransportFromManifest(
- const FQName &fqName, const std::string &instanceName,
- const vintf::HalManifest *vm) {
- if (vm == nullptr) {
- return vintf::Transport::EMPTY;
- }
- return vm->getTransport(fqName.package(),
- vintf::Version{fqName.getPackageMajorVersion(), fqName.getPackageMinorVersion()},
- fqName.name(), instanceName);
-}
-
-vintf::Transport getTransport(const std::string &interfaceName, const std::string &instanceName) {
- FQName fqName(interfaceName);
- if (!fqName.isValid()) {
- LOG(ERROR) << "getTransport: " << interfaceName << " is not a valid fully-qualified name.";
- return vintf::Transport::EMPTY;
- }
- if (!fqName.hasVersion()) {
- LOG(ERROR) << "getTransport: " << fqName.string()
- << " does not specify a version. Using default transport.";
- return vintf::Transport::EMPTY;
- }
- if (fqName.name().empty()) {
- LOG(ERROR) << "getTransport: " << fqName.string()
- << " does not specify an interface name. Using default transport.";
- return vintf::Transport::EMPTY;
- }
-
- vintf::Transport tr = getTransportFromManifest(fqName, instanceName,
- vintf::VintfObject::GetFrameworkHalManifest());
- if (tr != vintf::Transport::EMPTY) {
- return tr;
- }
- tr = getTransportFromManifest(fqName, instanceName,
- vintf::VintfObject::GetDeviceHalManifest());
- if (tr != vintf::Transport::EMPTY) {
- return tr;
- }
-
- LOG(WARNING) << "getTransportFromManifest: Cannot find entry "
- << fqName.string()
- << " in either framework or device manifest, using default transport.";
- return vintf::Transport::EMPTY;
-}
-
namespace details {
bool debuggable() {
#ifdef LIBHIDL_TARGET_DEBUGGABLE
diff --git a/base/include/hidl/HidlSupport.h b/base/include/hidl/HidlSupport.h
index a8eae8c..da9a1af 100644
--- a/base/include/hidl/HidlSupport.h
+++ b/base/include/hidl/HidlSupport.h
@@ -31,7 +31,6 @@
#include <utils/Errors.h>
#include <utils/RefBase.h>
#include <utils/StrongPointer.h>
-#include <vintf/Transport.h>
#include <vector>
namespace android {
@@ -56,13 +55,6 @@ namespace V1_0 {
namespace hardware {
-// Get transport method from vendor interface manifest.
-// interfaceName has the format "android.hardware.foo@1.0::IFoo"
-// instanceName is "default", "ashmem", etc.
-// If it starts with "android.hidl.", a static map is looked up instead.
-vintf::Transport getTransport(const std::string &interfaceName,
- const std::string &instanceName);
-
namespace details {
// Return true on userdebug / eng builds and false on user builds.
bool debuggable();
diff --git a/transport/ServiceManagement.cpp b/transport/ServiceManagement.cpp
index 5ba3ec3..30013d3 100644
--- a/transport/ServiceManagement.cpp
+++ b/transport/ServiceManagement.cpp
@@ -218,6 +218,12 @@ struct PassthroughServiceManager : IServiceManager {
return false;
}
+ Return<Transport> getTransport(const hidl_string& /* fqName */,
+ const hidl_string& /* name */) {
+ LOG(FATAL) << "Cannot getTransport with passthrough service manager.";
+ return Transport::EMPTY;
+ }
+
Return<void> list(list_cb /* _hidl_cb */) override {
LOG(FATAL) << "Cannot list services with passthrough service manager.";
return Void();
diff --git a/transport/manager/1.0/IServiceManager.hal b/transport/manager/1.0/IServiceManager.hal
index 9e1c2fc..1a37c54 100644
--- a/transport/manager/1.0/IServiceManager.hal
+++ b/transport/manager/1.0/IServiceManager.hal
@@ -73,6 +73,22 @@ interface IServiceManager {
*/
add(string name, interface service) generates (bool success);
+ enum Transport : uint8_t {
+ EMPTY,
+ HWBINDER,
+ PASSTHROUGH,
+ };
+
+ /**
+ * Get the transport of a service.
+ *
+ * @param fqName Fully-qualified interface name.
+ * @param name Instance name. Same as in IServiceManager::add
+ *
+ * @return transport Transport of service if known.
+ */
+ getTransport(string fqName, string name) generates (Transport transport);
+
/**
* List all registered services. Must be sorted.
*