Disable record/reply on user builds.
Hovering at 775900K -> 812324K free memory (adb shell su 0 procrank)
24150K -> 18801K for 64-bit hidl-generated libs
(ls -l system/lib64, sum of size column)
Which is a 22% reduction in binary size of these libraries and a
4.7% increase in free memory.
Test: boot on internal marlin.
Test: build user variant of device to ensure flags are setup correctly.
Change-Id: Iacd76cde44ff45a78afcbf83a2d1ca42f89040a3
diff --git a/generateCpp.cpp b/generateCpp.cpp
index debfefd..3e50c03 100644
--- a/generateCpp.cpp
+++ b/generateCpp.cpp
@@ -759,11 +759,13 @@
out << "});\n\n";
} else {
out << ");\n\n";
+
+ // used by generateCppInstrumentationCall
if (elidedReturn != nullptr) {
- out << elidedReturn->type().getCppResultType()
- << " _hidl_out_"
- << elidedReturn->name()
- << " = _hidl_return;\n";
+ out << "#ifdef __ANDROID_DEBUGGABLE__\n"
+ << elidedReturn->type().getCppResultType() << " _hidl_out_" << elidedReturn->name()
+ << " = _hidl_return;\n"
+ << "#endif // __ANDROID_DEBUGGABLE__\n";
}
status_t status = generateCppInstrumentationCall(
out,
@@ -2050,6 +2052,7 @@
return err;
}
+ out << "#ifdef __ANDROID_DEBUGGABLE__\n";
out << "if (UNLIKELY(mEnableInstrumentation)) {\n";
out.indent();
out << "std::vector<void *> _hidl_args;\n";
@@ -2143,7 +2146,8 @@
out.unindent();
out << "}\n";
out.unindent();
- out << "}\n\n";
+ out << "}\n";
+ out << "#endif // __ANDROID_DEBUGGABLE__\n\n";
return OK;
}