Merge "Adds tests to verify proper marshaling of vectors of interface types." am: 7eb1f89133 am: 3111106524

am: e7d29c81c7

Change-Id: I298c804347d655f96b713f156f58f6a76cf9bc4f
This commit is contained in:
Andreas Huber
2016-10-21 19:08:09 +00:00
committed by android-build-merger
7 changed files with 83 additions and 0 deletions

View File

@@ -118,6 +118,22 @@ Return<void> Bar::sendVecVec(sendVecVec_cb _hidl_cb) {
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");

View File

@@ -16,6 +16,7 @@ using ::android::hardware::tests::bar::V1_0::IBar;
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;
@@ -49,6 +50,14 @@ struct Bar : public IBar {
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;

View File

@@ -9,6 +9,7 @@ genrule {
"IFoo.hal",
"IFooCallback.hal",
"IMyTypes.hal",
"ISimple.hal",
"ITheirTypes.hal",
],
out: [
@@ -16,6 +17,7 @@ genrule {
"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 @@ genrule {
"IFoo.hal",
"IFooCallback.hal",
"IMyTypes.hal",
"ISimple.hal",
"ITheirTypes.hal",
],
out: [
@@ -48,6 +51,11 @@ genrule {
"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",

View File

@@ -18,6 +18,7 @@ package android.hardware.tests.foo@1.0;
import IFooCallback;
import IMyTypes.SomeStruct;
import ISimple;
import ITheirTypes.FloatArray;
interface IFoo {
@@ -107,4 +108,9 @@ interface IFoo {
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);
};

21
tests/foo/1.0/ISimple.hal Normal file
View File

@@ -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);
};

View File

@@ -396,6 +396,21 @@ Return<void> Foo::sendVecVec(sendVecVec_cb _hidl_cb) {
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();

View File

@@ -15,6 +15,7 @@ namespace implementation {
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;
@@ -45,6 +46,13 @@ struct Foo : public IFoo {
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);