From 0534690fa6513e59bf2fc0fe13b91be8b4db05b4 Mon Sep 17 00:00:00 2001 From: Nirav Atre Date: Sat, 7 Jul 2018 19:31:21 -0700 Subject: [PATCH] Make safeunion@1.0 test HAL Java-compatible This change removes Java-incompatible types (memory, handle) from the safeunion@1.0 test HAL. Moving forward, the idea is to keep this HAL Java & C++-friendly, and create another version (likely safeunion@2.0) to regress on C++-only types; tracked by b/110269925. Bug: n/a Test: Ran the existing hidl_test suite Change-Id: Ic7458c3f5b571e77e5f894a9854a2b201f53fe18 --- tests/safeunion/1.0/Android.bp | 2 +- tests/safeunion/1.0/ISafeUnion.hal | 13 -------- tests/safeunion/1.0/default/SafeUnion.cpp | 38 ----------------------- tests/safeunion/1.0/default/SafeUnion.h | 5 --- 4 files changed, 1 insertion(+), 57 deletions(-) diff --git a/tests/safeunion/1.0/Android.bp b/tests/safeunion/1.0/Android.bp index 4c6631ee4f..ede840188a 100644 --- a/tests/safeunion/1.0/Android.bp +++ b/tests/safeunion/1.0/Android.bp @@ -10,6 +10,6 @@ hidl_interface { interfaces: [ "android.hidl.base@1.0", ], - gen_java: false, + gen_java: true, } diff --git a/tests/safeunion/1.0/ISafeUnion.hal b/tests/safeunion/1.0/ISafeUnion.hal index 153d6f4fd4..fedd63b8e9 100644 --- a/tests/safeunion/1.0/ISafeUnion.hal +++ b/tests/safeunion/1.0/ISafeUnion.hal @@ -62,14 +62,6 @@ interface ISafeUnion { 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 c; - }; - safe_union InterfaceTypeSafeUnion { uint32_t a; int8_t[7] b; @@ -90,11 +82,6 @@ interface ISafeUnion { 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 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); diff --git a/tests/safeunion/1.0/default/SafeUnion.cpp b/tests/safeunion/1.0/default/SafeUnion.cpp index 55d20f80ce..7047d16128 100644 --- a/tests/safeunion/1.0/default/SafeUnion.cpp +++ b/tests/safeunion/1.0/default/SafeUnion.cpp @@ -153,44 +153,6 @@ Return SafeUnion::setL(const LargeSafeUnion& myUnion, const SmallSafeUnion return Void(); } -Return SafeUnion::newMiscTypesSafeUnion(newMiscTypesSafeUnion_cb _hidl_cb) { - LOG(INFO) << "SERVER(SafeUnion) newMiscTypesSafeUnion()"; - - MiscTypesSafeUnion ret; - _hidl_cb(ret); - return Void(); -} - -Return SafeUnion::setMiscA(const MiscTypesSafeUnion& myUnion, const hidl_memory& a, setMiscA_cb _hidl_cb) { - LOG(INFO) << "SERVER(SafeUnion) setMiscA(myUnion, " << toString(a) << ")"; - - MiscTypesSafeUnion myNewUnion = myUnion; - myNewUnion.a(a); - - _hidl_cb(myNewUnion); - return Void(); -} - -Return SafeUnion::setMiscB(const MiscTypesSafeUnion& myUnion, const hidl_handle& b, setMiscB_cb _hidl_cb) { - LOG(INFO) << "SERVER(SafeUnion) setMiscB(myUnion, " << toString(b) << ")"; - - MiscTypesSafeUnion myNewUnion = myUnion; - myNewUnion.b(b); - - _hidl_cb(myNewUnion); - return Void(); -} - -Return SafeUnion::setMiscC(const MiscTypesSafeUnion& myUnion, hidl_bitfield c, setMiscC_cb _hidl_cb) { - LOG(INFO) << "SERVER(SafeUnion) setMiscC(myUnion, " << c << ")"; - - MiscTypesSafeUnion myNewUnion = myUnion; - myNewUnion.c(c); - - _hidl_cb(myNewUnion); - return Void(); -} - Return SafeUnion::newInterfaceTypeSafeUnion(newInterfaceTypeSafeUnion_cb _hidl_cb) { LOG(INFO) << "SERVER(SafeUnion) newInterfaceTypeSafeUnion()"; diff --git a/tests/safeunion/1.0/default/SafeUnion.h b/tests/safeunion/1.0/default/SafeUnion.h index e3550b8a22..07d88d23b0 100644 --- a/tests/safeunion/1.0/default/SafeUnion.h +++ b/tests/safeunion/1.0/default/SafeUnion.h @@ -48,11 +48,6 @@ struct SafeUnion : public ISafeUnion { Return setK(const LargeSafeUnion& myUnion, const LargeSafeUnion::K& k, setK_cb _hidl_cb) override; Return setL(const LargeSafeUnion& myUnion, const SmallSafeUnion& l, setL_cb _hidl_cb) override; - Return newMiscTypesSafeUnion(newMiscTypesSafeUnion_cb _hidl_cb) override; - Return setMiscA(const MiscTypesSafeUnion& myUnion, const hidl_memory& a, setMiscA_cb _hidl_cb) override; - Return setMiscB(const MiscTypesSafeUnion& myUnion, const hidl_handle& b, setMiscB_cb _hidl_cb) override; - Return setMiscC(const MiscTypesSafeUnion& myUnion, hidl_bitfield c, setMiscC_cb _hidl_cb) override; - Return newInterfaceTypeSafeUnion(newInterfaceTypeSafeUnion_cb _hidl_cb) override; Return setInterfaceA(const InterfaceTypeSafeUnion& myUnion, uint32_t a, setInterfaceA_cb _hidl_cb) override; Return setInterfaceB(const InterfaceTypeSafeUnion& myUnion, const hidl_array& b, setInterfaceB_cb _hidl_cb) override;