Loading tests/safeunion/1.0/Android.bp +1 −7 Original line number Diff line number Diff line Loading @@ -4,18 +4,12 @@ hidl_interface { name: "android.hardware.tests.safeunion@1.0", root: "android.hardware", srcs: [ "types.hal", "IOtherInterface.hal", "ISafeUnion.hal", ], interfaces: [ "android.hidl.base@1.0", ], types: [ "EmptySafeUnion", "SmallSafeUnion", "LargeSafeUnion", "MiscTypesSafeUnion", ], gen_java: false, } tests/safeunion/1.0/types.hal→tests/safeunion/1.0/IOtherInterface.hal +21 −0 Original line number Diff line number Diff line Loading @@ -16,52 +16,6 @@ package android.hardware.tests.safeunion@1.0; enum BitField : uint8_t { V0 = 1 << 0, V1 = 1 << 1, V2 = 1 << 2, V3 = 1 << 3, }; struct J { vec<uint32_t> j1; uint8_t[65] j2; string j3; }; safe_union EmptySafeUnion { }; safe_union SmallSafeUnion { uint8_t a; }; safe_union LargeSafeUnion { int8_t a; uint16_t b; int32_t c; uint64_t d; int8_t[13] e; int64_t[5] f; string g; vec<bool> h; vec<uint64_t> i; J j; struct K { uint8_t k1; uint64_t k2; } k; SmallSafeUnion l; }; // TODO(b/110269925): Test more HIDL types. Missing: // death_recipient, fmq_{sync,unsync}, pointer, ref. safe_union MiscTypesSafeUnion { memory a; handle b; bitfield<BitField> c; interface IOtherInterface { concatTwoStrings(string a, string b) generates (string result); }; tests/safeunion/1.0/ISafeUnion.hal +65 −1 Original line number Diff line number Diff line Loading @@ -16,7 +16,66 @@ package android.hardware.tests.safeunion@1.0; import IOtherInterface; interface ISafeUnion { enum BitField : uint8_t { V0 = 1 << 0, V1 = 1 << 1, V2 = 1 << 2, V3 = 1 << 3, }; struct J { vec<uint32_t> j1; uint8_t[65] j2; string j3; }; safe_union EmptySafeUnion { }; safe_union SmallSafeUnion { uint8_t a; }; safe_union LargeSafeUnion { int8_t a; uint16_t b; int32_t c; uint64_t d; int8_t[13] e; int64_t[5] f; string g; vec<bool> h; vec<uint64_t> i; J j; struct K { uint8_t k1; uint64_t k2; } k; SmallSafeUnion l; }; // TODO(b/110269925): Test more HIDL types. Missing: // death_recipient, fmq_{sync,unsync}, pointer, ref. safe_union MiscTypesSafeUnion { memory a; handle b; bitfield<BitField> c; }; safe_union InterfaceTypeSafeUnion { uint32_t a; int8_t[7] b; IOtherInterface c; }; newLargeSafeUnion() generates (LargeSafeUnion myUnion); setA(LargeSafeUnion myUnion, int8_t a) generates (LargeSafeUnion myUnion); setB(LargeSafeUnion myUnion, uint16_t b) generates (LargeSafeUnion myUnion); Loading @@ -28,11 +87,16 @@ interface ISafeUnion { setH(LargeSafeUnion myUnion, vec<bool> h) generates (LargeSafeUnion myUnion); setI(LargeSafeUnion myUnion, vec<uint64_t> i) generates (LargeSafeUnion myUnion); setJ(LargeSafeUnion myUnion, J j) generates (LargeSafeUnion myUnion); setK(LargeSafeUnion myUnion, K k) generates (LargeSafeUnion myUnion); setK(LargeSafeUnion myUnion, LargeSafeUnion.K k) generates (LargeSafeUnion myUnion); setL(LargeSafeUnion myUnion, SmallSafeUnion l) generates (LargeSafeUnion myUnion); newMiscTypesSafeUnion() generates (MiscTypesSafeUnion myUnion); setMiscA(MiscTypesSafeUnion myUnion, memory a) generates (MiscTypesSafeUnion myUnion); setMiscB(MiscTypesSafeUnion myUnion, handle b) generates (MiscTypesSafeUnion myUnion); setMiscC(MiscTypesSafeUnion myUnion, bitfield<BitField> c) generates (MiscTypesSafeUnion myUnion); newInterfaceTypeSafeUnion() generates (InterfaceTypeSafeUnion myUnion); 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); }; tests/safeunion/1.0/default/SafeUnion.cpp +48 −11 Original line number Diff line number Diff line Loading @@ -73,7 +73,7 @@ Return<void> SafeUnion::setD(const LargeSafeUnion& myUnion, uint64_t d, setD_cb return Void(); } Return<void> SafeUnion::setE(const ::android::hardware::tests::safeunion::V1_0::LargeSafeUnion& myUnion, const hidl_array<int8_t, 13>& e, setE_cb _hidl_cb) { Return<void> SafeUnion::setE(const LargeSafeUnion& myUnion, const hidl_array<int8_t, 13>& e, setE_cb _hidl_cb) { LOG(INFO) << "SERVER(SafeUnion) setE(myUnion, " << toString(e) << ")"; LargeSafeUnion myNewUnion = myUnion; Loading @@ -83,7 +83,7 @@ Return<void> SafeUnion::setE(const ::android::hardware::tests::safeunion::V1_0:: return Void(); } Return<void> SafeUnion::setF(const ::android::hardware::tests::safeunion::V1_0::LargeSafeUnion& myUnion, const hidl_array<int64_t, 5>& f, setF_cb _hidl_cb) { Return<void> SafeUnion::setF(const LargeSafeUnion& myUnion, const hidl_array<int64_t, 5>& f, setF_cb _hidl_cb) { LOG(INFO) << "SERVER(SafeUnion) setF(myUnion, " << toString(f) << ")"; LargeSafeUnion myNewUnion = myUnion; Loading @@ -93,7 +93,7 @@ Return<void> SafeUnion::setF(const ::android::hardware::tests::safeunion::V1_0:: return Void(); } Return<void> SafeUnion::setG(const ::android::hardware::tests::safeunion::V1_0::LargeSafeUnion& myUnion, const hidl_string& g, setG_cb _hidl_cb) { Return<void> SafeUnion::setG(const LargeSafeUnion& myUnion, const hidl_string& g, setG_cb _hidl_cb) { LOG(INFO) << "SERVER(SafeUnion) setG(myUnion, " << toString(g) << ")"; LargeSafeUnion myNewUnion = myUnion; Loading @@ -103,7 +103,7 @@ Return<void> SafeUnion::setG(const ::android::hardware::tests::safeunion::V1_0:: return Void(); } Return<void> SafeUnion::setH(const ::android::hardware::tests::safeunion::V1_0::LargeSafeUnion& myUnion, const hidl_vec<bool>& h, setH_cb _hidl_cb) { Return<void> SafeUnion::setH(const LargeSafeUnion& myUnion, const hidl_vec<bool>& h, setH_cb _hidl_cb) { LOG(INFO) << "SERVER(SafeUnion) setH(myUnion, " << toString(h) << ")"; LargeSafeUnion myNewUnion = myUnion; Loading @@ -113,7 +113,7 @@ Return<void> SafeUnion::setH(const ::android::hardware::tests::safeunion::V1_0:: return Void(); } Return<void> SafeUnion::setI(const ::android::hardware::tests::safeunion::V1_0::LargeSafeUnion& myUnion, const hidl_vec<uint64_t>& i, setI_cb _hidl_cb) { Return<void> SafeUnion::setI(const LargeSafeUnion& myUnion, const hidl_vec<uint64_t>& i, setI_cb _hidl_cb) { LOG(INFO) << "SERVER(SafeUnion) setI(myUnion, " << toString(i) << ")"; LargeSafeUnion myNewUnion = myUnion; Loading @@ -123,7 +123,7 @@ Return<void> SafeUnion::setI(const ::android::hardware::tests::safeunion::V1_0:: return Void(); } Return<void> SafeUnion::setJ(const ::android::hardware::tests::safeunion::V1_0::LargeSafeUnion& myUnion, const J& j, setJ_cb _hidl_cb) { Return<void> SafeUnion::setJ(const LargeSafeUnion& myUnion, const J& j, setJ_cb _hidl_cb) { LOG(INFO) << "SERVER(SafeUnion) setJ(myUnion, " << toString(j) << ")"; LargeSafeUnion myNewUnion = myUnion; Loading @@ -133,7 +133,7 @@ Return<void> SafeUnion::setJ(const ::android::hardware::tests::safeunion::V1_0:: return Void(); } Return<void> SafeUnion::setK(const ::android::hardware::tests::safeunion::V1_0::LargeSafeUnion& myUnion, const LargeSafeUnion::K& k, setK_cb _hidl_cb) { Return<void> SafeUnion::setK(const LargeSafeUnion& myUnion, const LargeSafeUnion::K& k, setK_cb _hidl_cb) { LOG(INFO) << "SERVER(SafeUnion) setK(myUnion, " << toString(k) << ")"; LargeSafeUnion myNewUnion = myUnion; Loading @@ -143,7 +143,7 @@ Return<void> SafeUnion::setK(const ::android::hardware::tests::safeunion::V1_0:: return Void(); } Return<void> SafeUnion::setL(const ::android::hardware::tests::safeunion::V1_0::LargeSafeUnion& myUnion, const ::android::hardware::tests::safeunion::V1_0::SmallSafeUnion& l, setL_cb _hidl_cb) { Return<void> SafeUnion::setL(const LargeSafeUnion& myUnion, const SmallSafeUnion& l, setL_cb _hidl_cb) { LOG(INFO) << "SERVER(SafeUnion) setL(myUnion, " << toString(l) << ")"; LargeSafeUnion myNewUnion = myUnion; Loading @@ -161,7 +161,7 @@ Return<void> SafeUnion::newMiscTypesSafeUnion(newMiscTypesSafeUnion_cb _hidl_cb) return Void(); } Return<void> SafeUnion::setMiscA(const ::android::hardware::tests::safeunion::V1_0::MiscTypesSafeUnion& myUnion, const hidl_memory& a, setMiscA_cb _hidl_cb) { Return<void> SafeUnion::setMiscA(const MiscTypesSafeUnion& myUnion, const hidl_memory& a, setMiscA_cb _hidl_cb) { LOG(INFO) << "SERVER(SafeUnion) setMiscA(myUnion, " << toString(a) << ")"; MiscTypesSafeUnion myNewUnion = myUnion; Loading @@ -171,7 +171,7 @@ Return<void> SafeUnion::setMiscA(const ::android::hardware::tests::safeunion::V1 return Void(); } Return<void> SafeUnion::setMiscB(const ::android::hardware::tests::safeunion::V1_0::MiscTypesSafeUnion& myUnion, const hidl_handle& b, setMiscB_cb _hidl_cb) { Return<void> SafeUnion::setMiscB(const MiscTypesSafeUnion& myUnion, const hidl_handle& b, setMiscB_cb _hidl_cb) { LOG(INFO) << "SERVER(SafeUnion) setMiscB(myUnion, " << toString(b) << ")"; MiscTypesSafeUnion myNewUnion = myUnion; Loading @@ -181,7 +181,7 @@ Return<void> SafeUnion::setMiscB(const ::android::hardware::tests::safeunion::V1 return Void(); } Return<void> SafeUnion::setMiscC(const ::android::hardware::tests::safeunion::V1_0::MiscTypesSafeUnion& myUnion, hidl_bitfield<BitField> c, setMiscC_cb _hidl_cb) { Return<void> SafeUnion::setMiscC(const MiscTypesSafeUnion& myUnion, hidl_bitfield<BitField> c, setMiscC_cb _hidl_cb) { LOG(INFO) << "SERVER(SafeUnion) setMiscC(myUnion, " << c << ")"; MiscTypesSafeUnion myNewUnion = myUnion; Loading @@ -191,6 +191,43 @@ Return<void> SafeUnion::setMiscC(const ::android::hardware::tests::safeunion::V1 return Void(); } Return<void> SafeUnion::newInterfaceTypeSafeUnion(newInterfaceTypeSafeUnion_cb _hidl_cb) { LOG(INFO) << "SERVER(SafeUnion) newInterfaceTypeSafeUnion()"; InterfaceTypeSafeUnion ret; _hidl_cb(ret); return Void(); } Return<void> SafeUnion::setInterfaceA(const InterfaceTypeSafeUnion& myUnion, uint32_t a, setInterfaceA_cb _hidl_cb) { LOG(INFO) << "SERVER(SafeUnion) setInterfaceA(myUnion, " << a << ")"; InterfaceTypeSafeUnion myNewUnion = myUnion; myNewUnion.a(a); _hidl_cb(myNewUnion); return Void(); } Return<void> SafeUnion::setInterfaceB(const InterfaceTypeSafeUnion& myUnion, const hidl_array<int8_t, 7>& b, setInterfaceB_cb _hidl_cb) { LOG(INFO) << "SERVER(SafeUnion) setInterfaceB(myUnion, " << toString(b) << ")"; InterfaceTypeSafeUnion myNewUnion = myUnion; myNewUnion.b(b); _hidl_cb(myNewUnion); return Void(); } Return<void> SafeUnion::setInterfaceC(const InterfaceTypeSafeUnion& myUnion, const sp<::android::hardware::tests::safeunion::V1_0::IOtherInterface>& c, setInterfaceC_cb _hidl_cb) { LOG(INFO) << "SERVER(SafeUnion) setInterfaceC(myUnion, " << toString(c) << ")"; InterfaceTypeSafeUnion myNewUnion = myUnion; myNewUnion.c(c); _hidl_cb(myNewUnion); return Void(); } ISafeUnion* HIDL_FETCH_ISafeUnion(const char* /* name */) { return new SafeUnion(); Loading tests/safeunion/1.0/default/SafeUnion.h +9 −6 Original line number Diff line number Diff line Loading @@ -30,9 +30,7 @@ namespace implementation { using ::android::hardware::Return; using ::android::hardware::Void; using ::android::hardware::tests::safeunion::V1_0::SmallSafeUnion; using ::android::hardware::tests::safeunion::V1_0::LargeSafeUnion; using ::android::hardware::tests::safeunion::V1_0::MiscTypesSafeUnion; using ::android::hardware::tests::safeunion::V1_0::ISafeUnion; struct SafeUnion : public ISafeUnion { // Methods from ::android::hardware::tests::safeunion::V1_0::ISafeUnion follow. Loading @@ -51,9 +49,14 @@ struct SafeUnion : public ISafeUnion { Return<void> setL(const LargeSafeUnion& myUnion, const SmallSafeUnion& l, setL_cb _hidl_cb) override; Return<void> newMiscTypesSafeUnion(newMiscTypesSafeUnion_cb _hidl_cb) override; Return<void> setMiscA(const ::android::hardware::tests::safeunion::V1_0::MiscTypesSafeUnion& myUnion, const hidl_memory& a, setMiscA_cb _hidl_cb) override; Return<void> setMiscB(const ::android::hardware::tests::safeunion::V1_0::MiscTypesSafeUnion& myUnion, const hidl_handle& b, setMiscB_cb _hidl_cb) override; Return<void> setMiscC(const ::android::hardware::tests::safeunion::V1_0::MiscTypesSafeUnion& myUnion, hidl_bitfield<BitField> c, setMiscC_cb _hidl_cb) override; Return<void> setMiscA(const MiscTypesSafeUnion& myUnion, const hidl_memory& a, setMiscA_cb _hidl_cb) override; Return<void> setMiscB(const MiscTypesSafeUnion& myUnion, const hidl_handle& b, setMiscB_cb _hidl_cb) override; Return<void> setMiscC(const MiscTypesSafeUnion& myUnion, hidl_bitfield<BitField> c, setMiscC_cb _hidl_cb) override; Return<void> newInterfaceTypeSafeUnion(newInterfaceTypeSafeUnion_cb _hidl_cb) override; 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; }; extern "C" ISafeUnion* HIDL_FETCH_ISafeUnion(const char* name); Loading Loading
tests/safeunion/1.0/Android.bp +1 −7 Original line number Diff line number Diff line Loading @@ -4,18 +4,12 @@ hidl_interface { name: "android.hardware.tests.safeunion@1.0", root: "android.hardware", srcs: [ "types.hal", "IOtherInterface.hal", "ISafeUnion.hal", ], interfaces: [ "android.hidl.base@1.0", ], types: [ "EmptySafeUnion", "SmallSafeUnion", "LargeSafeUnion", "MiscTypesSafeUnion", ], gen_java: false, }
tests/safeunion/1.0/types.hal→tests/safeunion/1.0/IOtherInterface.hal +21 −0 Original line number Diff line number Diff line Loading @@ -16,52 +16,6 @@ package android.hardware.tests.safeunion@1.0; enum BitField : uint8_t { V0 = 1 << 0, V1 = 1 << 1, V2 = 1 << 2, V3 = 1 << 3, }; struct J { vec<uint32_t> j1; uint8_t[65] j2; string j3; }; safe_union EmptySafeUnion { }; safe_union SmallSafeUnion { uint8_t a; }; safe_union LargeSafeUnion { int8_t a; uint16_t b; int32_t c; uint64_t d; int8_t[13] e; int64_t[5] f; string g; vec<bool> h; vec<uint64_t> i; J j; struct K { uint8_t k1; uint64_t k2; } k; SmallSafeUnion l; }; // TODO(b/110269925): Test more HIDL types. Missing: // death_recipient, fmq_{sync,unsync}, pointer, ref. safe_union MiscTypesSafeUnion { memory a; handle b; bitfield<BitField> c; interface IOtherInterface { concatTwoStrings(string a, string b) generates (string result); };
tests/safeunion/1.0/ISafeUnion.hal +65 −1 Original line number Diff line number Diff line Loading @@ -16,7 +16,66 @@ package android.hardware.tests.safeunion@1.0; import IOtherInterface; interface ISafeUnion { enum BitField : uint8_t { V0 = 1 << 0, V1 = 1 << 1, V2 = 1 << 2, V3 = 1 << 3, }; struct J { vec<uint32_t> j1; uint8_t[65] j2; string j3; }; safe_union EmptySafeUnion { }; safe_union SmallSafeUnion { uint8_t a; }; safe_union LargeSafeUnion { int8_t a; uint16_t b; int32_t c; uint64_t d; int8_t[13] e; int64_t[5] f; string g; vec<bool> h; vec<uint64_t> i; J j; struct K { uint8_t k1; uint64_t k2; } k; SmallSafeUnion l; }; // TODO(b/110269925): Test more HIDL types. Missing: // death_recipient, fmq_{sync,unsync}, pointer, ref. safe_union MiscTypesSafeUnion { memory a; handle b; bitfield<BitField> c; }; safe_union InterfaceTypeSafeUnion { uint32_t a; int8_t[7] b; IOtherInterface c; }; newLargeSafeUnion() generates (LargeSafeUnion myUnion); setA(LargeSafeUnion myUnion, int8_t a) generates (LargeSafeUnion myUnion); setB(LargeSafeUnion myUnion, uint16_t b) generates (LargeSafeUnion myUnion); Loading @@ -28,11 +87,16 @@ interface ISafeUnion { setH(LargeSafeUnion myUnion, vec<bool> h) generates (LargeSafeUnion myUnion); setI(LargeSafeUnion myUnion, vec<uint64_t> i) generates (LargeSafeUnion myUnion); setJ(LargeSafeUnion myUnion, J j) generates (LargeSafeUnion myUnion); setK(LargeSafeUnion myUnion, K k) generates (LargeSafeUnion myUnion); setK(LargeSafeUnion myUnion, LargeSafeUnion.K k) generates (LargeSafeUnion myUnion); setL(LargeSafeUnion myUnion, SmallSafeUnion l) generates (LargeSafeUnion myUnion); newMiscTypesSafeUnion() generates (MiscTypesSafeUnion myUnion); setMiscA(MiscTypesSafeUnion myUnion, memory a) generates (MiscTypesSafeUnion myUnion); setMiscB(MiscTypesSafeUnion myUnion, handle b) generates (MiscTypesSafeUnion myUnion); setMiscC(MiscTypesSafeUnion myUnion, bitfield<BitField> c) generates (MiscTypesSafeUnion myUnion); newInterfaceTypeSafeUnion() generates (InterfaceTypeSafeUnion myUnion); 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); };
tests/safeunion/1.0/default/SafeUnion.cpp +48 −11 Original line number Diff line number Diff line Loading @@ -73,7 +73,7 @@ Return<void> SafeUnion::setD(const LargeSafeUnion& myUnion, uint64_t d, setD_cb return Void(); } Return<void> SafeUnion::setE(const ::android::hardware::tests::safeunion::V1_0::LargeSafeUnion& myUnion, const hidl_array<int8_t, 13>& e, setE_cb _hidl_cb) { Return<void> SafeUnion::setE(const LargeSafeUnion& myUnion, const hidl_array<int8_t, 13>& e, setE_cb _hidl_cb) { LOG(INFO) << "SERVER(SafeUnion) setE(myUnion, " << toString(e) << ")"; LargeSafeUnion myNewUnion = myUnion; Loading @@ -83,7 +83,7 @@ Return<void> SafeUnion::setE(const ::android::hardware::tests::safeunion::V1_0:: return Void(); } Return<void> SafeUnion::setF(const ::android::hardware::tests::safeunion::V1_0::LargeSafeUnion& myUnion, const hidl_array<int64_t, 5>& f, setF_cb _hidl_cb) { Return<void> SafeUnion::setF(const LargeSafeUnion& myUnion, const hidl_array<int64_t, 5>& f, setF_cb _hidl_cb) { LOG(INFO) << "SERVER(SafeUnion) setF(myUnion, " << toString(f) << ")"; LargeSafeUnion myNewUnion = myUnion; Loading @@ -93,7 +93,7 @@ Return<void> SafeUnion::setF(const ::android::hardware::tests::safeunion::V1_0:: return Void(); } Return<void> SafeUnion::setG(const ::android::hardware::tests::safeunion::V1_0::LargeSafeUnion& myUnion, const hidl_string& g, setG_cb _hidl_cb) { Return<void> SafeUnion::setG(const LargeSafeUnion& myUnion, const hidl_string& g, setG_cb _hidl_cb) { LOG(INFO) << "SERVER(SafeUnion) setG(myUnion, " << toString(g) << ")"; LargeSafeUnion myNewUnion = myUnion; Loading @@ -103,7 +103,7 @@ Return<void> SafeUnion::setG(const ::android::hardware::tests::safeunion::V1_0:: return Void(); } Return<void> SafeUnion::setH(const ::android::hardware::tests::safeunion::V1_0::LargeSafeUnion& myUnion, const hidl_vec<bool>& h, setH_cb _hidl_cb) { Return<void> SafeUnion::setH(const LargeSafeUnion& myUnion, const hidl_vec<bool>& h, setH_cb _hidl_cb) { LOG(INFO) << "SERVER(SafeUnion) setH(myUnion, " << toString(h) << ")"; LargeSafeUnion myNewUnion = myUnion; Loading @@ -113,7 +113,7 @@ Return<void> SafeUnion::setH(const ::android::hardware::tests::safeunion::V1_0:: return Void(); } Return<void> SafeUnion::setI(const ::android::hardware::tests::safeunion::V1_0::LargeSafeUnion& myUnion, const hidl_vec<uint64_t>& i, setI_cb _hidl_cb) { Return<void> SafeUnion::setI(const LargeSafeUnion& myUnion, const hidl_vec<uint64_t>& i, setI_cb _hidl_cb) { LOG(INFO) << "SERVER(SafeUnion) setI(myUnion, " << toString(i) << ")"; LargeSafeUnion myNewUnion = myUnion; Loading @@ -123,7 +123,7 @@ Return<void> SafeUnion::setI(const ::android::hardware::tests::safeunion::V1_0:: return Void(); } Return<void> SafeUnion::setJ(const ::android::hardware::tests::safeunion::V1_0::LargeSafeUnion& myUnion, const J& j, setJ_cb _hidl_cb) { Return<void> SafeUnion::setJ(const LargeSafeUnion& myUnion, const J& j, setJ_cb _hidl_cb) { LOG(INFO) << "SERVER(SafeUnion) setJ(myUnion, " << toString(j) << ")"; LargeSafeUnion myNewUnion = myUnion; Loading @@ -133,7 +133,7 @@ Return<void> SafeUnion::setJ(const ::android::hardware::tests::safeunion::V1_0:: return Void(); } Return<void> SafeUnion::setK(const ::android::hardware::tests::safeunion::V1_0::LargeSafeUnion& myUnion, const LargeSafeUnion::K& k, setK_cb _hidl_cb) { Return<void> SafeUnion::setK(const LargeSafeUnion& myUnion, const LargeSafeUnion::K& k, setK_cb _hidl_cb) { LOG(INFO) << "SERVER(SafeUnion) setK(myUnion, " << toString(k) << ")"; LargeSafeUnion myNewUnion = myUnion; Loading @@ -143,7 +143,7 @@ Return<void> SafeUnion::setK(const ::android::hardware::tests::safeunion::V1_0:: return Void(); } Return<void> SafeUnion::setL(const ::android::hardware::tests::safeunion::V1_0::LargeSafeUnion& myUnion, const ::android::hardware::tests::safeunion::V1_0::SmallSafeUnion& l, setL_cb _hidl_cb) { Return<void> SafeUnion::setL(const LargeSafeUnion& myUnion, const SmallSafeUnion& l, setL_cb _hidl_cb) { LOG(INFO) << "SERVER(SafeUnion) setL(myUnion, " << toString(l) << ")"; LargeSafeUnion myNewUnion = myUnion; Loading @@ -161,7 +161,7 @@ Return<void> SafeUnion::newMiscTypesSafeUnion(newMiscTypesSafeUnion_cb _hidl_cb) return Void(); } Return<void> SafeUnion::setMiscA(const ::android::hardware::tests::safeunion::V1_0::MiscTypesSafeUnion& myUnion, const hidl_memory& a, setMiscA_cb _hidl_cb) { Return<void> SafeUnion::setMiscA(const MiscTypesSafeUnion& myUnion, const hidl_memory& a, setMiscA_cb _hidl_cb) { LOG(INFO) << "SERVER(SafeUnion) setMiscA(myUnion, " << toString(a) << ")"; MiscTypesSafeUnion myNewUnion = myUnion; Loading @@ -171,7 +171,7 @@ Return<void> SafeUnion::setMiscA(const ::android::hardware::tests::safeunion::V1 return Void(); } Return<void> SafeUnion::setMiscB(const ::android::hardware::tests::safeunion::V1_0::MiscTypesSafeUnion& myUnion, const hidl_handle& b, setMiscB_cb _hidl_cb) { Return<void> SafeUnion::setMiscB(const MiscTypesSafeUnion& myUnion, const hidl_handle& b, setMiscB_cb _hidl_cb) { LOG(INFO) << "SERVER(SafeUnion) setMiscB(myUnion, " << toString(b) << ")"; MiscTypesSafeUnion myNewUnion = myUnion; Loading @@ -181,7 +181,7 @@ Return<void> SafeUnion::setMiscB(const ::android::hardware::tests::safeunion::V1 return Void(); } Return<void> SafeUnion::setMiscC(const ::android::hardware::tests::safeunion::V1_0::MiscTypesSafeUnion& myUnion, hidl_bitfield<BitField> c, setMiscC_cb _hidl_cb) { Return<void> SafeUnion::setMiscC(const MiscTypesSafeUnion& myUnion, hidl_bitfield<BitField> c, setMiscC_cb _hidl_cb) { LOG(INFO) << "SERVER(SafeUnion) setMiscC(myUnion, " << c << ")"; MiscTypesSafeUnion myNewUnion = myUnion; Loading @@ -191,6 +191,43 @@ Return<void> SafeUnion::setMiscC(const ::android::hardware::tests::safeunion::V1 return Void(); } Return<void> SafeUnion::newInterfaceTypeSafeUnion(newInterfaceTypeSafeUnion_cb _hidl_cb) { LOG(INFO) << "SERVER(SafeUnion) newInterfaceTypeSafeUnion()"; InterfaceTypeSafeUnion ret; _hidl_cb(ret); return Void(); } Return<void> SafeUnion::setInterfaceA(const InterfaceTypeSafeUnion& myUnion, uint32_t a, setInterfaceA_cb _hidl_cb) { LOG(INFO) << "SERVER(SafeUnion) setInterfaceA(myUnion, " << a << ")"; InterfaceTypeSafeUnion myNewUnion = myUnion; myNewUnion.a(a); _hidl_cb(myNewUnion); return Void(); } Return<void> SafeUnion::setInterfaceB(const InterfaceTypeSafeUnion& myUnion, const hidl_array<int8_t, 7>& b, setInterfaceB_cb _hidl_cb) { LOG(INFO) << "SERVER(SafeUnion) setInterfaceB(myUnion, " << toString(b) << ")"; InterfaceTypeSafeUnion myNewUnion = myUnion; myNewUnion.b(b); _hidl_cb(myNewUnion); return Void(); } Return<void> SafeUnion::setInterfaceC(const InterfaceTypeSafeUnion& myUnion, const sp<::android::hardware::tests::safeunion::V1_0::IOtherInterface>& c, setInterfaceC_cb _hidl_cb) { LOG(INFO) << "SERVER(SafeUnion) setInterfaceC(myUnion, " << toString(c) << ")"; InterfaceTypeSafeUnion myNewUnion = myUnion; myNewUnion.c(c); _hidl_cb(myNewUnion); return Void(); } ISafeUnion* HIDL_FETCH_ISafeUnion(const char* /* name */) { return new SafeUnion(); Loading
tests/safeunion/1.0/default/SafeUnion.h +9 −6 Original line number Diff line number Diff line Loading @@ -30,9 +30,7 @@ namespace implementation { using ::android::hardware::Return; using ::android::hardware::Void; using ::android::hardware::tests::safeunion::V1_0::SmallSafeUnion; using ::android::hardware::tests::safeunion::V1_0::LargeSafeUnion; using ::android::hardware::tests::safeunion::V1_0::MiscTypesSafeUnion; using ::android::hardware::tests::safeunion::V1_0::ISafeUnion; struct SafeUnion : public ISafeUnion { // Methods from ::android::hardware::tests::safeunion::V1_0::ISafeUnion follow. Loading @@ -51,9 +49,14 @@ struct SafeUnion : public ISafeUnion { Return<void> setL(const LargeSafeUnion& myUnion, const SmallSafeUnion& l, setL_cb _hidl_cb) override; Return<void> newMiscTypesSafeUnion(newMiscTypesSafeUnion_cb _hidl_cb) override; Return<void> setMiscA(const ::android::hardware::tests::safeunion::V1_0::MiscTypesSafeUnion& myUnion, const hidl_memory& a, setMiscA_cb _hidl_cb) override; Return<void> setMiscB(const ::android::hardware::tests::safeunion::V1_0::MiscTypesSafeUnion& myUnion, const hidl_handle& b, setMiscB_cb _hidl_cb) override; Return<void> setMiscC(const ::android::hardware::tests::safeunion::V1_0::MiscTypesSafeUnion& myUnion, hidl_bitfield<BitField> c, setMiscC_cb _hidl_cb) override; Return<void> setMiscA(const MiscTypesSafeUnion& myUnion, const hidl_memory& a, setMiscA_cb _hidl_cb) override; Return<void> setMiscB(const MiscTypesSafeUnion& myUnion, const hidl_handle& b, setMiscB_cb _hidl_cb) override; Return<void> setMiscC(const MiscTypesSafeUnion& myUnion, hidl_bitfield<BitField> c, setMiscC_cb _hidl_cb) override; Return<void> newInterfaceTypeSafeUnion(newInterfaceTypeSafeUnion_cb _hidl_cb) override; 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; }; extern "C" ISafeUnion* HIDL_FETCH_ISafeUnion(const char* name); Loading