Fix clang-tidy performance-* warnings in system/libhidl.

* Use const reference parameter type to avoid unnecessary copy.
* Use more efficient overloaded string methods.
* Use const reference type for loop index variables to avoid unnecessary copy.

Bug: 30407689
Bug: 30411878
Bug: 30413223
Test: build with WITH_TIDY=1
Test: libhidl_test
Change-Id: I1deae1f09d56c2fa9cd56728b13ca50305d18f3e
diff --git a/transport/ServiceManagement.cpp b/transport/ServiceManagement.cpp
index a404d10..feb1254 100644
--- a/transport/ServiceManagement.cpp
+++ b/transport/ServiceManagement.cpp
@@ -93,7 +93,7 @@
     }
     ifs >> cmdline;
 
-    size_t idx = cmdline.rfind("/");
+    size_t idx = cmdline.rfind('/');
     if (idx != std::string::npos) {
         cmdline = cmdline.substr(idx + 1);
     }
@@ -257,9 +257,10 @@
 }
 
 struct PassthroughServiceManager : IServiceManager1_1 {
-    static void openLibs(const std::string& fqName,
-            std::function<bool /* continue */(void* /* handle */,
-                const std::string& /* lib */, const std::string& /* sym */)> eachLib) {
+    static void openLibs(
+        const std::string& fqName,
+        const std::function<bool /* continue */ (void* /* handle */, const std::string& /* lib */,
+                                                 const std::string& /* sym */)>& eachLib) {
         //fqName looks like android.hardware.foo@1.0::IFoo
         size_t idx = fqName.find("::");