Split into HidlSupport and HidlTransportSupport.
am: 859e53f03c

Change-Id: Ib46ebe597ef6783976c1c73e2a63391c6a672e38
diff --git a/VectorType.cpp b/VectorType.cpp
index b3e7235..da09884 100644
--- a/VectorType.cpp
+++ b/VectorType.cpp
@@ -368,6 +368,7 @@
     CHECK(needsResolveReferences() && mElementType->needsResolveReferences());
 
     const std::string nameDeref = name + (nameIsPointer ? "->" : ".");
+    const std::string nameDerefed = (nameIsPointer ? "*" : "") + name;
     std::string elementType = mElementType->getCppStackType();
 
     std::string myChildName = childName, myChildOffset = childOffsetText;
@@ -377,7 +378,8 @@
         myChildOffset = "0";
 
         out << "size_t " << myChildName << ";\n";
-        out << "_hidl_err = " << nameDeref << "findInParcel("
+        out << "_hidl_err = ::android::hardware::findInParcel("
+            << nameDerefed << ", "
             << (parcelObjIsPointer ? "*" : "") << parcelObj << ", "
             << "&" << myChildName
             << ");\n";
diff --git a/generateCpp.cpp b/generateCpp.cpp
index 52debfc..1fa1287 100644
--- a/generateCpp.cpp
+++ b/generateCpp.cpp
@@ -166,7 +166,8 @@
         out << "#include <android/hidl/manager/1.0/IServiceNotification.h>\n\n";
     }
 
-    out << "#include <hidl/HidlSupport.h>\n";
+    // TODO b/32756130 change back to HidlSupport.h
+    out << "#include <hidl/HidlTransportSupport.h>\n";
     out << "#include <hidl/MQDescriptor.h>\n";
 
     if (isInterface) {
@@ -362,7 +363,7 @@
 
     out << "\n";
 
-    out << "#include <hidl/HidlSupport.h>\n";
+    out << "#include <hidl/HidlTransportSupport.h>\n";
     out << "#include <hidl/Status.h>\n";
     out << "#include <hwbinder/IBinder.h>\n";
     out << "#include <hwbinder/IInterface.h>\n";
@@ -996,7 +997,7 @@
     out << "if (_hidl_err != ::android::OK) { goto _hidl_error; }\n\n";
 
     if (!method->isOneway()) {
-        out << "_hidl_err = _hidl_status.readFromParcel(_hidl_reply);\n";
+        out << "_hidl_err = ::android::hardware::readFromParcel(&_hidl_status, _hidl_reply);\n";
         out << "if (_hidl_err != ::android::OK) { goto _hidl_error; }\n\n";
         out << "if (!_hidl_status.isOk()) { return _hidl_status; }\n\n";
 
@@ -1214,15 +1215,11 @@
 
     out << "if (_hidl_err == ::android::UNEXPECTED_NULL) {\n";
     out.indent();
-    out << "_hidl_err = ::android::hardware::Status::fromExceptionCode(\n";
+    out << "_hidl_err = ::android::hardware::writeToParcel(\n";
     out.indent();
     out.indent();
-    out << "::android::hardware::Status::EX_NULL_POINTER)\n";
-    out.indent();
-    out.indent();
-    out << ".writeToParcel(_hidl_reply);\n";
-    out.unindent();
-    out.unindent();
+    out << "::android::hardware::Status::fromExceptionCode(::android::hardware::Status::EX_NULL_POINTER),\n";
+    out << "_hidl_reply);\n";
     out.unindent();
     out.unindent();
 
@@ -1318,8 +1315,8 @@
         }
 
         out << ");\n\n";
-        out << "::android::hardware::Status::ok()"
-            << ".writeToParcel(_hidl_reply);\n\n";
+        out << "::android::hardware::writeToParcel(::android::hardware::Status::ok(), "
+            << "_hidl_reply);\n\n";
 
         elidedReturn->type().emitReaderWriter(
                 out,
@@ -1391,8 +1388,8 @@
             out.indent();
             out << "_hidl_callbackCalled = true;\n\n";
 
-            out << "::android::hardware::Status::ok()"
-                      << ".writeToParcel(_hidl_reply);\n\n";
+            out << "::android::hardware::writeToParcel(::android::hardware::Status::ok(), "
+                << "_hidl_reply);\n\n";
 
             // First DFS: buffers
             for (const auto &arg : method->results()) {
@@ -1445,8 +1442,8 @@
             out.indent();
         }
 
-        out << "::android::hardware::Status::ok()"
-            << ".writeToParcel(_hidl_reply);\n";
+        out << "::android::hardware::writeToParcel(::android::hardware::Status::ok(), "
+            << "_hidl_reply);\n\n";
 
         if (returnsValue) {
             out.unindent();