IFoo::descriptor String16 -> const char*
This makes them much more useable.
Test: hidl_test/hidl_test_java
Bug: 32745840
Change-Id: Ie9b77965821391a1b5c134c82ec680e8cde1440f
diff --git a/generateCpp.cpp b/generateCpp.cpp
index ba1d271..c14119a 100644
--- a/generateCpp.cpp
+++ b/generateCpp.cpp
@@ -284,7 +284,7 @@
}
}
- out << "\nstatic const ::android::String16 descriptor;\n\n";
+ out << "\nstatic const char* descriptor;\n\n";
out << "DECLARE_SERVICE_MANAGER_INTERACTIONS(" << baseName << ")\n\n";
@@ -756,7 +756,7 @@
<< "::version;\n\n";
// need to be put here, generateStubSource is using this.
- out << "const ::android::String16 I"
+ out << "const char* I"
<< iface->getBaseName()
<< "::descriptor(\""
<< iface->fqName().string()
@@ -766,9 +766,9 @@
<< iface->getBaseName()
<< "::hidlStaticBlock = []() -> int {\n";
out.indentBlock([&] {
- out << "::android::hardware::gBnConstructorMap[::android::String16::std_string(I"
+ out << "::android::hardware::gBnConstructorMap[I"
<< iface->getBaseName()
- << "::descriptor)]\n";
+ << "::descriptor]\n";
out.indentBlock(2, [&] {
out << "= [](void *iIntf) -> ::android::sp<::android::hardware::IBinder> {\n";
out.indentBlock([&] {
@@ -930,12 +930,12 @@
out, method->results(), true /* forResults */);
out << "_hidl_err = _hidl_data.writeInterfaceToken(";
- if (!method->isHidlReserved()) {
- out << superInterface->fqName().cppNamespace()
- << "::IHw"
- << superInterface->getBaseName();
- } else {
+ if (method->isHidlReserved()) {
out << "::android::hardware::IBase";
+ } else {
+ out << superInterface->fqName().cppNamespace()
+ << "::I"
+ << superInterface->getBaseName();
}
out << "::descriptor);\n";
@@ -1224,12 +1224,12 @@
Formatter &out, const Interface *iface, const Method *method) const {
out << "if (!_hidl_data.enforceInterface(";
- if (!method->isHidlReserved()) {
- out << iface->fqName().cppNamespace()
- << "::IHw"
- << iface->getBaseName();
- } else {
+ if (method->isHidlReserved()) {
out << "::android::hardware::IBase";
+ } else {
+ out << iface->fqName().cppNamespace()
+ << "::I"
+ << iface->getBaseName();
}
out << "::descriptor)) {\n";