Explicitly assertOk on cpp stubs.
Bug: 124861676
Test: hwservicemanager doesn't error
Change-Id: I9fb74649690991faa1c643211839a777b99740ad
diff --git a/generateCpp.cpp b/generateCpp.cpp
index 98e3d27..affc53d 100644
--- a/generateCpp.cpp
+++ b/generateCpp.cpp
@@ -1509,6 +1509,7 @@
});
out << ");\n\n";
+
out << "::android::hardware::writeToParcel(::android::hardware::Status::ok(), "
<< "_hidl_reply);\n\n";
@@ -1541,7 +1542,8 @@
out << "bool _hidl_callbackCalled = false;\n\n";
}
- out << callee << "->" << method->name() << "(";
+ out << "::android::hardware::Return<void> _hidl_ret = " << callee << "->" << method->name()
+ << "(";
out.join(method->args().begin(), method->args().end(), ", ", [&] (const auto &arg) {
if (arg->type().resultNeedsDeref()) {
@@ -1620,6 +1622,8 @@
superInterface);
}
+ out << "_hidl_ret.assertOk();\n";
+
if (returnsValue) {
out << "if (!_hidl_callbackCalled) {\n";
out.indent();