Merge changes from topic 'hidlize-hw-service-manager'
* changes:
Break ::android::hardware namespace assumption.
Update for hidlized hwservicemanager.
diff --git a/ArrayType.cpp b/ArrayType.cpp
index 268b090..6c610ff 100644
--- a/ArrayType.cpp
+++ b/ArrayType.cpp
@@ -62,7 +62,8 @@
const std::string base = mElementType->getCppType(extra, specifyNamespaces);
CHECK(extra->empty());
- std::string arrayType = "hidl_array<" + base;
+ std::string space = specifyNamespaces ? "::android::hardware::" : "";
+ std::string arrayType = space + "hidl_array<" + base;
for (size_t i = 0; i < mSizes.size(); ++i) {
arrayType += ", ";
diff --git a/generateCpp.cpp b/generateCpp.cpp
index fdc5f90..f17025c 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,12 +1487,12 @@
out << "struct "
<< klassName
<< " : " << ifaceName
- << ", HidlInstrumentor {\n";
+ << ", ::android::hardware::HidlInstrumentor {\n";
out.indent();
out << "explicit "
<< klassName
- << "(const sp<"
+ << "(const ::android::sp<"
<< ifaceName
<< "> impl);\n";
@@ -1501,7 +1507,7 @@
out.unindent();
out << "private:\n";
out.indent();
- out << "const sp<" << ifaceName << "> mImpl;\n";
+ out << "const ::android::sp<" << ifaceName << "> mImpl;\n";
if (supportOneway) {
out << "::android::hardware::TaskRunner mOnewayQueue;\n";
@@ -1595,9 +1601,9 @@
out << klassName
<< "::"
<< klassName
- << "(const sp<"
+ << "(const ::android::sp<"
<< iface->fullName()
- << "> impl) : HidlInstrumentor(\""
+ << "> impl) : ::android::hardware::HidlInstrumentor(\""
<< iface->fqName().string()
<< "\"), mImpl(impl) {";
if (iface->hasOnewayMethods()) {
diff --git a/test/Android.bp b/test/Android.bp
index d01f152..96b16c3 100644
--- a/test/Android.bp
+++ b/test/Android.bp
@@ -1,3 +1,7 @@
+subdirs = [
+ "vendor/1.0",
+]
+
cc_test {
name: "hidl_test",
gtest: false,
diff --git a/test/java_test/hidl_test_java_native.cpp b/test/java_test/hidl_test_java_native.cpp
index 56410b4..27c3c61 100644
--- a/test/java_test/hidl_test_java_native.cpp
+++ b/test/java_test/hidl_test_java_native.cpp
@@ -6,7 +6,7 @@
#include <android/hardware/tests/baz/1.0/IBaz.h>
#include <gtest/gtest.h>
-#include <hidl/IServiceManager.h>
+
#include <hidl/Status.h>
#include <hwbinder/IPCThreadState.h>
#include <hwbinder/ProcessState.h>
diff --git a/test/main.cpp b/test/main.cpp
index 8943a9e..fbb16d9 100644
--- a/test/main.cpp
+++ b/test/main.cpp
@@ -30,7 +30,6 @@
#include <hidl-test/FooHelper.h>
#include <hidl-test/PointerHelper.h>
-#include <hidl/IServiceManager.h>
#include <hidl/Status.h>
#include <hwbinder/IPCThreadState.h>
#include <hwbinder/ProcessState.h>
diff --git a/test/vendor/1.0/Android.bp b/test/vendor/1.0/Android.bp
new file mode 100644
index 0000000..cabe733
--- /dev/null
+++ b/test/vendor/1.0/Android.bp
@@ -0,0 +1,47 @@
+// This file is autogenerated by hidl-gen. Do not edit manually.
+
+genrule {
+ name: "tests.vendor@1.0_genc++",
+ tool: "hidl-gen",
+ cmd: "$tool -o $genDir -Lc++ -rtests:system/tools/hidl/test/ tests.vendor@1.0",
+ srcs: [
+ "IVendor.hal",
+ ],
+ out: [
+ "tests/vendor/1.0/VendorAll.cpp",
+ ],
+}
+
+genrule {
+ name: "tests.vendor@1.0_genc++_headers",
+ tool: "hidl-gen",
+ cmd: "$tool -o $genDir -Lc++ -rtests:system/tools/hidl/test/ tests.vendor@1.0",
+ srcs: [
+ "IVendor.hal",
+ ],
+ out: [
+ "tests/vendor/1.0/IVendor.h",
+ "tests/vendor/1.0/IHwVendor.h",
+ "tests/vendor/1.0/BnVendor.h",
+ "tests/vendor/1.0/BpVendor.h",
+ "tests/vendor/1.0/BsVendor.h",
+ ],
+}
+
+cc_library_shared {
+ name: "tests.vendor@1.0",
+ generated_sources: ["tests.vendor@1.0_genc++"],
+ generated_headers: ["tests.vendor@1.0_genc++_headers"],
+ export_generated_headers: ["tests.vendor@1.0_genc++_headers"],
+ shared_libs: [
+ "libhidl",
+ "libhwbinder",
+ "libutils",
+ "libcutils",
+ ],
+ export_shared_lib_headers: [
+ "libhidl",
+ "libhwbinder",
+ "libutils",
+ ],
+}
diff --git a/test/vendor/1.0/IVendor.hal b/test/vendor/1.0/IVendor.hal
new file mode 100644
index 0000000..1ccaa0d
--- /dev/null
+++ b/test/vendor/1.0/IVendor.hal
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package tests.vendor@1.0;
+
+interface IVendor {
+
+ struct StructTest {
+ handle a;
+ vec<uint8_t> b;
+ MQDescriptorSync c;
+ string d;
+ uint8_t[4][4] e;
+ };
+
+ fun1(handle a) generates(handle b);
+ fun2(vec<uint8_t> a) generates(vec<uint8_t> b);
+ fun3(MQDescriptorSync a) generates(MQDescriptorSync b);
+ fun4(string a) generates(string b);
+ fun5(uint8_t[4][4] a) generates(uint8_t[4][4] b);
+
+};
\ No newline at end of file
diff --git a/test/vendor/1.0/update-makefile.sh b/test/vendor/1.0/update-makefile.sh
new file mode 100755
index 0000000..e286c22
--- /dev/null
+++ b/test/vendor/1.0/update-makefile.sh
@@ -0,0 +1,4 @@
+#!/bin/bash
+
+hidl-gen -Lmakefile -r tests:system/tools/hidl/test/ tests.vendor@1.0;
+hidl-gen -Landroidbp -r tests:system/tools/hidl/test/ tests.vendor@1.0;
\ No newline at end of file