Merge "Add implementation for hwbinder benchmark service."
diff --git a/benchmarks/msgq/1.0/Android.bp b/benchmarks/msgq/1.0/Android.bp
index 51841c2..b222cfb 100644
--- a/benchmarks/msgq/1.0/Android.bp
+++ b/benchmarks/msgq/1.0/Android.bp
@@ -39,4 +39,9 @@
         "libutils",
         "libcutils",
     ],
+export_shared_lib_headers: [
+    "libhidl",
+    "libhwbinder",
+    "libutils",
+    ],
 }
diff --git a/bluetooth/1.0/Android.bp b/bluetooth/1.0/Android.bp
index c5f898d..ef7f109 100644
--- a/bluetooth/1.0/Android.bp
+++ b/bluetooth/1.0/Android.bp
@@ -51,4 +51,9 @@
         "libutils",
         "libcutils",
     ],
+export_shared_lib_headers: [
+    "libhidl",
+    "libhwbinder",
+    "libutils",
+    ],
 }
diff --git a/boot/1.0/Android.bp b/boot/1.0/Android.bp
index 98341ef..dc30038 100644
--- a/boot/1.0/Android.bp
+++ b/boot/1.0/Android.bp
@@ -43,4 +43,9 @@
         "libutils",
         "libcutils",
     ],
+export_shared_lib_headers: [
+    "libhidl",
+    "libhwbinder",
+    "libutils",
+    ],
 }
diff --git a/nfc/1.0/Android.bp b/nfc/1.0/Android.bp
index d9f197e..2b8f3af 100644
--- a/nfc/1.0/Android.bp
+++ b/nfc/1.0/Android.bp
@@ -51,4 +51,9 @@
         "libutils",
         "libcutils",
     ],
+export_shared_lib_headers: [
+    "libhidl",
+    "libhwbinder",
+    "libutils",
+    ],
 }
diff --git a/radio/1.0/Android.bp b/radio/1.0/Android.bp
index 682e12c..34eaf33 100644
--- a/radio/1.0/Android.bp
+++ b/radio/1.0/Android.bp
@@ -51,4 +51,9 @@
         "libutils",
         "libcutils",
     ],
+export_shared_lib_headers: [
+    "libhidl",
+    "libhwbinder",
+    "libutils",
+    ],
 }
diff --git a/tests/bar/1.0/Android.bp b/tests/bar/1.0/Android.bp
index 617b08f..06db6d0 100644
--- a/tests/bar/1.0/Android.bp
+++ b/tests/bar/1.0/Android.bp
@@ -48,4 +48,9 @@
         "libcutils",
         "android.hardware.tests.foo@1.0",
     ],
+export_shared_lib_headers: [
+    "libhidl",
+    "libhwbinder",
+    "libutils",
+    ],
 }
diff --git a/tests/bar/1.0/default/Bar.cpp b/tests/bar/1.0/default/Bar.cpp
index 4433802..34ec087 100644
--- a/tests/bar/1.0/default/Bar.cpp
+++ b/tests/bar/1.0/default/Bar.cpp
@@ -21,10 +21,6 @@
     return mFoo->doThis(param);
 }
 
-Return<void> Bar::doThis(uint32_t param) {
-    return mFoo->doThis(param);
-}
-
 Return<int32_t> Bar::doThatAndReturnSomething(
         int64_t param) {
     return mFoo->doThatAndReturnSomething(param);
@@ -118,6 +114,22 @@
     return mFoo->sendVecVec(_hidl_cb);
 }
 
+Return<void> Bar::haveAVectorOfInterfaces(
+        const hidl_vec<sp<ISimple> > &in,
+        haveAVectorOfInterfaces_cb _hidl_cb) {
+    _hidl_cb(in);
+
+    return Void();
+}
+
+Return<void> Bar::haveAVectorOfGenericInterfaces(
+        const hidl_vec<sp<android::hardware::IBinder> > &in,
+        haveAVectorOfGenericInterfaces_cb _hidl_cb) {
+    _hidl_cb(in);
+
+    return Void();
+}
+
 // 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 58d9f9a..d2c2635 100644
--- a/tests/bar/1.0/default/Bar.h
+++ b/tests/bar/1.0/default/Bar.h
@@ -16,6 +16,7 @@
 using ::android::hardware::tests::foo::V1_0::Abc;
 using ::android::hardware::tests::foo::V1_0::IFoo;
 using ::android::hardware::tests::foo::V1_0::IFooCallback;
