diff options
author | Nirav Atre | 2018-07-06 15:08:29 -0500 |
---|---|---|
committer | android-build-merger | 2018-07-06 15:08:29 -0500 |
commit | 807848693d44928c247c11c4fdfbadf6631137ec (patch) | |
tree | cda1b952647ee078433b1edd0f8be8bd2c9871e5 /tests | |
parent | 35292108e7f113da89251befba6c7cf3d862f702 (diff) | |
parent | 5f64ae9872edb5967e565fd1fe8dffaaee3054e2 (diff) | |
download | platform-hardware-interfaces-807848693d44928c247c11c4fdfbadf6631137ec.tar.gz platform-hardware-interfaces-807848693d44928c247c11c4fdfbadf6631137ec.tar.xz platform-hardware-interfaces-807848693d44928c247c11c4fdfbadf6631137ec.zip |
Merge "Adding HIDL interface type to safeunion test HAL"
am: 5f64ae9872
Change-Id: I232939e4bf2e846f44b948d540c27e0a42fc11a2
Diffstat (limited to 'tests')
-rw-r--r-- | tests/safeunion/1.0/Android.bp | 8 | ||||
-rw-r--r-- | tests/safeunion/1.0/IOtherInterface.hal | 21 | ||||
-rw-r--r-- | tests/safeunion/1.0/ISafeUnion.hal | 66 | ||||
-rw-r--r-- | tests/safeunion/1.0/default/SafeUnion.cpp | 59 | ||||
-rw-r--r-- | tests/safeunion/1.0/default/SafeUnion.h | 15 | ||||
-rw-r--r-- | tests/safeunion/1.0/types.hal | 67 |
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 | |||
17 | package android.hardware.tests.safeunion@1.0; | ||
18 | |||
19 | interface 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 | ||
17 | package android.hardware.tests.safeunion@1.0; | 17 | package android.hardware.tests.safeunion@1.0; |
18 | 18 | ||
19 | import IOtherInterface; | ||
20 | |||
19 | interface ISafeUnion { | 21 | interface 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 | ||
76 | Return<void> SafeUnion::setE(const ::android::hardware::tests::safeunion::V1_0::LargeSafeUnion& myUnion, const hidl_array<int8_t, 13>& e, setE_cb _hidl_cb) { | 76 | Return<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 | ||
86 | Return<void> SafeUnion::setF(const ::android::hardware::tests::safeunion::V1_0::LargeSafeUnion& myUnion, const hidl_array<int64_t, 5>& f, setF_cb _hidl_cb) { | 86 | Return<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 | ||
96 | Return<void> SafeUnion::setG(const ::android::hardware::tests::safeunion::V1_0::LargeSafeUnion& myUnion, const hidl_string& g, setG_cb _hidl_cb) { | 96 | Return<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 | ||
106 | Return<void> SafeUnion::setH(const ::android::hardware::tests::safeunion::V1_0::LargeSafeUnion& myUnion, const hidl_vec<bool>& h, setH_cb _hidl_cb) { | 106 | Return<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 | ||
116 | Return<void> SafeUnion::setI(const ::android::hardware::tests::safeunion::V1_0::LargeSafeUnion& myUnion, const hidl_vec<uint64_t>& i, setI_cb _hidl_cb) { | 116 | Return<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 | ||
126 | Return<void> SafeUnion::setJ(const ::android::hardware::tests::safeunion::V1_0::LargeSafeUnion& myUnion, const J& j, setJ_cb _hidl_cb) { | 126 | Return<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 | ||
136 | Return<void> SafeUnion::setK(const ::android::hardware::tests::safeunion::V1_0::LargeSafeUnion& myUnion, const LargeSafeUnion::K& k, setK_cb _hidl_cb) { | 136 | Return<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 | ||
146 | 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) { | 146 | Return<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 | ||
164 | Return<void> SafeUnion::setMiscA(const ::android::hardware::tests::safeunion::V1_0::MiscTypesSafeUnion& myUnion, const hidl_memory& a, setMiscA_cb _hidl_cb) { | 164 | Return<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 | ||
174 | Return<void> SafeUnion::setMiscB(const ::android::hardware::tests::safeunion::V1_0::MiscTypesSafeUnion& myUnion, const hidl_handle& b, setMiscB_cb _hidl_cb) { | 174 | Return<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 | ||
184 | Return<void> SafeUnion::setMiscC(const ::android::hardware::tests::safeunion::V1_0::MiscTypesSafeUnion& myUnion, hidl_bitfield<BitField> c, setMiscC_cb _hidl_cb) { | 184 | Return<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 | ||
194 | Return<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 | |||
202 | Return<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 | |||
212 | Return<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 | |||
222 | Return<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 | ||
195 | ISafeUnion* HIDL_FETCH_ISafeUnion(const char* /* name */) { | 232 | ISafeUnion* 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 | ||
31 | using ::android::hardware::Return; | 31 | using ::android::hardware::Return; |
32 | using ::android::hardware::Void; | 32 | using ::android::hardware::Void; |
33 | using ::android::hardware::tests::safeunion::V1_0::SmallSafeUnion; | 33 | using ::android::hardware::tests::safeunion::V1_0::ISafeUnion; |
34 | using ::android::hardware::tests::safeunion::V1_0::LargeSafeUnion; | ||
35 | using ::android::hardware::tests::safeunion::V1_0::MiscTypesSafeUnion; | ||
36 | 34 | ||
37 | struct SafeUnion : public ISafeUnion { | 35 | struct 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 | ||
59 | extern "C" ISafeUnion* HIDL_FETCH_ISafeUnion(const char* name); | 62 | extern "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 | |||
17 | package android.hardware.tests.safeunion@1.0; | ||
18 | |||
19 | enum BitField : uint8_t { | ||
20 | V0 = 1 << 0, | ||
21 | V1 = 1 << 1, | ||
22 | V2 = 1 << 2, | ||
23 | V3 = 1 << 3, | ||
24 | }; | ||
25 | |||
26 | struct J { | ||
27 | vec<uint32_t> j1; | ||
28 | uint8_t[65] j2; | ||
29 | string j3; | ||
30 | }; | ||
31 | |||
32 | safe_union EmptySafeUnion { | ||
33 | }; | ||
34 | |||
35 | safe_union SmallSafeUnion { | ||
36 | uint8_t a; | ||
37 | }; | ||
38 | |||
39 | safe_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. | ||
63 | safe_union MiscTypesSafeUnion { | ||
64 | memory a; | ||
65 | handle b; | ||
66 | bitfield<BitField> c; | ||
67 | }; | ||