libhidltransport: move methods to sources
Moved all methods with no templatization into sources.
Test: links
Bug: 35710429
Change-Id: I44bd6407e1bd74dd188b4033ddf176587ccdd8e7
diff --git a/transport/include/hidl/HidlBinderSupport.h b/transport/include/hidl/HidlBinderSupport.h
index a82f977..6f82dbc 100644
--- a/transport/include/hidl/HidlBinderSupport.h
+++ b/transport/include/hidl/HidlBinderSupport.h
@@ -40,18 +40,9 @@
// DeathRecipient interface.
struct hidl_binder_death_recipient : IBinder::DeathRecipient {
hidl_binder_death_recipient(const sp<hidl_death_recipient> &recipient,
- uint64_t cookie, const sp<::android::hidl::base::V1_0::IBase> &base) :
- mRecipient(recipient), mCookie(cookie), mBase(base) {
- }
- virtual void binderDied(const wp<IBinder>& /*who*/) {
- sp<hidl_death_recipient> recipient = mRecipient.promote();
- if (recipient != nullptr) {
- recipient->serviceDied(mCookie, mBase);
- }
- }
- wp<hidl_death_recipient> getRecipient() {
- return mRecipient;
- }
+ uint64_t cookie, const sp<::android::hidl::base::V1_0::IBase> &base);
+ virtual void binderDied(const wp<IBinder>& /*who*/);
+ wp<hidl_death_recipient> getRecipient();
private:
wp<hidl_death_recipient> mRecipient;
uint64_t mCookie;
diff --git a/transport/include/hidl/HidlTransportUtils.h b/transport/include/hidl/HidlTransportUtils.h
index fbd6516..5afb9a6 100644
--- a/transport/include/hidl/HidlTransportUtils.h
+++ b/transport/include/hidl/HidlTransportUtils.h
@@ -28,40 +28,10 @@
* @param emitError if emitError is false, return Return<bool>{false} on error; if emitError
* is true, the Return<bool> object contains the actual error.
*/
-inline Return<bool> canCastInterface(::android::hidl::base::V1_0::IBase* interface,
- const char* castTo, bool emitError = false) {
- if (interface == nullptr) {
- return false;
- }
+Return<bool> canCastInterface(::android::hidl::base::V1_0::IBase* interface,
+ const char* castTo, bool emitError = false);
- bool canCast = false;
- auto chainRet = interface->interfaceChain([&](const hidl_vec<hidl_string> &types) {
- for (size_t i = 0; i < types.size(); i++) {
- if (types[i] == castTo) {
- canCast = true;
- break;
- }
- }
- });
-
- if (!chainRet.isOk()) {
- // call fails, propagate the error if emitError
- return emitError
- ? details::StatusOf<void, bool>(chainRet)
- : Return<bool>(false);
- }
-
- return canCast;
-}
-
-inline std::string getDescriptor(::android::hidl::base::V1_0::IBase* interface) {
- std::string myDescriptor{};
- auto ret = interface->interfaceDescriptor([&](const hidl_string &types) {
- myDescriptor = types.c_str();
- });
- ret.isOk(); // ignored, return empty string if not isOk()
- return myDescriptor;
-}
+std::string getDescriptor(::android::hidl::base::V1_0::IBase* interface);
} // namespace details
} // namespace hardware