+using ::android::hardware::tests::foo::V1_0::ISimple;
 using ::android::hardware::Return;
 using ::android::hardware::Void;
 using ::android::hardware::hidl_vec;
@@ -28,7 +29,6 @@
 
     // Methods from ::android::hardware::tests::foo::V1_0::IFoo follow.
     virtual Return<void> doThis(float param)  override;
-    virtual Return<void> doThis(uint32_t param)  override;
     virtual Return<int32_t> doThatAndReturnSomething(int64_t param)  override;
     virtual Return<double> doQuiteABit(int32_t a, int64_t b, float c, double d)  override;
     virtual Return<void> doSomethingElse(const hidl_array<int32_t, 15 /* 15 */>& param, doSomethingElse_cb _hidl_cb)  override;
@@ -49,6 +49,14 @@
     virtual Return<void> sendVec(const hidl_vec<uint8_t>& data, sendVec_cb _hidl_cb)  override;
     virtual Return<void> sendVecVec(sendVecVec_cb _hidl_cb)  override;
 
+    Return<void> haveAVectorOfInterfaces(
+            const hidl_vec<sp<ISimple> > &in,
+            haveAVectorOfInterfaces_cb _hidl_cb) override;
+
+    Return<void> haveAVectorOfGenericInterfaces(
+            const hidl_vec<sp<android::hardware::IBinder> > &in,
+            haveAVectorOfGenericInterfaces_cb _hidl_cb) override;
+
     // Methods from ::android::hardware::tests::bar::V1_0::IBar follow.
     Return<void> thisIsNew()  override;
 
diff --git a/tests/baz/1.0/Android.bp b/tests/baz/1.0/Android.bp
index d3eefe5..64a8803 100644
--- a/tests/baz/1.0/Android.bp
+++ b/tests/baz/1.0/Android.bp
@@ -59,4 +59,9 @@
         "libutils",
         "libcutils",
     ],
+export_shared_lib_headers: [
+    "libhidl",
+    "libhwbinder",
+    "libutils",
+    ],
 }
diff --git a/tests/expression/1.0/Android.bp b/tests/expression/1.0/Android.bp
index 32d4682..2ad94fa 100644
--- a/tests/expression/1.0/Android.bp
+++ b/tests/expression/1.0/Android.bp
@@ -47,4 +47,9 @@
         "libutils",
         "libcutils",
     ],
+export_shared_lib_headers: [
+    "libhidl",
+    "libhwbinder",
+    "libutils",
+    ],
 }
diff --git a/tests/foo/1.0/Android.bp b/tests/foo/1.0/Android.bp
index 1fbb7bd..96133ac 100644
--- a/tests/foo/1.0/Android.bp
+++ b/tests/foo/1.0/Android.bp
@@ -9,6 +9,7 @@
         "IFoo.hal",
         "IFooCallback.hal",
         "IMyTypes.hal",
+        "ISimple.hal",
         "ITheirTypes.hal",
     ],
     out: [
@@ -16,6 +17,7 @@
         "android/hardware/tests/foo/1.0/FooAll.cpp",
         "android/hardware/tests/foo/1.0/FooCallbackAll.cpp",
         "android/hardware/tests/foo/1.0/MyTypesAll.cpp",
+        "android/hardware/tests/foo/1.0/SimpleAll.cpp",
         "android/hardware/tests/foo/1.0/TheirTypesAll.cpp",
     ],
 }
@@ -29,6 +31,7 @@
         "IFoo.hal",
         "IFooCallback.hal",
         "IMyTypes.hal",
+        "ISimple.hal",
         "ITheirTypes.hal",
     ],
     out: [
@@ -48,6 +51,11 @@
         "android/hardware/tests/foo/1.0/BnMyTypes.h",
         "android/hardware/tests/foo/1.0/BpMyTypes.h",
         "android/hardware/tests/foo/1.0/BsMyTypes.h",
+        "android/hardware/tests/foo/1.0/ISimple.h",
+        "android/hardware/tests/foo/1.0/IHwSimple.h",
+        "android/hardware/tests/foo/1.0/BnSimple.h",
+        "android/hardware/tests/foo/1.0/BpSimple.h",
+        "android/hardware/tests/foo/1.0/BsSimple.h",
         "android/hardware/tests/foo/1.0/ITheirTypes.h",
         "android/hardware/tests/foo/1.0/IHwTheirTypes.h",
         "android/hardware/tests/foo/1.0/BnTheirTypes.h",
@@ -67,4 +75,9 @@
         "libutils",
         "libcutils",
     ],
