IHidlInterfaceBase is the base class for all interfaces.
IHidlInterfaceBase::descriptor is the descriptor for
HIDL reserved methods.
Test: hidl_test
Bug: 32337854
Change-Id: Ibdeb6f64e779315b9fcdb807b0fbec885471e333
diff --git a/include/hidl/HidlSupport.h b/include/hidl/HidlSupport.h
index b284f57..1324af5 100644
--- a/include/hidl/HidlSupport.h
+++ b/include/hidl/HidlSupport.h
@@ -21,6 +21,7 @@
#include <dirent.h>
#include <dlfcn.h>
#include <cutils/properties.h>
+#include <hidl/Status.h>
#include <hwbinder/Parcel.h>
#include <tuple>
#include <utils/Errors.h>
@@ -75,6 +76,14 @@
status_t writeEmbeddedToParcel(
Parcel *parcel, size_t parentHandle, size_t parentOffset) const;
+ inline bool operator==(const char *s) const {
+ return strcmp(mBuffer, s) == 0;
+ }
+
+ inline bool operator!=(const char *s) const {
+ return !(operator==(s));
+ }
+
// offsetof(hidl_string, mBuffer) exposed since mBuffer is private.
static const size_t kOffsetOfBuffer;
@@ -561,6 +570,15 @@
return hidl_version(major,minor);
}
+struct IHidlInterfaceBase : virtual public RefBase {
+ virtual bool isRemote() const = 0;
+ // HIDL reserved methods follow.
+ virtual ::android::hardware::Return<void> interfaceChain(
+ std::function<void(const hidl_vec<hidl_string>&)> _hidl_cb) = 0;
+ // descriptor for HIDL reserved methods.
+ static const ::android::String16 descriptor;
+};
+
#if defined(__LP64__)
#define HAL_LIBRARY_PATH_SYSTEM "/system/lib64/hw/"
#define HAL_LIBRARY_PATH_VENDOR "/vendor/lib64/hw/"