Merge "Add support for coverage flushing."
diff --git a/base/include/hidl/HidlInternal.h b/base/include/hidl/HidlInternal.h
index 6c0d8df..d81dd9c 100644
--- a/base/include/hidl/HidlInternal.h
+++ b/base/include/hidl/HidlInternal.h
@@ -28,6 +28,18 @@
namespace hardware {
namespace details {
+// tag for pure interfaces (e.x. IFoo)
+struct i_tag {};
+
+// tag for server interfaces (e.x. BnHwFoo)
+struct bnhw_tag {};
+
+// tag for proxy interfaces (e.x. BpHwFoo)
+struct bphw_tag {};
+
+// tag for passthrough interfaces (e.x. BsFoo)
+struct bs_tag {};
+
//Templated classes can use the below method
//to avoid creating dependencies on liblog.
void logAlwaysFatal(const char *message);
diff --git a/transport/allocator/1.0/Android.bp b/transport/allocator/1.0/Android.bp
index b836d26..0cff7f3 100644
--- a/transport/allocator/1.0/Android.bp
+++ b/transport/allocator/1.0/Android.bp
@@ -35,7 +35,7 @@
],
}
-cc_library_shared {
+cc_library {
name: "android.hidl.allocator@1.0",
defaults: ["hidl-module-defaults"],
generated_sources: ["android.hidl.allocator@1.0_genc++"],
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) {
diff --git a/transport/include/hidl/HidlTransportSupport.h b/transport/include/hidl/HidlTransportSupport.h
index d116598..18a4036 100644
--- a/transport/include/hidl/HidlTransportSupport.h
+++ b/transport/include/hidl/HidlTransportSupport.h
@@ -62,7 +62,10 @@
bool setMinSchedulerPolicy(const sp<::android::hidl::base::V1_0::IBase>& service,
int policy, int priority);
-template <typename ILeft, typename IRight>
+template <typename ILeft,
+ typename IRight,
+ typename = std::enable_if_t<std::is_same<details::i_tag, typename ILeft::_hidl_tag>::value>,
+ typename = std::enable_if_t<std::is_same<details::i_tag, typename IRight::_hidl_tag>::value>>
bool interfacesEqual(sp<ILeft> left, sp<IRight> right) {
if (left == nullptr || right == nullptr || !left->isRemote() || !right->isRemote()) {
return left == right;
diff --git a/transport/memory/1.0/Android.bp b/transport/memory/1.0/Android.bp
index ec9d0eb..0ae2422 100644
--- a/transport/memory/1.0/Android.bp
+++ b/transport/memory/1.0/Android.bp
@@ -42,7 +42,7 @@
],
}
-cc_library_shared {
+cc_library {
name: "android.hidl.memory@1.0",
defaults: ["hidl-module-defaults"],
generated_sources: ["android.hidl.memory@1.0_genc++"],
diff --git a/transport/token/1.0/Android.bp b/transport/token/1.0/Android.bp
index d5825c2..5e5f29d 100644
--- a/transport/token/1.0/Android.bp
+++ b/transport/token/1.0/Android.bp
@@ -35,7 +35,7 @@
],
}
-cc_library_shared {
+cc_library {
name: "android.hidl.token@1.0",
defaults: ["hidl-module-defaults"],
generated_sources: ["android.hidl.token@1.0_genc++"],