+export_shared_lib_headers: [
+    "libhidl",
+    "libhwbinder",
+    "libutils",
+    ],
 }
diff --git a/tests/foo/1.0/IFoo.hal b/tests/foo/1.0/IFoo.hal
index 614f1e4..2afaec1 100644
--- a/tests/foo/1.0/IFoo.hal
+++ b/tests/foo/1.0/IFoo.hal
@@ -18,6 +18,7 @@
 
 import IFooCallback;
 import IMyTypes.SomeStruct;
+import ISimple;
 import ITheirTypes.FloatArray;
 
 interface IFoo {
@@ -80,7 +81,6 @@
     };
 
     doThis(float param);
-    doThis(uint32_t param);
     doThatAndReturnSomething(int64_t param) generates (int32_t result);
     doQuiteABit(int32_t a, int64_t b, float c, double d) generates (double something);
     doSomethingElse(int32_t[15] param) generates (int32_t[32] something);
@@ -107,4 +107,9 @@
     sendVec(vec<uint8_t> data) generates (vec<uint8_t> data);
 
     sendVecVec() generates (vec<vec<uint8_t>> vecvec);
+
+    haveAVectorOfInterfaces(vec<ISimple> in) generates (vec<ISimple> out);
+
+    haveAVectorOfGenericInterfaces(vec<interface> in)
+        generates (vec<interface> out);
 };
diff --git a/tests/foo/1.0/ISimple.hal b/tests/foo/1.0/ISimple.hal
new file mode 100644
index 0000000..92e9d95
--- /dev/null
+++ b/tests/foo/1.0/ISimple.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.foo@1.0;
+
+interface ISimple {
+    getCookie() generates (int32_t cookie);
+};
diff --git a/tests/foo/1.0/default/Android.bp b/tests/foo/1.0/default/Android.bp
index a2acd14..90295a9 100644
--- a/tests/foo/1.0/default/Android.bp
+++ b/tests/foo/1.0/default/Android.bp
@@ -6,8 +6,6 @@
     srcs: [
         "Foo.cpp",
         "FooCallback.cpp",
-        "MyTypes.cpp",
-        "TheirTypes.cpp",
     ],
 
     shared_libs: [
diff --git a/tests/foo/1.0/default/Foo.cpp b/tests/foo/1.0/default/Foo.cpp
index 81aa78b..cadb151 100644
--- a/tests/foo/1.0/default/Foo.cpp
+++ b/tests/foo/1.0/default/Foo.cpp
@@ -21,11 +21,6 @@
     return Void();
 }
 
-Return<void> Foo::doThis(uint32_t param) {
-    ALOGI("SERVER(Foo) doThis (int) (%d)", param);
-    return Void();
-}
-
 Return<int32_t> Foo::doThatAndReturnSomething(
         int64_t param) {
     LOG(INFO) << "SERVER(Foo) doThatAndReturnSomething(" << param << ")";
@@ -396,6 +391,21 @@
     return Void();
 }
 
