summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorNirav Atre2018-07-01 15:48:44 -0500
committerNirav Atre2018-07-02 18:21:30 -0500
commit894556cebdac6cb9902b902579f345e9b9c1ca09 (patch)
tree04dd2d315527fccc9d3d78d084a761ccd46ca863 /tests
parent0c3572e2f3bccecf9c03113076508a826f64a6ed (diff)
downloadplatform-hardware-interfaces-894556cebdac6cb9902b902579f345e9b9c1ca09.tar.gz
platform-hardware-interfaces-894556cebdac6cb9902b902579f345e9b9c1ca09.tar.xz
platform-hardware-interfaces-894556cebdac6cb9902b902579f345e9b9c1ca09.zip
Adding HIDL interface type to safeunion test HAL
This change adds a new HIDL safe union, InterfaceTypeSafeUnion (containing an interface+array) to the safeunion test HAL. Bug: 79878527 Bug: 110269925 Test: Existing hidl_test suite passes successfully. Added more test- cases to hidl_test_client.cpp to exercise InterfaceTypeSafeUnion (included in a separate CL). Change-Id: I04ffeeeabccc1dc2651aac9371569c36d37f4f87
Diffstat (limited to 'tests')
-rw-r--r--tests/safeunion/1.0/Android.bp8
-rw-r--r--tests/safeunion/1.0/IOtherInterface.hal21
-rw-r--r--tests/safeunion/1.0/ISafeUnion.hal66
-rw-r--r--tests/safeunion/1.0/default/SafeUnion.cpp59
-rw-r--r--tests/safeunion/1.0/default/SafeUnion.h15
-rw-r--r--tests/safeunion/1.0/types.hal67
6 files changed, 144 insertions, 92 deletions
diff --git a/tests/safeunion/1.0/Android.bp b/tests/safeunion/1.0/Android.bp
index 5082f472..4c6631ee 100644
--- a/tests/safeunion/1.0/Android.bp
+++ b/tests/safeunion/1.0/Android.bp
@@ -4,18 +4,12 @@ hidl_interface {
4 name: "android.hardware.tests.safeunion@1.0", 4 name: "android.hardware.tests.safeunion@1.0",
5 root: "android.hardware", 5 root: "android.hardware",
6 srcs: [ 6 srcs: [
7 "types.hal", 7 "IOtherInterface.hal",
8 "ISafeUnion.hal", 8 "ISafeUnion.hal",
9 ], 9 ],
10 interfaces: [ 10 interfaces: [
11 "android.hidl.base@1.0", 11 "android.hidl.base@1.0",
12 ], 12 ],
13 types: [
14 "EmptySafeUnion",
15 "SmallSafeUnion",
16 "LargeSafeUnion",
17 "MiscTypesSafeUnion",
18 ],
19 gen_java: false, 13 gen_java: false,
20} 14}
21 15
diff --git a/tests/safeunion/1.0/IOtherInterface.hal b/tests/safeunion/1.0/IOtherInterface.hal
new file mode 100644
index 00000000..cdaf8479
--- /dev/null
+++ b/tests/safeunion/1.0/IOtherInterface.hal
@@ -0,0 +1,21 @@
1/*
2 * Copyright (C) 2018 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.hardware.tests.safeunion@1.0;
18
19interface IOtherInterface {
20 concatTwoStrings(string a, string b) generates (string result);
21};
diff --git a/tests/safeunion/1.0/ISafeUnion.hal b/tests/safeunion/1.0/ISafeUnion.hal
index 91d8b8cd..153d6f4f 100644
--- a/tests/safeunion/1.0/ISafeUnion.hal
+++ b/tests/safeunion/1.0/ISafeUnion.hal
@@ -16,7 +16,66 @@
16 16
17package android.hardware.tests.safeunion@1.0; 17package android.hardware.tests.safeunion@1.0;
18 18
19import IOtherInterface;
20
19interface ISafeUnion { 21interface ISafeUnion {
22
23 enum BitField : uint8_t {
24 V0 = 1 << 0,
25 V1 = 1 << 1,
26 V2 = 1 << 2,
27 V3 = 1 << 3,
28 };
29
30 struct J {
31 vec<uint32_t> j1;
32 uint8_t[65] j2;
33 string j3;
34 };
35
36 safe_union EmptySafeUnion {
37 };
38
39 safe_union SmallSafeUnion {
40 uint8_t a;
41 };
42
43 safe_union LargeSafeUnion {
44 int8_t a;
45 uint16_t b;
46 int32_t c;
47 uint64_t d;
48
49 int8_t[13] e;
50 int64_t[5] f;
51
52 string g;
53 vec<bool> h;
54 vec<uint64_t> i;
55
56 J j;
57 struct K {
58 uint8_t k1;
59 uint64_t k2;
60 } k;
61
62 SmallSafeUnion l;
63 };
64
65 // TODO(b/110269925): Test more HIDL types. Missing:
66 // death_recipient, fmq_{sync,unsync}, pointer, ref.
67 safe_union MiscTypesSafeUnion {
68 memory a;
69 handle b;
70 bitfield<BitField> c;
71 };
72
73 safe_union InterfaceTypeSafeUnion {
74 uint32_t a;
75 int8_t[7] b;
76 IOtherInterface c;
77 };
78
20 newLargeSafeUnion() generates (LargeSafeUnion myUnion); 79 newLargeSafeUnion() generates (LargeSafeUnion myUnion);
21 setA(LargeSafeUnion myUnion, int8_t a) generates (LargeSafeUnion myUnion); 80 setA(LargeSafeUnion myUnion, int8_t a) generates (LargeSafeUnion myUnion);
22 setB(LargeSafeUnion myUnion, uint16_t b) generates (LargeSafeUnion myUnion); 81 setB(LargeSafeUnion myUnion, uint16_t b) generates (LargeSafeUnion myUnion);
@@ -28,11 +87,16 @@ interface ISafeUnion {
28 setH(LargeSafeUnion myUnion, vec<bool> h) generates (LargeSafeUnion myUnion); 87 setH(LargeSafeUnion myUnion, vec<bool> h) generates (LargeSafeUnion myUnion);
29 setI(LargeSafeUnion myUnion, vec<uint64_t> i) generates (LargeSafeUnion myUnion); 88 setI(LargeSafeUnion myUnion, vec<uint64_t> i) generates (LargeSafeUnion myUnion);
30 setJ(LargeSafeUnion myUnion, J j) generates (LargeSafeUnion myUnion); 89 setJ(LargeSafeUnion myUnion, J j) generates (LargeSafeUnion myUnion);
31 setK(LargeSafeUnion myUnion, K k) generates (LargeSafeUnion myUnion); 90 setK(LargeSafeUnion myUnion, LargeSafeUnion.K k) generates (LargeSafeUnion myUnion);
32 setL(LargeSafeUnion myUnion, SmallSafeUnion l) generates (LargeSafeUnion myUnion); 91 setL(LargeSafeUnion myUnion, SmallSafeUnion l) generates (LargeSafeUnion myUnion);
33 92
34 newMiscTypesSafeUnion() generates (MiscTypesSafeUnion myUnion); 93 newMiscTypesSafeUnion() generates (MiscTypesSafeUnion myUnion);
35 setMiscA(MiscTypesSafeUnion myUnion, memory a) generates (MiscTypesSafeUnion myUnion); 94 setMiscA(MiscTypesSafeUnion myUnion, memory a) generates (MiscTypesSafeUnion myUnion);
36 setMiscB(MiscTypesSafeUnion myUnion, handle b) generates (MiscTypesSafeUnion myUnion); 95 setMiscB(MiscTypesSafeUnion myUnion, handle b) generates (MiscTypesSafeUnion myUnion);
37 setMiscC(MiscTypesSafeUnion myUnion, bitfield<BitField> c) generates (MiscTypesSafeUnion myUnion); 96 setMiscC(MiscTypesSafeUnion myUnion, bitfield<BitField> c) generates (MiscTypesSafeUnion myUnion);
97
98 newInterfaceTypeSafeUnion() generates (InterfaceTypeSafeUnion myUnion);
99 setInterfaceA(InterfaceTypeSafeUnion myUnion, uint32_t a) generates (InterfaceTypeSafeUnion myUnion);
100 setInterfaceB(InterfaceTypeSafeUnion myUnion, int8_t[7] b) generates (InterfaceTypeSafeUnion myUnion);
101 setInterfaceC(InterfaceTypeSafeUnion myUnion, IOtherInterface c) generates (InterfaceTypeSafeUnion myUnion);
38}; 102};
diff --git a/tests/safeunion/1.0/default/SafeUnion.cpp b/tests/safeunion/1.0/default/SafeUnion.cpp
index d968987f..55d20f80 100644
--- a/tests/safeunion/1.0/default/SafeUnion.cpp
+++ b/tests/safeunion/1.0/default/SafeUnion.cpp
@@ -73,7 +73,7 @@ Return<void> SafeUnion::setD(const LargeSafeUnion& myUnion, uint64_t d, setD_cb
73 return Void(); 73 return Void();
74} 74}
75 75
76Return<void> SafeUnion::setE(const ::android::hardware::tests::safeunion::V1_0::LargeSafeUnion& myUnion, const hidl_array<int8_t, 13>& e, setE_cb _hidl_cb) { 76Return<void> SafeUnion::setE(const LargeSafeUnion& myUnion, const hidl_array<int8_t, 13>& e, setE_cb _hidl_cb) {
77 LOG(INFO) << "SERVER(SafeUnion) setE(myUnion, " << toString(e) << ")"; 77 LOG(INFO) << "SERVER(SafeUnion) setE(myUnion, " << toString(e) << ")";
78 78
79 LargeSafeUnion myNewUnion = myUnion; 79 LargeSafeUnion myNewUnion = myUnion;
@@ -83,7 +83,7 @@ Return<void> SafeUnion::setE(const ::android::hardware::tests::safeunion::V1_0::
83 return Void(); 83 return Void();
84} 84}
85 85
86Return<void> SafeUnion::setF(const ::android::hardware::tests::safeunion::V1_0::LargeSafeUnion& myUnion, const hidl_array<int64_t, 5>& f, setF_cb _hidl_cb) { 86Return<void> SafeUnion::setF(const LargeSafeUnion& myUnion, const hidl_array<int64_t, 5>& f, setF_cb _hidl_cb) {
87 LOG(INFO) << "SERVER(SafeUnion) setF(myUnion, " << toString(f) << ")"; 87 LOG(INFO) << "SERVER(SafeUnion) setF(myUnion, " << toString(f) << ")";
88 88
89 LargeSafeUnion myNewUnion = myUnion; 89 LargeSafeUnion myNewUnion = myUnion;
@@ -93,7 +93,7 @@ Return<void> SafeUnion::setF(const ::android::hardware::tests::safeunion::V1_0::
93 return Void(); 93 return Void();
94} 94}
95 95
96Return<void> SafeUnion::setG(const ::android::hardware::tests::safeunion::V1_0::LargeSafeUnion& myUnion, const hidl_string& g, setG_cb _hidl_cb) { 96Return<void> SafeUnion::setG(const LargeSafeUnion& myUnion, const hidl_string& g, setG_cb _hidl_cb) {
97 LOG(INFO) << "SERVER(SafeUnion) setG(myUnion, " << toString(g) << ")"; 97 LOG(INFO) << "SERVER(SafeUnion) setG(myUnion, " << toString(g) << ")";
98 98
99 LargeSafeUnion myNewUnion = myUnion; 99 LargeSafeUnion myNewUnion = myUnion;
@@ -103,7 +103,7 @@ Return<void> SafeUnion::setG(const ::android::hardware::tests::safeunion::V1_0::
103 return Void(); 103 return Void();
104} 104}
105 105
106Return<void> SafeUnion::setH(const ::android::hardware::tests::safeunion::V1_0::LargeSafeUnion& myUnion, const hidl_vec<bool>& h, setH_cb _hidl_cb) { 106Return<void> SafeUnion::setH(const LargeSafeUnion& myUnion, const hidl_vec<bool>& h, setH_cb _hidl_cb) {
107 LOG(INFO) << "SERVER(SafeUnion) setH(myUnion, " << toString(h) << ")"; 107 LOG(INFO) << "SERVER(SafeUnion) setH(myUnion, " << toString(h) << ")";
108 108
109 LargeSafeUnion myNewUnion = myUnion; 109 LargeSafeUnion myNewUnion = myUnion;
@@ -113,7 +113,7 @@ Return<void> SafeUnion::setH(const ::android::hardware::tests::safeunion::V1_0::
113 return Void(); 113 return Void();
114} 114}
115 115
116Return<void> SafeUnion::setI(const ::android::hardware::tests::safeunion::V1_0::LargeSafeUnion& myUnion, const hidl_vec<uint64_t>& i, setI_cb _hidl_cb) { 116Return<void> SafeUnion::setI(const LargeSafeUnion& myUnion, const hidl_vec<uint64_t>& i, setI_cb _hidl_cb) {
117 LOG(INFO) << "SERVER(SafeUnion) setI(myUnion, " << toString(i) << ")"; 117 LOG(INFO) << "SERVER(SafeUnion) setI(myUnion, " << toString(i) << ")";
118 118
119 LargeSafeUnion myNewUnion = myUnion; 119 LargeSafeUnion myNewUnion = myUnion;
@@ -123,7 +123,7 @@ Return<void> SafeUnion::setI(const ::android::hardware::tests::safeunion::V1_0::
123 return Void(); 123 return Void();
124} 124}
125 125
126Return<void> SafeUnion::setJ(const ::android::hardware::tests::safeunion::V1_0::LargeSafeUnion& myUnion, const J& j, setJ_cb _hidl_cb) { 126Return<void> SafeUnion::setJ(const LargeSafeUnion& myUnion, const J& j, setJ_cb _hidl_cb) {
127 LOG(INFO) << "SERVER(SafeUnion) setJ(myUnion, " << toString(j) << ")"; 127 LOG(INFO) << "SERVER(SafeUnion) setJ(myUnion, " << toString(j) << ")";
128 128
129 LargeSafeUnion myNewUnion = myUnion; 129 LargeSafeUnion myNewUnion = myUnion;
@@ -133,7 +133,7 @@ Return<void> SafeUnion::setJ(const ::android::hardware::tests::safeunion::V1_0::
133 return Void(); 133 return Void();
134} 134}
135 135
136Return<void> SafeUnion::setK(const ::android::hardware::tests::safeunion::V1_0::LargeSafeUnion& myUnion, const LargeSafeUnion::K& k, setK_cb _hidl_cb) { 136Return<void> SafeUnion::setK(const LargeSafeUnion& myUnion, const LargeSafeUnion::K& k, setK_cb _hidl_cb) {
137 LOG(INFO) << "SERVER(SafeUnion) setK(myUnion, " << toString(k) << ")"; 137 LOG(INFO) << "SERVER(SafeUnion) setK(myUnion, " << toString(k) << ")";
138 138
139 LargeSafeUnion myNewUnion = myUnion; 139 LargeSafeUnion myNewUnion = myUnion;
@@ -143,7 +143,7 @@ Return<void> SafeUnion::setK(const ::android::hardware::tests::safeunion::V1_0::
143 return Void(); 143 return Void();
144} 144}
145 145
146Return<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) { 146Return<void> SafeUnion::setL(const LargeSafeUnion& myUnion, const SmallSafeUnion& l, setL_cb _hidl_cb) {
147 LOG(INFO) << "SERVER(SafeUnion) setL(myUnion, " << toString(l) << ")"; 147 LOG(INFO) << "SERVER(SafeUnion) setL(myUnion, " << toString(l) << ")";
148 148
149 LargeSafeUnion myNewUnion = myUnion; 149 LargeSafeUnion myNewUnion = myUnion;
@@ -161,7 +161,7 @@ Return<void> SafeUnion::newMiscTypesSafeUnion(newMiscTypesSafeUnion_cb _hidl_cb)
161 return Void(); 161 return Void();
162} 162}
163 163
164Return<void> SafeUnion::setMiscA(const ::android::hardware::tests::safeunion::V1_0::MiscTypesSafeUnion& myUnion, const hidl_memory& a, setMiscA_cb _hidl_cb) { 164Return<void> SafeUnion::setMiscA(const MiscTypesSafeUnion& myUnion, const hidl_memory& a, setMiscA_cb _hidl_cb) {
165 LOG(INFO) << "SERVER(SafeUnion) setMiscA(myUnion, " << toString(a) << ")"; 165 LOG(INFO) << "SERVER(SafeUnion) setMiscA(myUnion, " << toString(a) << ")";
166 166
167 MiscTypesSafeUnion myNewUnion = myUnion; 167 MiscTypesSafeUnion myNewUnion = myUnion;
@@ -171,7 +171,7 @@ Return<void> SafeUnion::setMiscA(const ::android::hardware::tests::safeunion::V1
171 return Void(); 171 return Void();
172} 172}
173 173
174Return<void> SafeUnion::setMiscB(const ::android::hardware::tests::safeunion::V1_0::MiscTypesSafeUnion& myUnion, const hidl_handle& b, setMiscB_cb _hidl_cb) { 174Return<void> SafeUnion::setMiscB(const MiscTypesSafeUnion& myUnion, const hidl_handle& b, setMiscB_cb _hidl_cb) {
175 LOG(INFO) << "SERVER(SafeUnion) setMiscB(myUnion, " << toString(b) << ")"; 175 LOG(INFO) << "SERVER(SafeUnion) setMiscB(myUnion, " << toString(b) << ")";
176 176
177 MiscTypesSafeUnion myNewUnion = myUnion; 177 MiscTypesSafeUnion myNewUnion = myUnion;
@@ -181,7 +181,7 @@ Return<void> SafeUnion::setMiscB(const ::android::hardware::tests::safeunion::V1
181 return Void(); 181 return Void();
182} 182}
183 183
184Return<void> SafeUnion::setMiscC(const ::android::hardware::tests::safeunion::V1_0::MiscTypesSafeUnion& myUnion, hidl_bitfield<BitField> c, setMiscC_cb _hidl_cb) { 184Return<void> SafeUnion::setMiscC(const MiscTypesSafeUnion& myUnion, hidl_bitfield<BitField> c, setMiscC_cb _hidl_cb) {
185 LOG(INFO) << "SERVER(SafeUnion) setMiscC(myUnion, " << c << ")"; 185 LOG(INFO) << "SERVER(SafeUnion) setMiscC(myUnion, " << c << ")";
186 186
187 MiscTypesSafeUnion myNewUnion = myUnion; 187 MiscTypesSafeUnion myNewUnion = myUnion;
@@ -191,6 +191,43 @@ Return<void> SafeUnion::setMiscC(const ::android::hardware::tests::safeunion::V1
191 return Void(); 191 return Void();
192} 192}
193 193
194Return<void> SafeUnion::newInterfaceTypeSafeUnion(newInterfaceTypeSafeUnion_cb _hidl_cb) {
195 LOG(INFO) << "SERVER(SafeUnion) newInterfaceTypeSafeUnion()";
196
197 InterfaceTypeSafeUnion ret;
198 _hidl_cb(ret);
199 return Void();
200}
201
202Return<void> SafeUnion::setInterfaceA(const InterfaceTypeSafeUnion& myUnion, uint32_t a, setInterfaceA_cb _hidl_cb) {
203 LOG(INFO) << "SERVER(SafeUnion) setInterfaceA(myUnion, " << a << ")";
204
205 InterfaceTypeSafeUnion myNewUnion = myUnion;
206 myNewUnion.a(a);
207
208 _hidl_cb(myNewUnion);
209 return Void();
210}
211
212Return<void> SafeUnion::setInterfaceB(const InterfaceTypeSafeUnion& myUnion, const hidl_array<int8_t, 7>& b, setInterfaceB_cb _hidl_cb) {
213 LOG(INFO) << "SERVER(SafeUnion) setInterfaceB(myUnion, " << toString(b) << ")";
214
215 InterfaceTypeSafeUnion myNewUnion = myUnion;
216 myNewUnion.b(b);
217
218 _hidl_cb(myNewUnion);
219 return Void();
220}
221
222Return<void> SafeUnion::setInterfaceC(const InterfaceTypeSafeUnion& myUnion, const sp<::android::hardware::tests::safeunion::V1_0::IOtherInterface>& c, setInterfaceC_cb _hidl_cb) {
223 LOG(INFO) << "SERVER(SafeUnion) setInterfaceC(myUnion, " << toString(c) << ")";
224
225 InterfaceTypeSafeUnion myNewUnion = myUnion;
226 myNewUnion.c(c);
227
228 _hidl_cb(myNewUnion);
229 return Void();
230}
194 231
195ISafeUnion* HIDL_FETCH_ISafeUnion(const char* /* name */) { 232ISafeUnion* HIDL_FETCH_ISafeUnion(const char* /* name */) {
196 return new SafeUnion(); 233 return new SafeUnion();
diff --git a/tests/safeunion/1.0/default/SafeUnion.h b/tests/safeunion/1.0/default/SafeUnion.h
index 6b9997a4..e3550b8a 100644
--- a/tests/safeunion/1.0/default/SafeUnion.h
+++ b/tests/safeunion/1.0/default/SafeUnion.h
@@ -30,9 +30,7 @@ namespace implementation {
30 30
31using ::android::hardware::Return; 31using ::android::hardware::Return;
32using ::android::hardware::Void; 32using ::android::hardware::Void;
33using ::android::hardware::tests::safeunion::V1_0::SmallSafeUnion; 33using ::android::hardware::tests::safeunion::V1_0::ISafeUnion;
34using ::android::hardware::tests::safeunion::V1_0::LargeSafeUnion;
35using ::android::hardware::tests::safeunion::V1_0::MiscTypesSafeUnion;
36 34
37struct SafeUnion : public ISafeUnion { 35struct SafeUnion : public ISafeUnion {
38 // Methods from ::android::hardware::tests::safeunion::V1_0::ISafeUnion follow. 36 // Methods from ::android::hardware::tests::safeunion::V1_0::ISafeUnion follow.
@@ -51,9 +49,14 @@ struct SafeUnion : public ISafeUnion {
51 Return<void> setL(const LargeSafeUnion& myUnion, const SmallSafeUnion& l, setL_cb _hidl_cb) override; 49 Return<void> setL(const LargeSafeUnion& myUnion, const SmallSafeUnion& l, setL_cb _hidl_cb) override;
52 50
53 Return<void> newMiscTypesSafeUnion(newMiscTypesSafeUnion_cb _hidl_cb) override; 51 Return<void> newMiscTypesSafeUnion(newMiscTypesSafeUnion_cb _hidl_cb) override;
54 Return<void> setMiscA(const ::android::hardware::tests::safeunion::V1_0::MiscTypesSafeUnion& myUnion, const hidl_memory& a, setMiscA_cb _hidl_cb) override; 52 Return<void> setMiscA(const MiscTypesSafeUnion& myUnion, const hidl_memory& a, setMiscA_cb _hidl_cb) override;
55 Return<void> setMiscB(const ::android::hardware::tests::safeunion::V1_0::MiscTypesSafeUnion& myUnion, const hidl_handle& b, setMiscB_cb _hidl_cb) override; 53 Return<void> setMiscB(const MiscTypesSafeUnion& myUnion, const hidl_handle& b, setMiscB_cb _hidl_cb) override;
56 Return<void> setMiscC(const ::android::hardware::tests::safeunion::V1_0::MiscTypesSafeUnion& myUnion, hidl_bitfield<BitField> c, setMiscC_cb _hidl_cb) override; 54 Return<void> setMiscC(const MiscTypesSafeUnion& myUnion, hidl_bitfield<BitField> c, setMiscC_cb _hidl_cb) override;
55
56 Return<void> newInterfaceTypeSafeUnion(newInterfaceTypeSafeUnion_cb _hidl_cb) override;
57 Return<void> setInterfaceA(const InterfaceTypeSafeUnion& myUnion, uint32_t a, setInterfaceA_cb _hidl_cb) override;
58 Return<void> setInterfaceB(const InterfaceTypeSafeUnion& myUnion, const hidl_array<int8_t, 7>& b, setInterfaceB_cb _hidl_cb) override;
59 Return<void> setInterfaceC(const InterfaceTypeSafeUnion& myUnion, const sp<::android::hardware::tests::safeunion::V1_0::IOtherInterface>& c, setInterfaceC_cb _hidl_cb) override;
57}; 60};
58 61
59extern "C" ISafeUnion* HIDL_FETCH_ISafeUnion(const char* name); 62extern "C" ISafeUnion* HIDL_FETCH_ISafeUnion(const char* name);
diff --git a/tests/safeunion/1.0/types.hal b/tests/safeunion/1.0/types.hal
deleted file mode 100644
index a70079d7..00000000
--- a/tests/safeunion/1.0/types.hal
+++ /dev/null
@@ -1,67 +0,0 @@
1/*
2 * Copyright (C) 2018 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.hardware.tests.safeunion@1.0;
18
19enum BitField : uint8_t {
20 V0 = 1 << 0,
21 V1 = 1 << 1,
22 V2 = 1 << 2,
23 V3 = 1 << 3,
24};
25
26struct J {
27 vec<uint32_t> j1;
28 uint8_t[65] j2;
29 string j3;
30};
31
32safe_union EmptySafeUnion {
33};
34
35safe_union SmallSafeUnion {
36 uint8_t a;
37};
38
39safe_union LargeSafeUnion {
40 int8_t a;
41 uint16_t b;
42 int32_t c;
43 uint64_t d;
44
45 int8_t[13] e;
46 int64_t[5] f;
47
48 string g;
49 vec<bool> h;
50 vec<uint64_t> i;
51
52 J j;
53 struct K {
54 uint8_t k1;
55 uint64_t k2;
56 } k;
57
58 SmallSafeUnion l;
59};
60
61// TODO(b/110269925): Test more HIDL types. Missing:
62// death_recipient, fmq_{sync,unsync}, pointer, ref.
63safe_union MiscTypesSafeUnion {
64 memory a;
65 handle b;
66 bitfield<BitField> c;
67};