HIDL stuff on host. am: 2056cf3eee am: f43ceddff2 am: bddec1157f
am: 1dfa6f43b3
Change-Id: Ic4628c384b07ab47a8e1243c5f6f21ae6706972d
diff --git a/transport/include/hidl/HidlBinderSupport.h b/transport/include/hidl/HidlBinderSupport.h
index 5dec5cd..05f7fab 100644
--- a/transport/include/hidl/HidlBinderSupport.h
+++ b/transport/include/hidl/HidlBinderSupport.h
@@ -204,10 +204,17 @@
if (binderIface.get() == nullptr) {
return nullptr;
}
+
if (binderIface->localBinder() == nullptr) {
return new ProxyType(binderIface);
}
+
+ // Ensure that IBinder is BnHwBase (not JHwBinder, for instance)
+ if (!binderIface->checkSubclass(IBase::descriptor)) {
+ return new ProxyType(binderIface);
+ }
sp<IBase> base = static_cast<BnHwBase*>(binderIface.get())->getImpl();
+
if (details::canCastInterface(base.get(), IType::descriptor)) {
StubType* stub = static_cast<StubType*>(binderIface.get());
return stub->getImpl();
diff --git a/transport/include/hidl/HidlLazyUtils.h b/transport/include/hidl/HidlLazyUtils.h
index 257de98..6a62c97 100644
--- a/transport/include/hidl/HidlLazyUtils.h
+++ b/transport/include/hidl/HidlLazyUtils.h
@@ -29,13 +29,13 @@
/** Exits when all HALs registered through this object have 0 clients */
class LazyServiceRegistrar {
public:
- LazyServiceRegistrar();
static LazyServiceRegistrar& getInstance();
status_t registerService(const sp<::android::hidl::base::V1_0::IBase>& service,
const std::string& name = "default");
private:
std::shared_ptr<details::LazyServiceRegistrarImpl> mImpl;
+ LazyServiceRegistrar();
};
} // namespace hardware