performance-unnecessary-value-param where possible am: 005757b900
am: 85d5f8b817

Change-Id: I6dbb3f87dc4a85ace1d8d3ec8a792649081143a6
diff --git a/Android.bp b/Android.bp
index 95e21bb..5e3566f 100644
--- a/Android.bp
+++ b/Android.bp
@@ -34,8 +34,8 @@
         "-Werror",
         "-Wextra-semi",
     ],
-    // b/121200893, hidl generated *All.cpp files use value parameters
     tidy_checks: [
+        // _hidl_cb and addOnewayTask are stuck because of the legacy ABI
         "-performance-unnecessary-value-param",
     ],
     product_variables: {
diff --git a/generateCppAdapter.cpp b/generateCppAdapter.cpp
index a83e9f3..1d88d3c 100644
--- a/generateCppAdapter.cpp
+++ b/generateCppAdapter.cpp
@@ -54,7 +54,7 @@
             out << "public:\n";
             out << "typedef " << mockName << " Pure;\n";
 
-            out << klassName << "(::android::sp<" << mockName << "> impl);\n";
+            out << klassName << "(const ::android::sp<" << mockName << ">& impl);\n";
 
             generateMethods(out, [&](const Method* method, const Interface* /* interface */) {
                 if (method->isHidlReserved()) {
@@ -103,8 +103,8 @@
 
         const std::string mockName = getInterface()->fqName().cppName();
 
-        out << klassName << "::" << klassName << "(::android::sp<" << mockName
-            << "> impl) : mImpl(impl) {}";
+        out << klassName << "::" << klassName << "(const ::android::sp<" << mockName
+            << ">& impl) : mImpl(impl) {}";
 
         generateMethods(out, [&](const Method* method, const Interface* /* interface */) {
             generateAdapterMethod(out, method);