summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorTreehugger Robot <treehugger-gerrit@google.com>2016-10-29 06:01:58 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2016-10-29 06:01:59 +0000
commit058ee272fd890d480bbab84371b386f1da769e78 (patch)
tree6255964a6ab9bc920bfad5cf328b1d404dc80e6b /tests
parentf43e22b92f04eff04375f4820b4b562179c2ec6c (diff)
parentcc6ad7dfe53de803f20d9ea0da3e3d74ba7c7b28 (diff)
downloadplatform_hardware_interfaces-058ee272fd890d480bbab84371b386f1da769e78.tar.gz
platform_hardware_interfaces-058ee272fd890d480bbab84371b386f1da769e78.tar.bz2
platform_hardware_interfaces-058ee272fd890d480bbab84371b386f1da769e78.zip
Merge "add test for binder inheritance."
Diffstat (limited to 'tests')
-rw-r--r--tests/Android.bp2
-rw-r--r--tests/inheritance/1.0/Android.bp71
-rw-r--r--tests/inheritance/1.0/Android.mk186
-rw-r--r--tests/inheritance/1.0/IChild.hal22
-rw-r--r--tests/inheritance/1.0/IFetcher.hal28
-rw-r--r--tests/inheritance/1.0/IGrandparent.hal21
-rw-r--r--tests/inheritance/1.0/IParent.hal23
-rw-r--r--tests/inheritance/1.0/default/Android.bp21
-rw-r--r--tests/inheritance/1.0/default/Child.cpp42
-rw-r--r--tests/inheritance/1.0/default/Child.h44
-rw-r--r--tests/inheritance/1.0/default/Fetcher.cpp58
-rw-r--r--tests/inheritance/1.0/default/Fetcher.h45
-rw-r--r--tests/inheritance/1.0/default/Grandparent.cpp29
-rw-r--r--tests/inheritance/1.0/default/Grandparent.h37
-rw-r--r--tests/inheritance/1.0/default/Parent.cpp35
-rw-r--r--tests/inheritance/1.0/default/Parent.h40
16 files changed, 704 insertions, 0 deletions
diff --git a/tests/Android.bp b/tests/Android.bp
index e9b01484bc..030576d0fb 100644
--- a/tests/Android.bp
+++ b/tests/Android.bp
@@ -7,6 +7,8 @@ subdirs = [
"foo/1.0",
"foo/1.0/default",
"foo/1.0/default/lib",
+ "inheritance/1.0",
+ "inheritance/1.0/default",
"libhwbinder/1.0",
"libhwbinder/1.0/default",
"msgq/1.0",
diff --git a/tests/inheritance/1.0/Android.bp b/tests/inheritance/1.0/Android.bp
new file mode 100644
index 0000000000..e4a3439d18
--- /dev/null
+++ b/tests/inheritance/1.0/Android.bp
@@ -0,0 +1,71 @@
+// This file is autogenerated by hidl-gen. Do not edit manually.
+
+genrule {
+ name: "android.hardware.tests.inheritance@1.0_genc++",
+ tool: "hidl-gen",
+ cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.tests.inheritance@1.0",
+ srcs: [
+ "IChild.hal",
+ "IFetcher.hal",
+ "IGrandparent.hal",
+ "IParent.hal",
+ ],
+ out: [
+ "android/hardware/tests/inheritance/1.0/ChildAll.cpp",
+ "android/hardware/tests/inheritance/1.0/FetcherAll.cpp",
+ "android/hardware/tests/inheritance/1.0/GrandparentAll.cpp",
+ "android/hardware/tests/inheritance/1.0/ParentAll.cpp",
+ ],
+}
+
+genrule {
+ name: "android.hardware.tests.inheritance@1.0_genc++_headers",
+ tool: "hidl-gen",
+ cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.tests.inheritance@1.0",
+ srcs: [
+ "IChild.hal",
+ "IFetcher.hal",
+ "IGrandparent.hal",
+ "IParent.hal",
+ ],
+ out: [
+ "android/hardware/tests/inheritance/1.0/IChild.h",
+ "android/hardware/tests/inheritance/1.0/IHwChild.h",
+ "android/hardware/tests/inheritance/1.0/BnChild.h",
+ "android/hardware/tests/inheritance/1.0/BpChild.h",
+ "android/hardware/tests/inheritance/1.0/BsChild.h",
+ "android/hardware/tests/inheritance/1.0/IFetcher.h",
+ "android/hardware/tests/inheritance/1.0/IHwFetcher.h",
+ "android/hardware/tests/inheritance/1.0/BnFetcher.h",
+ "android/hardware/tests/inheritance/1.0/BpFetcher.h",
+ "android/hardware/tests/inheritance/1.0/BsFetcher.h",
+ "android/hardware/tests/inheritance/1.0/IGrandparent.h",
+ "android/hardware/tests/inheritance/1.0/IHwGrandparent.h",
+ "android/hardware/tests/inheritance/1.0/BnGrandparent.h",
+ "android/hardware/tests/inheritance/1.0/BpGrandparent.h",
+ "android/hardware/tests/inheritance/1.0/BsGrandparent.h",
+ "android/hardware/tests/inheritance/1.0/IParent.h",
+ "android/hardware/tests/inheritance/1.0/IHwParent.h",
+ "android/hardware/tests/inheritance/1.0/BnParent.h",
+ "android/hardware/tests/inheritance/1.0/BpParent.h",
+ "android/hardware/tests/inheritance/1.0/BsParent.h",
+ ],
+}
+
+cc_library_shared {
+ name: "android.hardware.tests.inheritance@1.0",
+ generated_sources: ["android.hardware.tests.inheritance@1.0_genc++"],
+ generated_headers: ["android.hardware.tests.inheritance@1.0_genc++_headers"],
+ export_generated_headers: ["android.hardware.tests.inheritance@1.0_genc++_headers"],
+ shared_libs: [
+ "libhidl",
+ "libhwbinder",
+ "libutils",
+ "libcutils",
+ ],
+export_shared_lib_headers: [
+ "libhidl",
+ "libhwbinder",
+ "libutils",
+ ],
+}
diff --git a/tests/inheritance/1.0/Android.mk b/tests/inheritance/1.0/Android.mk
new file mode 100644
index 0000000000..34da056b86
--- /dev/null
+++ b/tests/inheritance/1.0/Android.mk
@@ -0,0 +1,186 @@
+# This file is autogenerated by hidl-gen. Do not edit manually.
+
+LOCAL_PATH := $(call my-dir)
+
+################################################################################
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := android.hardware.tests.inheritance@1.0-java
+LOCAL_MODULE_CLASS := JAVA_LIBRARIES
+
+intermediates := $(local-generated-sources-dir)
+
+HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
+
+#
+# Build IChild.hal
+#
+GEN := $(intermediates)/android/hardware/tests/inheritance/1.0/IChild.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IChild.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IParent.hal
+$(GEN): $(LOCAL_PATH)/IParent.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.tests.inheritance@1.0::IChild
+
+$(GEN): $(LOCAL_PATH)/IChild.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build IFetcher.hal
+#
+GEN := $(intermediates)/android/hardware/tests/inheritance/1.0/IFetcher.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IFetcher.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IChild.hal
+$(GEN): $(LOCAL_PATH)/IChild.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IGrandparent.hal
+$(GEN): $(LOCAL_PATH)/IGrandparent.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IParent.hal
+$(GEN): $(LOCAL_PATH)/IParent.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.tests.inheritance@1.0::IFetcher
+
+$(GEN): $(LOCAL_PATH)/IFetcher.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build IGrandparent.hal
+#
+GEN := $(intermediates)/android/hardware/tests/inheritance/1.0/IGrandparent.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IGrandparent.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.tests.inheritance@1.0::IGrandparent
+
+$(GEN): $(LOCAL_PATH)/IGrandparent.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build IParent.hal
+#
+GEN := $(intermediates)/android/hardware/tests/inheritance/1.0/IParent.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IParent.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IGrandparent.hal
+$(GEN): $(LOCAL_PATH)/IGrandparent.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.tests.inheritance@1.0::IParent
+
+$(GEN): $(LOCAL_PATH)/IParent.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+include $(BUILD_JAVA_LIBRARY)
+
+
+################################################################################
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := android.hardware.tests.inheritance@1.0-java-static
+LOCAL_MODULE_CLASS := JAVA_LIBRARIES
+
+intermediates := $(local-generated-sources-dir)
+
+HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
+
+#
+# Build IChild.hal
+#
+GEN := $(intermediates)/android/hardware/tests/inheritance/1.0/IChild.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IChild.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IParent.hal
+$(GEN): $(LOCAL_PATH)/IParent.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.tests.inheritance@1.0::IChild
+
+$(GEN): $(LOCAL_PATH)/IChild.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build IFetcher.hal
+#
+GEN := $(intermediates)/android/hardware/tests/inheritance/1.0/IFetcher.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IFetcher.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IChild.hal
+$(GEN): $(LOCAL_PATH)/IChild.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IGrandparent.hal
+$(GEN): $(LOCAL_PATH)/IGrandparent.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IParent.hal
+$(GEN): $(LOCAL_PATH)/IParent.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.tests.inheritance@1.0::IFetcher
+
+$(GEN): $(LOCAL_PATH)/IFetcher.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build IGrandparent.hal
+#
+GEN := $(intermediates)/android/hardware/tests/inheritance/1.0/IGrandparent.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IGrandparent.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.tests.inheritance@1.0::IGrandparent
+
+$(GEN): $(LOCAL_PATH)/IGrandparent.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build IParent.hal
+#
+GEN := $(intermediates)/android/hardware/tests/inheritance/1.0/IParent.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IParent.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IGrandparent.hal
+$(GEN): $(LOCAL_PATH)/IGrandparent.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.tests.inheritance@1.0::IParent
+
+$(GEN): $(LOCAL_PATH)/IParent.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+include $(BUILD_STATIC_JAVA_LIBRARY)
+
+
+
+include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/tests/inheritance/1.0/IChild.hal b/tests/inheritance/1.0/IChild.hal
new file mode 100644
index 0000000000..160b12ed8e
--- /dev/null
+++ b/tests/inheritance/1.0/IChild.hal
@@ -0,0 +1,22 @@
+/*
+ * 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 android.hardware.tests.inheritance@1.0;
+import IParent;
+
+interface IChild extends IParent {
+ doChild();
+};
diff --git a/tests/inheritance/1.0/IFetcher.hal b/tests/inheritance/1.0/IFetcher.hal
new file mode 100644
index 0000000000..3df63dff38
--- /dev/null
+++ b/tests/inheritance/1.0/IFetcher.hal
@@ -0,0 +1,28 @@
+/*
+ * 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 android.hardware.tests.inheritance@1.0;
+
+import IGrandparent;
+import IParent;
+import IChild;
+
+interface IFetcher {
+
+ getGrandparent(bool sendRemote) generates (IGrandparent parent);
+ getParent(bool sendRemote) generates (IParent parent);
+ getChild(bool sendRemote) generates (IChild child);
+};
diff --git a/tests/inheritance/1.0/IGrandparent.hal b/tests/inheritance/1.0/IGrandparent.hal
new file mode 100644
index 0000000000..59339c6917
--- /dev/null
+++ b/tests/inheritance/1.0/IGrandparent.hal
@@ -0,0 +1,21 @@
+/*
+ * 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 android.hardware.tests.inheritance@1.0;
+
+interface IGrandparent {
+ doGrandparent();
+};
diff --git a/tests/inheritance/1.0/IParent.hal b/tests/inheritance/1.0/IParent.hal
new file mode 100644
index 0000000000..2abb2e39ef
--- /dev/null
+++ b/tests/inheritance/1.0/IParent.hal
@@ -0,0 +1,23 @@
+/*
+ * 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 android.hardware.tests.inheritance@1.0;
+
+import IGrandparent;
+
+interface IParent extends IGrandparent {
+ doParent();
+};
diff --git a/tests/inheritance/1.0/default/Android.bp b/tests/inheritance/1.0/default/Android.bp
new file mode 100644
index 0000000000..d97bd83003
--- /dev/null
+++ b/tests/inheritance/1.0/default/Android.bp
@@ -0,0 +1,21 @@
+
+
+cc_library_shared {
+ name: "android.hardware.tests.inheritance@1.0-impl",
+ relative_install_path: "hw",
+ srcs: [
+ "Fetcher.cpp",
+ "Parent.cpp",
+ "Child.cpp",
+ ],
+
+ shared_libs: [
+ "libbase",
+ "libhidl",
+ "libhwbinder",
+ "liblog",
+ "libutils",
+ "android.hardware.tests.inheritance@1.0",
+ ],
+
+}
diff --git a/tests/inheritance/1.0/default/Child.cpp b/tests/inheritance/1.0/default/Child.cpp
new file mode 100644
index 0000000000..66720b3c1f
--- /dev/null
+++ b/tests/inheritance/1.0/default/Child.cpp
@@ -0,0 +1,42 @@
+#define LOG_TAG "hidl_test"
+#include <android-base/logging.h>
+
+#include "Child.h"
+
+namespace android {
+namespace hardware {
+namespace tests {
+namespace inheritance {
+namespace V1_0 {
+namespace implementation {
+
+// Methods from ::android::hardware::tests::inheritance::V1_0::IGrandparent follow.
+Return<void> Child::doGrandparent() {
+ ALOGI("SERVER(Bar) Child::doGrandparent");
+ return Void();
+}
+
+// Methods from ::android::hardware::tests::inheritance::V1_0::IParent follow.
+Return<void> Child::doParent() {
+ ALOGI("SERVER(Bar) Child::doParent");
+ return Void();
+}
+
+
+// Methods from ::android::hardware::tests::inheritance::V1_0::IChild follow.
+Return<void> Child::doChild() {
+ ALOGI("SERVER(Bar) Child::doChild");
+ return Void();
+}
+
+
+IChild* HIDL_FETCH_IChild(const char* /* name */) {
+ return new Child();
+}
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace inheritance
+} // namespace tests
+} // namespace hardware
+} // namespace android
diff --git a/tests/inheritance/1.0/default/Child.h b/tests/inheritance/1.0/default/Child.h
new file mode 100644
index 0000000000..0d34e83736
--- /dev/null
+++ b/tests/inheritance/1.0/default/Child.h
@@ -0,0 +1,44 @@
+#ifndef HIDL_GENERATED_android_hardware_tests_inheritance_V1_0_Child_H_
+#define HIDL_GENERATED_android_hardware_tests_inheritance_V1_0_Child_H_
+
+#include <android/hardware/tests/inheritance/1.0/IChild.h>
+#include <hidl/Status.h>
+
+#include <hidl/MQDescriptor.h>
+namespace android {
+namespace hardware {
+namespace tests {
+namespace inheritance {
+namespace V1_0 {
+namespace implementation {
+
+using ::android::hardware::tests::inheritance::V1_0::IParent;
+using ::android::hardware::tests::inheritance::V1_0::IChild;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::hidl_string;
+using ::android::sp;
+
+struct Child : public IChild {
+ // Methods from ::android::hardware::tests::inheritance::V1_0::IGrandparent follow.
+ Return<void> doGrandparent() override;
+
+ // Methods from ::android::hardware::tests::inheritance::V1_0::IParent follow.
+ Return<void> doParent() override;
+
+ // Methods from ::android::hardware::tests::inheritance::V1_0::IChild follow.
+ Return<void> doChild() override;
+
+};
+
+extern "C" IChild* HIDL_FETCH_IChild(const char* name);
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace inheritance
+} // namespace tests
+} // namespace hardware
+} // namespace android
+
+#endif // HIDL_GENERATED_android_hardware_tests_inheritance_V1_0_Child_H_
diff --git a/tests/inheritance/1.0/default/Fetcher.cpp b/tests/inheritance/1.0/default/Fetcher.cpp
new file mode 100644
index 0000000000..28dffaa793
--- /dev/null
+++ b/tests/inheritance/1.0/default/Fetcher.cpp
@@ -0,0 +1,58 @@
+
+#define LOG_TAG "hidl_test"
+
+#include "Fetcher.h"
+#include <android-base/logging.h>
+#include <inttypes.h>
+
+namespace android {
+namespace hardware {
+namespace tests {
+namespace inheritance {
+namespace V1_0 {
+namespace implementation {
+
+Fetcher::Fetcher() {
+ mPrecious = IChild::getService("local child", true);
+ CHECK(!mPrecious->isRemote());
+}
+
+template <typename CB>
+Return<void> selectService(bool sendRemote, CB &_hidl_cb, sp<IChild> &local) {
+ sp<IChild> toSend;
+ if (sendRemote) {
+ toSend = IChild::getService("child");
+ if (!toSend->isRemote()) {
+ return Status::fromExceptionCode(Status::EX_ILLEGAL_STATE);
+ }
+ } else {
+ toSend = local;
+ }
+ ALOGI("SERVER(Fetcher) selectService returning %p", toSend.get());
+ _hidl_cb(toSend);
+ return Void();
+}
+
+// Methods from ::android::hardware::tests::inheritance::V1_0::IFetcher follow.
+Return<void> Fetcher::getGrandparent(bool sendRemote, getGrandparent_cb _hidl_cb) {
+ return selectService(sendRemote, _hidl_cb, mPrecious);
+}
+
+Return<void> Fetcher::getParent(bool sendRemote, getParent_cb _hidl_cb) {
+ return selectService(sendRemote, _hidl_cb, mPrecious);
+}
+
+Return<void> Fetcher::getChild(bool sendRemote, getChild_cb _hidl_cb) {
+ return selectService(sendRemote, _hidl_cb, mPrecious);
+}
+
+IFetcher* HIDL_FETCH_IFetcher(const char* /* name */) {
+ return new Fetcher();
+}
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace inheritance
+} // namespace tests
+} // namespace hardware
+} // namespace android
diff --git a/tests/inheritance/1.0/default/Fetcher.h b/tests/inheritance/1.0/default/Fetcher.h
new file mode 100644
index 0000000000..d38985329e
--- /dev/null
+++ b/tests/inheritance/1.0/default/Fetcher.h
@@ -0,0 +1,45 @@
+#ifndef HIDL_GENERATED_android_hardware_tests_inheritance_V1_0_Fetcher_H_
+#define HIDL_GENERATED_android_hardware_tests_inheritance_V1_0_Fetcher_H_
+
+#include "Child.h"
+#include <android/hardware/tests/inheritance/1.0/IFetcher.h>
+#include <hidl/Status.h>
+
+#include <hidl/MQDescriptor.h>
+namespace android {
+namespace hardware {
+namespace tests {
+namespace inheritance {
+namespace V1_0 {
+namespace implementation {
+
+using ::android::hardware::tests::inheritance::V1_0::IFetcher;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::hidl_string;
+using ::android::sp;
+
+struct Fetcher : public IFetcher {
+
+ Fetcher();
+
+ // Methods from ::android::hardware::tests::inheritance::V1_0::IFetcher follow.
+ Return<void> getGrandparent(bool sendRemote, getGrandparent_cb _hidl_cb) override;
+ Return<void> getParent(bool sendRemote, getParent_cb _hidl_cb) override;
+ Return<void> getChild(bool sendRemote, getChild_cb _hidl_cb) override;
+
+private:
+ sp<IChild> mPrecious;
+};
+
+extern "C" IFetcher* HIDL_FETCH_IFetcher(const char* name);
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace inheritance
+} // namespace tests
+} // namespace hardware
+} // namespace android
+
+#endif // HIDL_GENERATED_android_hardware_tests_inheritance_V1_0_Fetcher_H_
diff --git a/tests/inheritance/1.0/default/Grandparent.cpp b/tests/inheritance/1.0/default/Grandparent.cpp
new file mode 100644
index 0000000000..c53dc87201
--- /dev/null
+++ b/tests/inheritance/1.0/default/Grandparent.cpp
@@ -0,0 +1,29 @@
+#define LOG_TAG "hidl_test"
+#include <android-base/logging.h>
+
+#include "Grandparent.h"
+
+namespace android {
+namespace hardware {
+namespace tests {
+namespace inheritance {
+namespace V1_0 {
+namespace implementation {
+
+// Methods from ::android::hardware::tests::inheritance::V1_0::IGrandparent follow.
+Return<void> Grandparent::doGrandparent() {
+ ALOGI("SERVER(Bar) Grandparent::doGrandparent");
+ return Void();
+}
+
+
+IGrandparent* HIDL_FETCH_IGrandparent(const char* /* name */) {
+ return new Grandparent();
+}
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace inheritance
+} // namespace tests
+} // namespace hardware
+} // namespace android
diff --git a/tests/inheritance/1.0/default/Grandparent.h b/tests/inheritance/1.0/default/Grandparent.h
new file mode 100644
index 0000000000..e1113bf904
--- /dev/null
+++ b/tests/inheritance/1.0/default/Grandparent.h
@@ -0,0 +1,37 @@
+#ifndef HIDL_GENERATED_android_hardware_tests_inheritance_V1_0_Grandparent_H_
+#define HIDL_GENERATED_android_hardware_tests_inheritance_V1_0_Grandparent_H_
+
+#include <android/hardware/tests/inheritance/1.0/IGrandparent.h>
+#include <hidl/Status.h>
+
+#include <hidl/MQDescriptor.h>
+namespace android {
+namespace hardware {
+namespace tests {
+namespace inheritance {
+namespace V1_0 {
+namespace implementation {
+
+using ::android::hardware::tests::inheritance::V1_0::IGrandparent;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::hidl_string;
+using ::android::sp;
+
+struct Grandparent : public IGrandparent {
+ // Methods from ::android::hardware::tests::inheritance::V1_0::IGrandparent follow.
+ Return<void> doGrandparent() override;
+
+};
+
+extern "C" IGrandparent* HIDL_FETCH_IGrandparent(const char* name);
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace inheritance
+} // namespace tests
+} // namespace hardware
+} // namespace android
+
+#endif // HIDL_GENERATED_android_hardware_tests_inheritance_V1_0_Grandparent_H_
diff --git a/tests/inheritance/1.0/default/Parent.cpp b/tests/inheritance/1.0/default/Parent.cpp
new file mode 100644
index 0000000000..bdd20c9539
--- /dev/null
+++ b/tests/inheritance/1.0/default/Parent.cpp
@@ -0,0 +1,35 @@
+#define LOG_TAG "hidl_test"
+#include <android-base/logging.h>
+
+#include "Parent.h"
+
+namespace android {
+namespace hardware {
+namespace tests {
+namespace inheritance {
+namespace V1_0 {
+namespace implementation {
+
+// Methods from ::android::hardware::tests::inheritance::V1_0::IGrandparent follow.
+Return<void> Parent::doGrandparent() {
+ ALOGI("SERVER(Bar) Parent::doGrandparent");
+ return Void();
+}
+
+// Methods from ::android::hardware::tests::inheritance::V1_0::IParent follow.
+Return<void> Parent::doParent() {
+ ALOGI("SERVER(Bar) Parent::doParent");
+ return Void();
+}
+
+
+IParent* HIDL_FETCH_IParent(const char* /* name */) {
+ return new Parent();
+}
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace inheritance
+} // namespace tests
+} // namespace hardware
+} // namespace android
diff --git a/tests/inheritance/1.0/default/Parent.h b/tests/inheritance/1.0/default/Parent.h
new file mode 100644
index 0000000000..2e07fdcff4
--- /dev/null
+++ b/tests/inheritance/1.0/default/Parent.h
@@ -0,0 +1,40 @@
+#ifndef HIDL_GENERATED_android_hardware_tests_inheritance_V1_0_Parent_H_
+#define HIDL_GENERATED_android_hardware_tests_inheritance_V1_0_Parent_H_
+
+#include <android/hardware/tests/inheritance/1.0/IParent.h>
+#include <hidl/Status.h>
+
+#include <hidl/MQDescriptor.h>
+namespace android {
+namespace hardware {
+namespace tests {
+namespace inheritance {
+namespace V1_0 {
+namespace implementation {
+
+using ::android::hardware::tests::inheritance::V1_0::IParent;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::hidl_string;
+using ::android::sp;
+
+struct Parent : public IParent {
+ // Methods from ::android::hardware::tests::inheritance::V1_0::IGrandparent follow.
+ Return<void> doGrandparent() override;
+
+ // Methods from ::android::hardware::tests::inheritance::V1_0::IParent follow.
+ Return<void> doParent() override;
+
+};
+
+extern "C" IParent* HIDL_FETCH_IParent(const char* name);
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace inheritance
+} // namespace tests
+} // namespace hardware
+} // namespace android
+
+#endif // HIDL_GENERATED_android_hardware_tests_inheritance_V1_0_Parent_H_