IBase: add ping method
Add ping method to IBase. We deleted this from libhwbinder types, so
moving it to hidl types.
Bug: 34501346
Test: hidl_test
Change-Id: I1e13a48f1ca3668450def6434650763483baf34e
diff --git a/Interface.cpp b/Interface.cpp
index 564a534..e1999c9 100644
--- a/Interface.cpp
+++ b/Interface.cpp
@@ -46,7 +46,8 @@
LAST_CALL_TRANSACTION = 0x00efffff,
/////////////////// HIDL reserved
FIRST_HIDL_TRANSACTION = 0x00f00000,
- HIDL_DESCRIPTOR_CHAIN_TRANSACTION = FIRST_HIDL_TRANSACTION,
+ HIDL_PING_TRANSACTION = FIRST_HIDL_TRANSACTION,
+ HIDL_DESCRIPTOR_CHAIN_TRANSACTION,
HIDL_GET_DESCRIPTOR_TRANSACTION,
HIDL_SYSPROPS_CHANGED_TRANSACTION,
HIDL_LINK_TO_DEATH_TRANSACTION,
@@ -67,6 +68,38 @@
return "interface " + localName();
}
+bool Interface::fillPingMethod(Method *method) const {
+ if (method->name() != "ping") {
+ return false;
+ }
+
+ method->fillImplementation(
+ HIDL_PING_TRANSACTION,
+ {
+ {IMPL_HEADER,
+ [](auto &out) {
+ out << "return ::android::hardware::Void();\n";
+ }
+ },
+ {IMPL_STUB_IMPL,
+ [](auto &out) {
+ out << "return ::android::hardware::Void();\n";
+ }
+ }
+ }, /*cppImpl*/
+ {
+ {IMPL_HEADER,
+ [this](auto &out) {
+ out << "return;\n";
+ }
+ },
+ {IMPL_STUB, nullptr /* don't generate code */}
+ } /*javaImpl*/
+ );
+
+ return true;
+}
+
bool Interface::fillLinkToDeathMethod(Method *method) const {
if (method->name() != "linkToDeath") {
return false;
@@ -367,7 +400,8 @@
std::map<int32_t, Method *> reservedMethodsById;
for (const auto &pair : gAllReservedMethods) {
Method *method = pair.second->copySignature();
- bool fillSuccess = fillDescriptorChainMethod(method)
+ bool fillSuccess = fillPingMethod(method)
+ || fillDescriptorChainMethod(method)
|| fillGetDescriptorMethod(method)
|| fillSyspropsChangedMethod(method)
|| fillLinkToDeathMethod(method)