Merge "Initial version of BT SAP hal."
diff --git a/nfc/1.0/default/android.hardware.nfc@1.0-service.rc b/nfc/1.0/default/android.hardware.nfc@1.0-service.rc
index 1d42718..7b67577 100644
--- a/nfc/1.0/default/android.hardware.nfc@1.0-service.rc
+++ b/nfc/1.0/default/android.hardware.nfc@1.0-service.rc
@@ -1,4 +1,4 @@
service nfc_hal_service /system/bin/hw/android.hardware.nfc@1.0-service
class hal
user nfc
- group nfc readproc
+ group nfc
diff --git a/tests/Android.bp b/tests/Android.bp
index e9b0148..030576d 100644
--- a/tests/Android.bp
+++ b/tests/Android.bp
@@ -7,6 +7,8 @@
"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/bar/1.0/default/Android.bp b/tests/bar/1.0/default/Android.bp
index 0d47001..c2c2309 100644
--- a/tests/bar/1.0/default/Android.bp
+++ b/tests/bar/1.0/default/Android.bp
@@ -10,6 +10,7 @@
shared_libs: [
"libbase",
+ "libcutils",
"libhidl",
"libhwbinder",
"liblog",
diff --git a/tests/bar/1.0/default/Bar.cpp b/tests/bar/1.0/default/Bar.cpp
index 34ec087..b960524 100644
--- a/tests/bar/1.0/default/Bar.cpp
+++ b/tests/bar/1.0/default/Bar.cpp
@@ -130,6 +130,18 @@
return Void();
}
+Return<void> Bar::createMyHandle(createMyHandle_cb _hidl_cb) {
+ return mFoo->createMyHandle(_hidl_cb);
+}
+
+Return<void> Bar::createHandles(uint32_t size, createHandles_cb _hidl_cb) {
+ return mFoo->createHandles(size, _hidl_cb);
+}
+
+Return<void> Bar::closeHandles() {
+ return mFoo->closeHandles();
+}
+
// Methods from ::android::hardware::tests::bar::V1_0::IBar follow.
Return<void> Bar::thisIsNew() {
ALOGI("SERVER(Bar) thisIsNew");
diff --git a/tests/bar/1.0/default/Bar.h b/tests/bar/1.0/default/Bar.h
index d2c2635..6fea563 100644
--- a/tests/bar/1.0/default/Bar.h
+++ b/tests/bar/1.0/default/Bar.h
@@ -48,6 +48,9 @@
virtual Return<void> transpose2(const hidl_array<hidl_string, 5 /* 5 */, 3 /* 3 */>& in, transpose2_cb _hidl_cb) override;
virtual Return<void> sendVec(const hidl_vec<uint8_t>& data, sendVec_cb _hidl_cb) override;
virtual Return<void> sendVecVec(sendVecVec_cb _hidl_cb) override;
+ virtual Return<void> createMyHandle(createMyHandle_cb _hidl_cb) override;
+ virtual Return<void> createHandles(uint32_t size, createHandles_cb _hidl_cb) override;
+ virtual Return<void> closeHandles() override;
Return<void> haveAVectorOfInterfaces(
const hidl_vec<sp<ISimple> > &in,
diff --git a/tests/foo/1.0/IFoo.hal b/tests/foo/1.0/IFoo.hal
index 2afaec1..c06fc05 100644
--- a/tests/foo/1.0/IFoo.hal
+++ b/tests/foo/1.0/IFoo.hal
@@ -80,6 +80,11 @@
FloatArray myFloatArray;
};
+ struct MyHandle {
+ handle h;
+ int32_t guard;
+ };
+
doThis(float param);
doThatAndReturnSomething(int64_t param) generates (int32_t result);
doQuiteABit(int32_t a, int64_t b, float c, double d) generates (double something);
@@ -112,4 +117,7 @@
haveAVectorOfGenericInterfaces(vec<interface> in)
generates (vec<interface> out);
+ createMyHandle() generates (MyHandle h);
+ createHandles(uint32_t size) generates (vec<handle> handles);
+ closeHandles();
};
diff --git a/tests/foo/1.0/default/Android.bp b/tests/foo/1.0/default/Android.bp
index 185e5ea..f2ee521 100644
--- a/tests/foo/1.0/default/Android.bp
+++ b/tests/foo/1.0/default/Android.bp
@@ -10,6 +10,7 @@
shared_libs: [
"libbase",
+ "libcutils",
"libhidl",
"libfootest",
"libhwbinder",
diff --git a/tests/foo/1.0/default/Foo.cpp b/tests/foo/1.0/default/Foo.cpp
index f855f21..cf4f975 100644
--- a/tests/foo/1.0/default/Foo.cpp
+++ b/tests/foo/1.0/default/Foo.cpp
@@ -291,7 +291,40 @@
const hidl_vec<sp<android::hardware::IBinder> > &in,
haveAVectorOfGenericInterfaces_cb _hidl_cb) {
_hidl_cb(in);
+ return Void();
+}
+Return<void> Foo::createMyHandle(createMyHandle_cb _hidl_cb) {
+ native_handle_t* nh = native_handle_create(0, 10);
+ int data[] = {2,3,5,7,11,13,17,19,21,23};
+ CHECK(sizeof(data) == 10 * sizeof(int));
+ memcpy(nh->data, data, sizeof(data));
+ mHandles.push_back(nh);
+
+ MyHandle h;
+ h.guard = 666;
+ h.h = nh;
+ _hidl_cb(h);
+ return Void();
+}
+
+Return<void> Foo::createHandles(uint32_t size, createHandles_cb _hidl_cb) {
+ hidl_vec<const native_handle_t*> handles;
+ handles.resize(size);
+ for(uint32_t i = 0; i < size; ++i) {
+ createMyHandle([&](const MyHandle& h) {
+ handles[i] = h.h;
+ });
+ }
+ _hidl_cb(handles);
+ return Void();
+}
+
+Return<void> Foo::closeHandles() {
+ for(native_handle_t* h : mHandles) {
+ native_handle_delete(h);
+ }
+ mHandles.clear();
return Void();
}
diff --git a/tests/foo/1.0/default/Foo.h b/tests/foo/1.0/default/Foo.h
index b3785d2..e61291d 100644
--- a/tests/foo/1.0/default/Foo.h
+++ b/tests/foo/1.0/default/Foo.h
@@ -5,6 +5,7 @@
#include <hidl/Status.h>
#include <hidl/MQDescriptor.h>
+#include <vector>
namespace android {
namespace hardware {
namespace tests {
@@ -44,6 +45,9 @@
virtual Return<void> transpose2(const hidl_array<hidl_string, 5 /* 5 */, 3 /* 3 */>& in, transpose2_cb _hidl_cb) override;
virtual Return<void> sendVec(const hidl_vec<uint8_t>& data, sendVec_cb _hidl_cb) override;
virtual Return<void> sendVecVec(sendVecVec_cb _hidl_cb) override;
+ virtual Return<void> createMyHandle(createMyHandle_cb _hidl_cb) override;
+ virtual Return<void> createHandles(uint32_t size, createHandles_cb _hidl_cb) override;
+ virtual Return<void> closeHandles() override;
Return<void> haveAVectorOfInterfaces(
const hidl_vec<sp<ISimple> > &in,
@@ -52,6 +56,8 @@
Return<void> haveAVectorOfGenericInterfaces(
const hidl_vec<sp<android::hardware::IBinder> > &in,
haveAVectorOfGenericInterfaces_cb _hidl_cb) override;
+private:
+ std::vector<::native_handle_t *> mHandles;
};
extern "C" IFoo* HIDL_FETCH_IFoo(const char* name);
diff --git a/tests/inheritance/1.0/Android.bp b/tests/inheritance/1.0/Android.bp
new file mode 100644
index 0000000..e4a3439
--- /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 0000000..34da056
--- /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 0000000..160b12e
--- /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 0000000..3df63df
--- /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 0000000..59339c6
--- /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 0000000..2abb2e3
--- /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 0000000..d97bd83
--- /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 0000000..66720b3
--- /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 0000000..0d34e83
--- /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 0000000..28dffaa
--- /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 0000000..d389853
--- /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 0000000..c53dc87
--- /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 0000000..e1113bf
--- /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 0000000..bdd20c9
--- /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 0000000..2e07fdc
--- /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_