unique_fd is passed by value in AIDL interfaces

FileDescriptor type in AIDL was translated into const unique_fd& in C++.
Now, it is unique_fd, i.e. passed by value, to make it easier to keep it
beyond the scope of the call.

Bug: 144943748
Test: m, aidl_unittests
Change-Id: Iabc2735cf9b1e77eb4e4fe3213cb0450b3235ee8
diff --git a/aidl_to_cpp.cpp b/aidl_to_cpp.cpp
index f5fa3f8..9f2963e 100644
--- a/aidl_to_cpp.cpp
+++ b/aidl_to_cpp.cpp
@@ -219,6 +219,18 @@
   return GetCppName(type, typenames);
 }
 
+bool IsNonCopyableType(const AidlTypeSpecifier& type, const AidlTypenames& typenames) {
+  if (type.IsArray() || type.IsGeneric()) {
+    return false;
+  }
+
+  const std::string cpp_name = GetCppName(type, typenames);
+  if (cpp_name == "::android::base::unique_fd") {
+    return true;
+  }
+  return false;
+}
+
 std::string ParcelReadMethodOf(const AidlTypeSpecifier& type, const AidlTypenames& typenames) {
   return "read" + RawParcelMethod(type, typenames, true /* readMethod */);
 }