Add onRegistration hook in registerAsService.
This allows us to plug logic into service registration without having to
put it in autogenerated code.
Test: onRegistration logic executes
Test: (sanity) hidl_test
Bug: 33664825
(cherry picked from commit a9582e64b4fb98ff7ac762d3913faf9f833a883d)
Merged-In: Idc44c4d682671bec84c7d0031c24b87d0997aefc
Change-Id: Idc44c4d682671bec84c7d0031c24b87d0997aefc
diff --git a/generateCpp.cpp b/generateCpp.cpp
index d7e581e..d730f0c 100644
--- a/generateCpp.cpp
+++ b/generateCpp.cpp
@@ -322,6 +322,10 @@
out << "::android::status_t " << interfaceName << "::registerAsService("
<< "const std::string &serviceName) ";
out.block([&] {
+ out << "::android::hardware::details::onRegistration(\""
+ << fqName.getPackageAndVersion().string() << "\", \""
+ << interfaceName
+ << "\", serviceName);\n\n";
out << "const ::android::sp<::android::hidl::manager::V1_0::IServiceManager> sm\n";
out.indent(2, [&] {
out << "= ::android::hardware::defaultServiceManager();\n";