Add tags for hidl interfaces.
IFoo -> i_tag
BsFoo -> bs_tag
BnFoo -> bnhw_tag
BpFoo -> bphw_tag
Also added enable_if. This will allow us to give better error
messages and add static_asserts in certain places.
Note, the tags are in HidlSupport instead of split between
HidlSupport/HidlPassthroughSupport/HidlBinderSupport because
of this loop in that case:
HidlBinderSupport.h --> HwBnBase.h --> HidlBinderSupport.h
Bug: 62807182
Test: compiles (these are all static checks)
Change-Id: I49a5ec824959484d237c8fa3c81eaa530be8e073
diff --git a/transport/include/hidl/HidlBinderSupport.h b/transport/include/hidl/HidlBinderSupport.h
index 47ff581..fc834b9 100644
--- a/transport/include/hidl/HidlBinderSupport.h
+++ b/transport/include/hidl/HidlBinderSupport.h
@@ -306,7 +306,8 @@
// Otherwise, the smallest possible BnChild is found where IChild is a subclass of IType
// and iface is of class IChild. BnChild will be used to wrapped the given iface.
// Return nullptr if iface is null or any failure.
-template <typename IType>
+template <typename IType,
+ typename = std::enable_if_t<std::is_same<details::i_tag, typename IType::_hidl_tag>::value>>
sp<IBinder> toBinder(sp<IType> iface) {
IType *ifacePtr = iface.get();
if (ifacePtr == nullptr) {