+Return<void> Foo::haveAVectorOfInterfaces(
+        const hidl_vec<sp<ISimple> > &in,
+        haveAVectorOfInterfaces_cb _hidl_cb) {
+    _hidl_cb(in);
+
+    return Void();
+}
+
+Return<void> Foo::haveAVectorOfGenericInterfaces(
+        const hidl_vec<sp<android::hardware::IBinder> > &in,
+        haveAVectorOfGenericInterfaces_cb _hidl_cb) {
+    _hidl_cb(in);
+
+    return Void();
+}
 
 IFoo* HIDL_FETCH_IFoo(const char* /* name */) {
     return new Foo();
diff --git a/tests/foo/1.0/default/Foo.h b/tests/foo/1.0/default/Foo.h
index 00a29f5..b3785d2 100644
--- a/tests/foo/1.0/default/Foo.h
+++ b/tests/foo/1.0/default/Foo.h
@@ -15,6 +15,7 @@
 using ::android::hardware::tests::foo::V1_0::Abc;
 using ::android::hardware::tests::foo::V1_0::IFoo;
 using ::android::hardware::tests::foo::V1_0::IFooCallback;
+using ::android::hardware::tests::foo::V1_0::ISimple;
 using ::android::hardware::Return;
 using ::android::hardware::Void;
 using ::android::hardware::hidl_vec;
@@ -24,7 +25,6 @@
 struct Foo : public IFoo {
     // Methods from ::android::hardware::tests::foo::V1_0::IFoo follow.
     virtual Return<void> doThis(float param)  override;
-    virtual Return<void> doThis(uint32_t param)  override;
     virtual Return<int32_t> doThatAndReturnSomething(int64_t param)  override;
     virtual Return<double> doQuiteABit(int32_t a, int64_t b, float c, double d)  override;
     virtual Return<void> doSomethingElse(const hidl_array<int32_t, 15 /* 15 */>& param, doSomethingElse_cb _hidl_cb)  override;
@@ -45,6 +45,13 @@
     virtual Return<void> sendVec(const hidl_vec<uint8_t>& data, sendVec_cb _hidl_cb)  override;
     virtual Return<void> sendVecVec(sendVecVec_cb _hidl_cb)  override;
 
+    Return<void> haveAVectorOfInterfaces(
+            const hidl_vec<sp<ISimple> > &in,
+            haveAVectorOfInterfaces_cb _hidl_cb) override;
+
+    Return<void> haveAVectorOfGenericInterfaces(
+            const hidl_vec<sp<android::hardware::IBinder> > &in,
+            haveAVectorOfGenericInterfaces_cb _hidl_cb) override;
 };
 
 extern "C" IFoo* HIDL_FETCH_IFoo(const char* name);
diff --git a/tests/foo/1.0/default/MyTypes.cpp b/tests/foo/1.0/default/MyTypes.cpp
deleted file mode 100644
index 0d1a458..0000000
--- a/tests/foo/1.0/default/MyTypes.cpp
+++ /dev/null
@@ -1,21 +0,0 @@
-#include "MyTypes.h"
-
-namespace android {
-namespace hardware {
-namespace tests {
-namespace foo {
-namespace V1_0 {
-namespace implementation {
-
-// Methods from ::android::hardware::tests::foo::V1_0::IMyTypes follow.
-
-IMyTypes* HIDL_FETCH_IMyTypes(const char* /* name */) {
-    return new MyTypes();
-}
-
-} // namespace implementation
-}  // namespace V1_0
-}  // namespace foo
-}  // namespace tests
-}  // namespace hardware
-}  // namespace android
diff --git a/tests/foo/1.0/default/MyTypes.h b/tests/foo/1.0/default/MyTypes.h
deleted file mode 100644
index 6e9a3e1..0000000
--- a/tests/foo/1.0/default/MyTypes.h
+++ /dev/null
@@ -1,36 +0,0 @@
-#ifndef HIDL_GENERATED_android_hardware_tests_foo_V1_0_MyTypes_H_
-#define HIDL_GENERATED_android_hardware_tests_foo_V1_0_MyTypes_H_
-
-#include <android/hardware/tests/foo/1.0/IMyTypes.h>
-#include <hidl/Status.h>
-
-#include <hidl/MQDescriptor.h>
-namespace android {
-namespace hardware {
-namespace tests {
-namespace foo {
-namespace V1_0 {
-namespace implementation {
-
-using ::android::hardware::tests::foo::V1_0::IMyTypes;
-using ::android::hardware::Return;
-using ::android::hardware::Void;
-using ::android::hardware::hidl_vec;
-using ::android::hardware::hidl_string;
-using ::android::sp;
-
-struct MyTypes : public IMyTypes {
-    // Methods from ::android::hardware::tests::foo::V1_0::IMyTypes follow.
-
-};
-
-extern "C" IMyTypes* HIDL_FETCH_IMyTypes(const char* name);
-
-}  // namespace implementation
-}  // namespace V1_0
-}  // namespace foo
-}  // namespace tests
-}  // namespace hardware
-}  // namespace android
-
-#endif  // HIDL_GENERATED_android_hardware_tests_foo_V1_0_MyTypes_H_
diff --git a/tests/foo/1.0/default/TheirTypes.cpp b/tests/foo/1.0/default/TheirTypes.cpp
deleted file mode 100644
index 0f678f0..0000000
--- a/tests/foo/1.0/default/TheirTypes.cpp
+++ /dev/null
@@ -1,21 +0,0 @@
-#include "TheirTypes.h"
-
-namespace android {
-namespace hardware {
-namespace tests {
-namespace foo {
-namespace V1_0 {
-namespace implementation {
-
-// Methods from ::android::hardware::tests::foo::V1_0::ITheirTypes follow.
-
-ITheirTypes* HIDL_FETCH_ITheirTypes(const char* /* name */) {
-    return new TheirTypes();
-}
-
-} // namespace implementation
-}  // namespace V1_0
-}  // namespace foo
-}  // namespace tests
-}  // namespace hardware
-}  // namespace android
diff --git a/tests/foo/1.0/default/TheirTypes.h b/tests/foo/1.0/default/TheirTypes.h
deleted file mode 100644
index 24ade70..0000000
--- a/tests/foo/1.0/default/TheirTypes.h
+++ /dev/null
@@ -1,36 +0,0 @@
-#ifndef HIDL_GENERATED_android_hardware_tests_foo_V1_0_TheirTypes_H_
-#define HIDL_GENERATED_android_hardware_tests_foo_V1_0_TheirTypes_H_
-
-#include <android/hardware/tests/foo/1.0/ITheirTypes.h>
-#include <hidl/Status.h>
-
-#include <hidl/MQDescriptor.h>
-namespace android {
-namespace hardware {
-namespace tests {
-namespace foo {
-namespace V1_0 {
-namespace implementation {
-
-using ::android::hardware::tests::foo::V1_0::ITheirTypes;
-using ::android::hardware::Return;
-using ::android::hardware::Void;
-using ::android::hardware::hidl_vec;
-using ::android::hardware::hidl_string;
-using ::android::sp;
-
-struct TheirTypes : public ITheirTypes {
-    // Methods from ::android::hardware::tests::foo::V1_0::ITheirTypes follow.
-
-};
-
-extern "C" ITheirTypes* HIDL_FETCH_ITheirTypes(const char* name);
-
-}  // namespace implementation
-}  // namespace V1_0
-}  // namespace foo
-}  // namespace tests
-}  // namespace hardware
-}  // namespace android
-
-#endif  // HIDL_GENERATED_android_hardware_tests_foo_V1_0_TheirTypes_H_
diff --git a/tests/libhwbinder/1.0/Android.bp b/tests/libhwbinder/1.0/Android.bp
index 508de22..52a8186 100644
--- a/tests/libhwbinder/1.0/Android.bp
+++ b/tests/libhwbinder/1.0/Android.bp
@@ -39,4 +39,9 @@
         "libutils",
         "libcutils",
     ],
