Update for hidlized hwservicemanager.

Test: end to end
Bug: 32313592
Bug: 32579492

Change-Id: Id4803490ae7edb490971962e5b799d97002df233
diff --git a/generateCpp.cpp b/generateCpp.cpp
index fdc5f90..380f21d 100644
--- a/generateCpp.cpp
+++ b/generateCpp.cpp
@@ -157,7 +157,7 @@
     }
 
     out << "#include <hidl/HidlSupport.h>\n";
-    out << "#include <hidl/IServiceManager.h>\n";
+    out << "#include <hidl/ServiceManagement.h>\n";
     out << "#include <hidl/MQDescriptor.h>\n";
 
     if (isInterface) {
@@ -177,7 +177,7 @@
         const Interface *superType = iface->superType();
 
         if (superType == NULL) {
-            out << " : virtual public IHidlInterfaceBase";
+            out << " : virtual public ::android::hardware::IHidlInterfaceBase";
         } else {
             out << " : public "
                 << superType->fullName();
@@ -199,10 +199,11 @@
         const Interface *iface = mRootScope->getInterface();
         const Interface *superType = iface->superType();
         const std::string baseName = iface->getBaseName();
-        out << "constexpr static hidl_version version = {"
+        out << "constexpr static ::android::hardware::hidl_version version = {"
             << mPackage.getPackageMajorVersion() << ","
             << mPackage.getPackageMinorVersion() << "};\n";
-        out << "virtual const hidl_version& getInterfaceVersion() const {\n";
+        out << "virtual const ::android::hardware::hidl_version&"
+            << "getInterfaceVersion() const {\n";
         out.indent();
         out << "return version;\n";
         out.unindent();
@@ -734,6 +735,9 @@
     Formatter out(file);
 
     if (isInterface) {
+        // This is a no-op for IServiceManager itself.
+        out << "#include <android/hidl/manager/1.0/IServiceManager.h>\n";
+
         generateCppPackageInclude(out, mPackage, "Bp" + baseName);
         generateCppPackageInclude(out, mPackage, "Bn" + baseName);
         generateCppPackageInclude(out, mPackage, "Bs" + baseName);
@@ -756,7 +760,9 @@
 
     if (err == OK && isInterface) {
         const Interface *iface = mRootScope->getInterface();
-        out << "constexpr hidl_version " << ifaceName << "::version;\n\n";
+        out << "constexpr ::android::hardware::hidl_version "
+            << ifaceName
+            << "::version;\n\n";
 
         // need to be put here, generateStubSource is using this.
         out << "const ::android::String16 I"
@@ -1065,7 +1071,7 @@
         << "<IHw"
         << baseName
         << ">(_hidl_impl),\n"
-        << "  HidlInstrumentor(\""
+        << "  ::android::hardware::HidlInstrumentor(\""
         << mPackage.string()
         << "::I"
         << baseName
@@ -1108,7 +1114,7 @@
         << ", IHw"
         << baseName
         << ">(_hidl_impl),\n"
-        << "  HidlInstrumentor(\""
+        << "  ::android::hardware::HidlInstrumentor(\""
         << mPackage.string()
         << "::I"
         << baseName
@@ -1481,7 +1487,7 @@
     out << "struct "
         << klassName
         << " : " << ifaceName
-        << ", HidlInstrumentor {\n";
+        << ", ::android::hardware::HidlInstrumentor {\n";
 
     out.indent();
     out << "explicit "
@@ -1597,7 +1603,7 @@
         << klassName
         << "(const sp<"
         << iface->fullName()
-        << "> impl) : HidlInstrumentor(\""
+        << "> impl) : ::android::hardware::HidlInstrumentor(\""
         << iface->fqName().string()
         << "\"), mImpl(impl) {";
     if (iface->hasOnewayMethods()) {