Remove Interface::hasOnewayMethods()
IBase contains `oneway notifySyspropsChanged()` which means
`Interface::hasOnewayMethods()` always returns true. This CL removes
that code and simplifies calling code.
Bug: N/A
Test: source test/run_all_device_tests.sh
Change-Id: I55fe70ce2022c8242109893456075b580ab13c63
diff --git a/generateCpp.cpp b/generateCpp.cpp
index 4caf824..c6de972 100644
--- a/generateCpp.cpp
+++ b/generateCpp.cpp
@@ -1723,8 +1723,6 @@
const std::string klassName = iface->getPassthroughName();
- bool supportOneway = iface->hasOnewayMethods();
-
const std::string guard = makeHeaderGuard(klassName);
out << "#ifndef " << guard << "\n";
@@ -1742,9 +1740,7 @@
out << "\n";
out << "#include <hidl/HidlPassthroughSupport.h>\n";
- if (supportOneway) {
- out << "#include <hidl/TaskRunner.h>\n";
- }
+ out << "#include <hidl/TaskRunner.h>\n";
enterLeaveNamespace(out, true /* enter */);
out << "\n";
@@ -1774,14 +1770,12 @@
out.indent();
out << "const ::android::sp<" << iface->localName() << "> mImpl;\n";
- if (supportOneway) {
- out << "::android::hardware::details::TaskRunner mOnewayQueue;\n";
+ out << "::android::hardware::details::TaskRunner mOnewayQueue;\n";
- out << "\n";
+ out << "\n";
- out << "::android::hardware::Return<void> addOnewayTask("
- "std::function<void(void)>);\n\n";
- }
+ out << "::android::hardware::Return<void> addOnewayTask("
+ "std::function<void(void)>);\n\n";
out.unindent();
@@ -1853,48 +1847,33 @@
const std::string klassName = iface->getPassthroughName();
- out << klassName
- << "::"
- << klassName
- << "(const ::android::sp<"
- << iface->fullName()
- << "> impl) : ::android::hardware::details::HidlInstrumentor(\""
- << mPackage.string()
- << "\", \""
- << iface->localName()
- << "\"), mImpl(impl) {";
- if (iface->hasOnewayMethods()) {
- out << "\n";
- out.indent([&] {
- out << "mOnewayQueue.start(3000 /* similar limit to binderized */);\n";
- });
- }
+ out << klassName << "::" << klassName << "(const ::android::sp<" << iface->fullName()
+ << "> impl) : ::android::hardware::details::HidlInstrumentor(\"" << mPackage.string()
+ << "\", \"" << iface->localName() << "\"), mImpl(impl) {\n";
+
+ out.indent([&] { out << "mOnewayQueue.start(3000 /* similar limit to binderized */);\n"; });
+
out << "}\n\n";
- if (iface->hasOnewayMethods()) {
- out << "::android::hardware::Return<void> "
- << klassName
- << "::addOnewayTask(std::function<void(void)> fun) {\n";
- out.indent();
- out << "if (!mOnewayQueue.push(fun)) {\n";
- out.indent();
- out << "return ::android::hardware::Status::fromExceptionCode(\n";
- out.indent();
- out.indent();
- out << "::android::hardware::Status::EX_TRANSACTION_FAILED,\n"
- << "\"Passthrough oneway function queue exceeds maximum size.\");\n";
- out.unindent();
- out.unindent();
- out.unindent();
- out << "}\n";
+ out << "::android::hardware::Return<void> " << klassName
+ << "::addOnewayTask(std::function<void(void)> fun) {\n";
+ out.indent();
+ out << "if (!mOnewayQueue.push(fun)) {\n";
+ out.indent();
+ out << "return ::android::hardware::Status::fromExceptionCode(\n";
+ out.indent();
+ out.indent();
+ out << "::android::hardware::Status::EX_TRANSACTION_FAILED,\n"
+ << "\"Passthrough oneway function queue exceeds maximum size.\");\n";
+ out.unindent();
+ out.unindent();
+ out.unindent();
+ out << "}\n";
- out << "return ::android::hardware::Status();\n";
+ out << "return ::android::hardware::Status();\n";
- out.unindent();
- out << "}\n\n";
-
-
- }
+ out.unindent();
+ out << "}\n\n";
}
void AST::generateCppAtraceCall(Formatter &out,