+export_shared_lib_headers: [
+    "libhidl",
+    "libhwbinder",
+    "libutils",
+    ],
 }
diff --git a/tests/msgq/1.0/Android.bp b/tests/msgq/1.0/Android.bp
index 16454ec..58ee3d4 100644
--- a/tests/msgq/1.0/Android.bp
+++ b/tests/msgq/1.0/Android.bp
@@ -39,4 +39,9 @@
         "libutils",
         "libcutils",
     ],
+export_shared_lib_headers: [
+    "libhidl",
+    "libhwbinder",
+    "libutils",
+    ],
 }
diff --git a/tests/pointer/1.0/Android.bp b/tests/pointer/1.0/Android.bp
index 45659d7..2601a5b 100644
--- a/tests/pointer/1.0/Android.bp
+++ b/tests/pointer/1.0/Android.bp
@@ -47,4 +47,9 @@
         "libutils",
         "libcutils",
     ],
+export_shared_lib_headers: [
+    "libhidl",
+    "libhwbinder",
+    "libutils",
+    ],
 }
diff --git a/wifi/1.0/Android.bp b/wifi/1.0/Android.bp
index 59ad2c5..504da7b 100644
--- a/wifi/1.0/Android.bp
+++ b/wifi/1.0/Android.bp
@@ -115,4 +115,9 @@
         "libutils",
         "libcutils",
     ],
+export_shared_lib_headers: [
+    "libhidl",
+    "libhwbinder",
+    "libutils",
+    ],
 }
diff --git a/wifi/1.0/default/service.cpp b/wifi/1.0/default/service.cpp
index 10ce1db..751e8f6 100644
--- a/wifi/1.0/default/service.cpp
+++ b/wifi/1.0/default/service.cpp
@@ -15,7 +15,6 @@
  */
 
 #include <android-base/logging.h>
-#include <hidl/IServiceManager.h>
 #include <hwbinder/IPCThreadState.h>
 #include <hwbinder/ProcessState.h>
 #include <utils/Looper.h>
diff --git a/wifi/supplicant/1.0/Android.bp b/wifi/supplicant/1.0/Android.bp
index 6b4ca84..a60179d 100644
--- a/wifi/supplicant/1.0/Android.bp
+++ b/wifi/supplicant/1.0/Android.bp
@@ -83,4 +83,9 @@
         "libutils",
         "libcutils",
     ],
+export_shared_lib_headers: [
+    "libhidl",
+    "libhwbinder",
+    "libutils",
+    ],
 }