Merge "Updated HALs to test structs/safe_unions containing interfaces"

am: 76b383d5c2

Change-Id: Idbf119111f9d3a1e916b4753bc68aec35638a275
This commit is contained in:
Nirav Atre 2018-07-16 17:16:02 -07:00 committed by android-build-merger
commit 1233e0a7eb
4 changed files with 29 additions and 0 deletions

View file

@ -70,6 +70,9 @@ interface IBaz extends IBase {
struct StructWithInterface {
int32_t number;
int8_t[7] array;
string oneString;
vec<string> vectorOfStrings;
IBase dummy;
};
oneway doThis(float param);

View file

@ -66,6 +66,8 @@ interface ISafeUnion {
uint32_t a;
int8_t[7] b;
IOtherInterface c;
string d;
vec<string> e;
};
newLargeSafeUnion() generates (LargeSafeUnion myUnion);
@ -86,4 +88,6 @@ interface ISafeUnion {
setInterfaceA(InterfaceTypeSafeUnion myUnion, uint32_t a) generates (InterfaceTypeSafeUnion myUnion);
setInterfaceB(InterfaceTypeSafeUnion myUnion, int8_t[7] b) generates (InterfaceTypeSafeUnion myUnion);
setInterfaceC(InterfaceTypeSafeUnion myUnion, IOtherInterface c) generates (InterfaceTypeSafeUnion myUnion);
setInterfaceD(InterfaceTypeSafeUnion myUnion, string d) generates (InterfaceTypeSafeUnion myUnion);
setInterfaceE(InterfaceTypeSafeUnion myUnion, vec<string> e) generates (InterfaceTypeSafeUnion myUnion);
};

View file

@ -191,6 +191,26 @@ Return<void> SafeUnion::setInterfaceC(const InterfaceTypeSafeUnion& myUnion, con
return Void();
}
Return<void> SafeUnion::setInterfaceD(const ::android::hardware::tests::safeunion::V1_0::ISafeUnion::InterfaceTypeSafeUnion& myUnion, const hidl_string& d, setInterfaceD_cb _hidl_cb) {
LOG(INFO) << "SERVER(SafeUnion) setInterfaceD(myUnion, " << toString(d) << ")";
InterfaceTypeSafeUnion myNewUnion = myUnion;
myNewUnion.d(d);
_hidl_cb(myNewUnion);
return Void();
}
Return<void> SafeUnion::setInterfaceE(const ::android::hardware::tests::safeunion::V1_0::ISafeUnion::InterfaceTypeSafeUnion& myUnion, const hidl_vec<hidl_string>& e, setInterfaceE_cb _hidl_cb) {
LOG(INFO) << "SERVER(SafeUnion) setInterfaceE(myUnion, " << toString(e) << ")";
InterfaceTypeSafeUnion myNewUnion = myUnion;
myNewUnion.e(e);
_hidl_cb(myNewUnion);
return Void();
}
ISafeUnion* HIDL_FETCH_ISafeUnion(const char* /* name */) {
return new SafeUnion();
}

View file

@ -52,6 +52,8 @@ struct SafeUnion : public ISafeUnion {
Return<void> setInterfaceA(const InterfaceTypeSafeUnion& myUnion, uint32_t a, setInterfaceA_cb _hidl_cb) override;
Return<void> setInterfaceB(const InterfaceTypeSafeUnion& myUnion, const hidl_array<int8_t, 7>& b, setInterfaceB_cb _hidl_cb) override;
Return<void> setInterfaceC(const InterfaceTypeSafeUnion& myUnion, const sp<::android::hardware::tests::safeunion::V1_0::IOtherInterface>& c, setInterfaceC_cb _hidl_cb) override;
Return<void> setInterfaceD(const InterfaceTypeSafeUnion& myUnion, const hidl_string& d, setInterfaceD_cb _hidl_cb) override;
Return<void> setInterfaceE(const InterfaceTypeSafeUnion& myUnion, const hidl_vec<hidl_string>& e, setInterfaceE_cb _hidl_cb) override;
};
extern "C" ISafeUnion* HIDL_FETCH_ISafeUnion(const char* name);