Merge "Remove TODO for service registration."
diff --git a/transport/HidlTransportSupport.cpp b/transport/HidlTransportSupport.cpp
index 591ccba..c9937f1 100644
--- a/transport/HidlTransportSupport.cpp
+++ b/transport/HidlTransportSupport.cpp
@@ -23,6 +23,8 @@
namespace android {
namespace hardware {
+using ::android::hidl::base::V1_0::IBase;
+
void configureRpcThreadpool(size_t maxThreads, bool callerWillJoin) {
// TODO(b/32756130) this should be transport-dependent
configureBinderRpcThreadpool(maxThreads, callerWillJoin);
@@ -40,8 +42,7 @@
return handleBinderPoll();
}
-bool setMinSchedulerPolicy(const sp<::android::hidl::base::V1_0::IBase>& service,
- int policy, int priority) {
+bool setMinSchedulerPolicy(const sp<IBase>& service, int policy, int priority) {
if (service->isRemote()) {
LOG(ERROR) << "Can't set scheduler policy on remote service.";
return false;
@@ -74,7 +75,7 @@
// release in the meta-version sense, we should remove this.
std::unique_lock<std::mutex> lock = details::gServicePrioMap.lock();
- std::vector<wp<::android::hidl::base::V1_0::IBase>> toDelete;
+ std::vector<wp<IBase>> toDelete;
for (const auto& kv : details::gServicePrioMap) {
if (kv.first.promote() == nullptr) {
toDelete.push_back(kv.first);
@@ -88,6 +89,13 @@
return true;
}
+bool interfacesEqual(const sp<IBase>& left, const sp<IBase>& right) {
+ if (left == nullptr || right == nullptr || !left->isRemote() || !right->isRemote()) {
+ return left == right;
+ }
+ return getOrCreateCachedBinder(left.get()) == getOrCreateCachedBinder(right.get());
+}
+
namespace details {
int32_t getPidIfSharable() {
#if LIBHIDL_TARGET_DEBUGGABLE
diff --git a/transport/include/hidl/HidlTransportSupport.h b/transport/include/hidl/HidlTransportSupport.h
index db1974c..69f3291 100644
--- a/transport/include/hidl/HidlTransportSupport.h
+++ b/transport/include/hidl/HidlTransportSupport.h
@@ -84,17 +84,13 @@
bool setMinSchedulerPolicy(const sp<::android::hidl::base::V1_0::IBase>& service,
int policy, int priority);
-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;
- }
-
- return getOrCreateCachedBinder(left.get()) == getOrCreateCachedBinder(right.get());
-}
+/**
+ * Returns whether two interfaces represent the same interface. References to interfaces in the same
+ * process will always be equivalent. However, in order to compare a service that is a proxy to a
+ * different process, its underlying structure may have to be checked.
+ */
+bool interfacesEqual(const sp<::android::hidl::base::V1_0::IBase>& left,
+ const sp<::android::hidl::base::V1_0::IBase>& right);
namespace details {