Merge "Use new read(Embedded)Buffer API."
diff --git a/FQName.cpp b/FQName.cpp
index 5e9e347..07eb219 100644
--- a/FQName.cpp
+++ b/FQName.cpp
@@ -298,11 +298,11 @@
}
std::string FQName::getInterfaceProxyName() const {
- return "Bp" + getInterfaceBaseName();
+ return "BpHw" + getInterfaceBaseName();
}
std::string FQName::getInterfaceStubName() const {
- return "Bn" + getInterfaceBaseName();
+ return "BnHw" + getInterfaceBaseName();
}
std::string FQName::getInterfacePassthroughName() const {
diff --git a/Interface.cpp b/Interface.cpp
index 4c9e9a5..77681d4 100644
--- a/Interface.cpp
+++ b/Interface.cpp
@@ -50,6 +50,7 @@
HIDL_SYSPROPS_CHANGED_TRANSACTION,
HIDL_LINK_TO_DEATH_TRANSACTION,
HIDL_UNLINK_TO_DEATH_TRANSACTION,
+ HIDL_SET_HAL_INSTRUMENTATION_TRANSACTION,
LAST_HIDL_TRANSACTION = 0x00ffffff,
};
@@ -61,6 +62,7 @@
mReservedMethods.push_back(createSyspropsChangedMethod());
mReservedMethods.push_back(createLinkToDeathMethod());
mReservedMethods.push_back(createUnlinkToDeathMethod());
+ mReservedMethods.push_back(createSetHALInstrumentationMethod());
}
std::string Interface::typeName() const {
@@ -185,6 +187,44 @@
);
}
+Method *Interface::createSetHALInstrumentationMethod() const {
+ return new Method("setHALInstrumentation",
+ new std::vector<TypedVar *>() /*args */,
+ new std::vector<TypedVar *>() /*results */,
+ true /*oneway */,
+ new std::vector<Annotation *>(),
+ HIDL_SET_HAL_INSTRUMENTATION_TRANSACTION,
+ {
+ {IMPL_HEADER,
+ [this](auto &out) {
+ // do nothing for base class.
+ out << "return ::android::hardware::Void();\n";
+ }
+ },
+ {IMPL_PROXY,
+ [](auto &out) {
+ out << "configureInstrumentation();\n";
+ out << "return ::android::hardware::Void();\n";
+ }
+ },
+ {IMPL_STUB,
+ [](auto &out) {
+ out << "configureInstrumentation();\n";
+ }
+ },
+ {IMPL_PASSTHROUGH,
+ [](auto &out) {
+ out << "configureInstrumentation();\n";
+ out << "return ::android::hardware::Void();\n";
+ }
+ },
+ }, /*cppImpl */
+ { { IMPL_HEADER, [](auto & /*out*/) { /* javaImpl */
+ // Not support for Java Impl for now.
+ } } } /*javaImpl */
+ );
+}
+
Method *Interface::createDescriptorChainMethod() const {
VectorType *vecType = new VectorType();
vecType->setElementType(new StringType());
diff --git a/Interface.h b/Interface.h
index 6cde462..0182818 100644
--- a/Interface.h
+++ b/Interface.h
@@ -113,6 +113,7 @@
Method *createSyspropsChangedMethod() const;
Method *createLinkToDeathMethod() const;
Method *createUnlinkToDeathMethod() const;
+ Method *createSetHALInstrumentationMethod() const;
DISALLOW_COPY_AND_ASSIGN(Interface);
};
diff --git a/Method.h b/Method.h
index ac681a5..8a05ffc 100644
--- a/Method.h
+++ b/Method.h
@@ -38,7 +38,8 @@
enum MethodImplType {
IMPL_HEADER,
IMPL_PROXY,
- IMPL_STUB
+ IMPL_STUB,
+ IMPL_PASSTHROUGH,
};
using MethodImpl = std::map<MethodImplType, std::function<void(Formatter &)>>;
diff --git a/generateCpp.cpp b/generateCpp.cpp
index a4af202..adde77d 100644
--- a/generateCpp.cpp
+++ b/generateCpp.cpp
@@ -537,6 +537,14 @@
out << " {\n";
out.indent();
+ if (method->isHidlReserved()
+ && method->overridesCppImpl(IMPL_PASSTHROUGH)) {
+ method->cppImpl(IMPL_PASSTHROUGH, out);
+ out.unindent();
+ out << "}\n\n";
+ return OK;
+ }
+
const bool returnsValue = !method->results().empty();
const TypedVar *elidedReturn = method->canElideCallback();
@@ -1333,7 +1341,7 @@
out << "}\n\n";
if (iface->isIBase()) {
- // BnBase has a constructor to initialize the HidlInstrumentor
+ // BnHwBase has a constructor to initialize the HidlInstrumentor
// class properly.
out << klassName
<< "::"
diff --git a/test/main.cpp b/test/main.cpp
index 31d8bb7..12f7ecd 100644
--- a/test/main.cpp
+++ b/test/main.cpp
@@ -13,9 +13,9 @@
#include <android/hidl/token/1.0/ITokenManager.h>
#include <android/hardware/tests/foo/1.0/IFoo.h>
-#include <android/hardware/tests/foo/1.0/BnSimple.h>
+#include <android/hardware/tests/foo/1.0/BnHwSimple.h>
#include <android/hardware/tests/foo/1.0/BsSimple.h>
-#include <android/hardware/tests/foo/1.0/BpSimple.h>
+#include <android/hardware/tests/foo/1.0/BpHwSimple.h>
#include <android/hardware/tests/bar/1.0/IBar.h>
#include <android/hardware/tests/bar/1.0/IComplicated.h>
#include <android/hardware/tests/inheritance/1.0/IFetcher.h>
@@ -762,20 +762,20 @@
}
TEST_F(HidlTest, WrapTest) {
- using ::android::hardware::tests::foo::V1_0::BnSimple;
+ using ::android::hardware::tests::foo::V1_0::BnHwSimple;
using ::android::hardware::tests::foo::V1_0::BsSimple;
- using ::android::hardware::tests::foo::V1_0::BpSimple;
+ using ::android::hardware::tests::foo::V1_0::BpHwSimple;
using ::android::hardware::HidlInstrumentor;
nsecs_t now;
int i = 0;
now = systemTime();
- new BnSimple(new Simple(1));
- EXPECT_LT(systemTime() - now, 2000000) << " for BnSimple(nonnull)";
+ new BnHwSimple(new Simple(1));
+ EXPECT_LT(systemTime() - now, 2000000) << " for BnHwSimple(nonnull)";
now = systemTime();
- new BnSimple(nullptr);
- EXPECT_LT(systemTime() - now, 2000000) << " for BnSimple(null)";
+ new BnHwSimple(nullptr);
+ EXPECT_LT(systemTime() - now, 2000000) << " for BnHwSimple(null)";
now = systemTime();
new BsSimple(new Simple(1));
@@ -786,8 +786,8 @@
EXPECT_LT(systemTime() - now, 2000000) << " for BsSimple(null)";
now = systemTime();
- new BpSimple(nullptr);
- EXPECT_LT(systemTime() - now, 2000000) << " for BpSimple(null)";
+ new BpHwSimple(nullptr);
+ EXPECT_LT(systemTime() - now, 2000000) << " for BpHwSimple(null)";
now = systemTime();
new ::android::hardware::HidlInstrumentor("");
diff --git a/test/vendor/1.0/Android.bp b/test/vendor/1.0/Android.bp
index 869b03a..4307cea 100644
--- a/test/vendor/1.0/Android.bp
+++ b/test/vendor/1.0/Android.bp
@@ -26,8 +26,8 @@
"tests/vendor/1.0/types.h",
"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/BnHwVendor.h",
+ "tests/vendor/1.0/BpHwVendor.h",
"tests/vendor/1.0/BsVendor.h",
],
}