blob: df2b1c03f93bbdcaf10cab67934b01c5b9555de1 [file] [log] [blame]
Andreas Huber1aec3972016-08-26 09:26:32 -07001/*
2 * Copyright (C) 2016 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
Andreas Huber2831d512016-08-15 09:33:47 -070017#include "AST.h"
18
19#include "Coordinator.h"
Andreas Huber2831d512016-08-15 09:33:47 -070020#include "Interface.h"
21#include "Method.h"
22#include "Scope.h"
23
Iliyan Malcheva72e0d22016-09-09 11:03:08 -070024#include <hidl-util/Formatter.h>
Andreas Huber2831d512016-08-15 09:33:47 -070025#include <android-base/logging.h>
26
27namespace android {
28
Andreas Huber2831d512016-08-15 09:33:47 -070029void AST::emitJavaReaderWriter(
30 Formatter &out,
31 const std::string &parcelObj,
32 const TypedVar *arg,
33 bool isReader) const {
34 if (isReader) {
Yifan Hong4ed13472016-11-02 10:44:11 -070035 out << arg->type().getJavaType()
Andreas Huber2831d512016-08-15 09:33:47 -070036 << " "
37 << arg->name()
38 << " = ";
39 }
40
41 arg->type().emitJavaReaderWriter(out, parcelObj, arg->name(), isReader);
42}
43
Andreas Huber0fa9e392016-08-31 09:05:44 -070044status_t AST::generateJavaTypes(
Andreas Huberd29724f2016-09-14 09:33:13 -070045 const std::string &outputPath, const std::string &limitToType) const {
Andreas Huber85eabdb2016-08-25 11:24:49 -070046 // Splits types.hal up into one java file per declared type.
47
Steven Morelandd537ab02016-09-12 10:32:01 -070048 for (const auto &type : mRootScope->getSubTypes()) {
49 std::string typeName = type->localName();
Andreas Huber85eabdb2016-08-25 11:24:49 -070050
51 if (type->isTypeDef()) {
52 continue;
53 }
54
Andreas Huberd29724f2016-09-14 09:33:13 -070055 if (!limitToType.empty() && typeName != limitToType) {
Andreas Huber0fa9e392016-08-31 09:05:44 -070056 continue;
57 }
58
Andreas Huber85eabdb2016-08-25 11:24:49 -070059 std::string path = outputPath;
60 path.append(mCoordinator->convertPackageRootToPath(mPackage));
61 path.append(mCoordinator->getPackagePath(mPackage, true /* relative */));
62 path.append(typeName);
63 path.append(".java");
64
65 CHECK(Coordinator::MakeParentHierarchy(path));
66 FILE *file = fopen(path.c_str(), "w");
67
68 if (file == NULL) {
69 return -errno;
70 }
71
72 Formatter out(file);
73
74 std::vector<std::string> packageComponents;
75 getPackageAndVersionComponents(
76 &packageComponents, true /* cpp_compatible */);
77
78 out << "package " << mPackage.javaPackage() << ";\n\n";
79
Iliyan Malchev800273d2016-09-02 15:25:07 -070080 out << "\n";
81
Andreas Huber85eabdb2016-08-25 11:24:49 -070082 status_t err =
83 type->emitJavaTypeDeclarations(out, true /* atTopLevel */);
84
85 if (err != OK) {
86 return err;
87 }
88 }
89
90 return OK;
91}
92
Andreas Huber0fa9e392016-08-31 09:05:44 -070093status_t AST::generateJava(
Andreas Huberd29724f2016-09-14 09:33:13 -070094 const std::string &outputPath, const std::string &limitToType) const {
Andreas Huber0fa9e392016-08-31 09:05:44 -070095 if (!isJavaCompatible()) {
Andreas Huber70a59e12016-08-16 12:57:01 -070096 fprintf(stderr,
97 "ERROR: This interface is not Java compatible. The Java backend"
Andreas Huberf03332a2016-09-22 15:35:43 -070098 " does NOT support union types nor native handles. "
99 "In addition, vectors of arrays are limited to at most "
Andreas Huber86a112b2016-10-19 14:25:16 -0700100 "one-dimensional arrays and vectors of {vectors,interfaces} are"
101 " not supported.\n");
Andreas Huber70a59e12016-08-16 12:57:01 -0700102
Andreas Huber2831d512016-08-15 09:33:47 -0700103 return UNKNOWN_ERROR;
104 }
105
Andreas Huber0fa9e392016-08-31 09:05:44 -0700106 std::string ifaceName;
107 if (!AST::isInterface(&ifaceName)) {
108 return generateJavaTypes(outputPath, limitToType);
109 }
110
111 const Interface *iface = mRootScope->getInterface();
112
Jayant Chowdhary3f32c1f2016-09-15 16:53:56 -0700113 const std::string baseName = iface->getBaseName();
Andreas Huber2831d512016-08-15 09:33:47 -0700114
115 std::string path = outputPath;
116 path.append(mCoordinator->convertPackageRootToPath(mPackage));
117 path.append(mCoordinator->getPackagePath(mPackage, true /* relative */));
118 path.append(ifaceName);
119 path.append(".java");
120
121 CHECK(Coordinator::MakeParentHierarchy(path));
122 FILE *file = fopen(path.c_str(), "w");
123
124 if (file == NULL) {
125 return -errno;
126 }
127
128 Formatter out(file);
129
130 std::vector<std::string> packageComponents;
131 getPackageAndVersionComponents(
132 &packageComponents, true /* cpp_compatible */);
133
134 out << "package " << mPackage.javaPackage() << ";\n\n";
135
Andreas Huber2831d512016-08-15 09:33:47 -0700136 out.setNamespace(mPackage.javaPackage() + ".");
137
Andreas Huber2831d512016-08-15 09:33:47 -0700138 const Interface *superType = iface->superType();
139
140 out << "public interface " << ifaceName << " extends ";
141
142 if (superType != NULL) {
143 out << superType->fullJavaName();
144 } else {
Yifan Hong1af73532016-11-09 14:32:58 -0800145 out << "android.os.IHwInterface";
Andreas Huber2831d512016-08-15 09:33:47 -0700146 }
147
148 out << " {\n";
149 out.indent();
150
151 out << "public static final String kInterfaceName = \""
152 << mPackage.string()
153 << "::"
154 << ifaceName
155 << "\";\n\n";
156
157 out << "public static "
158 << ifaceName
Yifan Hong1af73532016-11-09 14:32:58 -0800159 << " asInterface(android.os.IHwBinder binder) {\n";
Andreas Huber2831d512016-08-15 09:33:47 -0700160
161 out.indent();
162
163 out << "if (binder == null) {\n";
164 out.indent();
165 out << "return null;\n";
166 out.unindent();
167 out << "}\n\n";
168
Yifan Hong1af73532016-11-09 14:32:58 -0800169 out << "android.os.IHwInterface iface =\n";
Andreas Huber2831d512016-08-15 09:33:47 -0700170 out.indent();
171 out.indent();
172 out << "binder.queryLocalInterface(kInterfaceName);\n\n";
173 out.unindent();
174 out.unindent();
175
176 out << "if ((iface != null) && (iface instanceof "
177 << ifaceName
178 << ")) {\n";
179
180 out.indent();
181 out << "return (" << ifaceName << ")iface;\n";
182 out.unindent();
183 out << "}\n\n";
184
185 out << "return new " << ifaceName << ".Proxy(binder);\n";
186
187 out.unindent();
188 out << "}\n\n";
189
Yifan Hong1af73532016-11-09 14:32:58 -0800190 out << "public android.os.IHwBinder asBinder();\n\n";
Andreas Huber2831d512016-08-15 09:33:47 -0700191
Andreas Huber2bb6e1e2016-10-25 13:26:43 -0700192 out << "public static "
193 << ifaceName
194 << " getService(String serviceName) {\n";
195
196 out.indent();
197
198 out << "return "
199 << ifaceName
Yifan Hong1af73532016-11-09 14:32:58 -0800200 << ".asInterface(android.os.HwBinder.getService(\""
Steven Moreland7e367bf2016-11-04 11:31:41 -0700201 << iface->fqName().string()
202 << "\",serviceName));\n";
Andreas Huber2bb6e1e2016-10-25 13:26:43 -0700203
204 out.unindent();
205
206 out << "}\n\n";
207
Andreas Huber2831d512016-08-15 09:33:47 -0700208 status_t err = emitJavaTypeDeclarations(out);
209
210 if (err != OK) {
211 return err;
212 }
213
Andreas Huber2831d512016-08-15 09:33:47 -0700214 for (const auto &method : iface->methods()) {
215 const bool returnsValue = !method->results().empty();
216 const bool needsCallback = method->results().size() > 1;
217
218 if (needsCallback) {
219 out << "\npublic abstract class "
220 << method->name()
221 << "Callback {\n";
222
223 out.indent();
224
225 out << "public abstract void onValues("
Steven Morelanda7a421a2016-09-07 08:35:18 -0700226 << Method::GetJavaArgSignature(method->results())
Andreas Huber2831d512016-08-15 09:33:47 -0700227 << ");\n";
228
229 out.unindent();
230 out << "}\n\n";
231 }
232
233 if (returnsValue && !needsCallback) {
Yifan Hong4ed13472016-11-02 10:44:11 -0700234 out << method->results()[0]->type().getJavaType();
Andreas Huber2831d512016-08-15 09:33:47 -0700235 } else {
236 out << "void";
237 }
238
239 out << " "
240 << method->name()
241 << "("
Steven Morelanda7a421a2016-09-07 08:35:18 -0700242 << Method::GetJavaArgSignature(method->args());
Andreas Huber2831d512016-08-15 09:33:47 -0700243
244 if (needsCallback) {
245 if (!method->args().empty()) {
246 out << ", ";
247 }
248
249 out << method->name()
250 << "Callback cb";
251 }
252
253 out << ");\n";
254 }
255
256 out << "\npublic static final class Proxy implements "
257 << ifaceName
258 << " {\n";
259
260 out.indent();
261
Yifan Hong1af73532016-11-09 14:32:58 -0800262 out << "private android.os.IHwBinder mRemote;\n\n";
263 out << "public Proxy(android.os.IHwBinder remote) {\n";
Andreas Huber2831d512016-08-15 09:33:47 -0700264 out.indent();
265 out << "mRemote = remote;\n";
266 out.unindent();
267 out << "}\n\n";
268
Yifan Hong1af73532016-11-09 14:32:58 -0800269 out << "public android.os.IHwBinder asBinder() {\n";
Andreas Huber2831d512016-08-15 09:33:47 -0700270 out.indent();
271 out << "return mRemote;\n";
272 out.unindent();
273 out << "}\n\n";
274
Yifan Hong10fe0b52016-10-19 14:20:17 -0700275 const Interface *prevInterface = nullptr;
276 for (const auto &tuple : iface->allMethodsFromRoot()) {
277 const Method *method = tuple.method();
278 const Interface *superInterface = tuple.interface();
279 if (prevInterface != superInterface) {
280 out << "// Methods from "
281 << superInterface->fullName()
282 << " follow.\n";
283 prevInterface = superInterface;
284 }
285 const bool returnsValue = !method->results().empty();
286 const bool needsCallback = method->results().size() > 1;
Andreas Huber2831d512016-08-15 09:33:47 -0700287
Yifan Hong10fe0b52016-10-19 14:20:17 -0700288 out << "public ";
289 if (returnsValue && !needsCallback) {
Yifan Hong4ed13472016-11-02 10:44:11 -0700290 out << method->results()[0]->type().getJavaType();
Yifan Hong10fe0b52016-10-19 14:20:17 -0700291 } else {
292 out << "void";
293 }
Andreas Huber2831d512016-08-15 09:33:47 -0700294
Yifan Hong10fe0b52016-10-19 14:20:17 -0700295 out << " "
296 << method->name()
297 << "("
298 << Method::GetJavaArgSignature(method->args());
Andreas Huber2831d512016-08-15 09:33:47 -0700299
Yifan Hong10fe0b52016-10-19 14:20:17 -0700300 if (needsCallback) {
301 if (!method->args().empty()) {
302 out << ", ";
Andreas Huber2831d512016-08-15 09:33:47 -0700303 }
304
Yifan Hong10fe0b52016-10-19 14:20:17 -0700305 out << method->name()
306 << "Callback cb";
307 }
Andreas Huber2831d512016-08-15 09:33:47 -0700308
Yifan Hong10fe0b52016-10-19 14:20:17 -0700309 out << ") {\n";
310 out.indent();
Andreas Huber2831d512016-08-15 09:33:47 -0700311
Steven Moreland4b39bc12016-11-16 10:42:24 -0800312 out << "android.os.HwParcel _hidl_request = new android.os.HwParcel();\n";
313 out << "_hidl_request.writeInterfaceToken("
Yifan Hong10fe0b52016-10-19 14:20:17 -0700314 << superInterface->fullJavaName()
315 << ".kInterfaceName);\n";
Andreas Huber2831d512016-08-15 09:33:47 -0700316
Yifan Hong10fe0b52016-10-19 14:20:17 -0700317 for (const auto &arg : method->args()) {
318 emitJavaReaderWriter(
319 out,
Steven Moreland4b39bc12016-11-16 10:42:24 -0800320 "_hidl_request",
Yifan Hong10fe0b52016-10-19 14:20:17 -0700321 arg,
322 false /* isReader */);
323 }
Andreas Huber2831d512016-08-15 09:33:47 -0700324
Steven Moreland4b39bc12016-11-16 10:42:24 -0800325 out << "\nandroid.os.HwParcel _hidl_reply = new android.os.HwParcel();\n"
Yifan Hong10fe0b52016-10-19 14:20:17 -0700326 << "mRemote.transact("
327 << method->getSerialId()
328 << " /* "
329 << method->name()
Steven Moreland4b39bc12016-11-16 10:42:24 -0800330 << " */, _hidl_request, _hidl_reply, ";
Andreas Huber2831d512016-08-15 09:33:47 -0700331
Yifan Hong10fe0b52016-10-19 14:20:17 -0700332 if (method->isOneway()) {
Yifan Hong1af73532016-11-09 14:32:58 -0800333 out << "android.os.IHwBinder.FLAG_ONEWAY";
Yifan Hong10fe0b52016-10-19 14:20:17 -0700334 } else {
335 out << "0 /* flags */";
336 }
337
338 out << ");\n";
339
340 if (!method->isOneway()) {
Steven Moreland4b39bc12016-11-16 10:42:24 -0800341 out << "_hidl_reply.verifySuccess();\n";
Yifan Hong10fe0b52016-10-19 14:20:17 -0700342 } else {
343 CHECK(!returnsValue);
344 }
345
Steven Moreland4b39bc12016-11-16 10:42:24 -0800346 out << "_hidl_request.releaseTemporaryStorage();\n";
Yifan Hong10fe0b52016-10-19 14:20:17 -0700347
348 if (returnsValue) {
349 out << "\n";
350
351 for (const auto &arg : method->results()) {
Andreas Huber2831d512016-08-15 09:33:47 -0700352 emitJavaReaderWriter(
353 out,
Steven Moreland4b39bc12016-11-16 10:42:24 -0800354 "_hidl_reply",
Andreas Huber2831d512016-08-15 09:33:47 -0700355 arg,
Yifan Hong10fe0b52016-10-19 14:20:17 -0700356 true /* isReader */);
Andreas Huber2831d512016-08-15 09:33:47 -0700357 }
358
Yifan Hong10fe0b52016-10-19 14:20:17 -0700359 if (needsCallback) {
360 out << "cb.onValues(";
Andreas Huber8b5da222016-08-18 14:28:18 -0700361
Yifan Hong10fe0b52016-10-19 14:20:17 -0700362 bool firstField = true;
Andreas Huber2831d512016-08-15 09:33:47 -0700363 for (const auto &arg : method->results()) {
Yifan Hong10fe0b52016-10-19 14:20:17 -0700364 if (!firstField) {
365 out << ", ";
Andreas Huber2831d512016-08-15 09:33:47 -0700366 }
367
Yifan Hong10fe0b52016-10-19 14:20:17 -0700368 out << arg->name();
369 firstField = false;
Andreas Huber2831d512016-08-15 09:33:47 -0700370 }
Andreas Huber2831d512016-08-15 09:33:47 -0700371
Yifan Hong10fe0b52016-10-19 14:20:17 -0700372 out << ");\n";
373 } else {
374 const std::string returnName = method->results()[0]->name();
375 out << "return " << returnName << ";\n";
376 }
Andreas Huber2831d512016-08-15 09:33:47 -0700377 }
Yifan Hong10fe0b52016-10-19 14:20:17 -0700378
379 out.unindent();
380 out << "}\n\n";
Andreas Huber2831d512016-08-15 09:33:47 -0700381 }
382
383 out.unindent();
384 out << "}\n";
385
386 ////////////////////////////////////////////////////////////////////////////
387
Yifan Hong1af73532016-11-09 14:32:58 -0800388 out << "\npublic static abstract class Stub extends android.os.HwBinder "
Andreas Huber2831d512016-08-15 09:33:47 -0700389 << "implements "
390 << ifaceName << " {\n";
391
392 out.indent();
393
Yifan Hong1af73532016-11-09 14:32:58 -0800394 out << "public android.os.IHwBinder asBinder() {\n";
Andreas Huber2831d512016-08-15 09:33:47 -0700395 out.indent();
396 out << "return this;\n";
397 out.unindent();
398 out << "}\n\n";
399
Yifan Hong10fe0b52016-10-19 14:20:17 -0700400 for (Method *method : iface->hidlReservedMethods()) {
Martijn Coenenaf712c02016-11-16 15:26:27 +0100401 // b/32383557 this is a hack. We need to change this if we have more reserved methods.
402 CHECK_LE(method->results().size(), 1u);
403 std::string resultType = method->results().size() == 0 ? "void" :
404 method->results()[0]->type().getJavaType();
Yifan Hong10fe0b52016-10-19 14:20:17 -0700405 out << "public final "
Martijn Coenenaf712c02016-11-16 15:26:27 +0100406 << resultType
Yifan Hong10fe0b52016-10-19 14:20:17 -0700407 << " "
408 << method->name()
409 << "() {\n";
410 out.indent();
411 method->javaImpl(out);
412 out.unindent();
413 out << "\n}\n\n";
414 }
415
Yifan Hong1af73532016-11-09 14:32:58 -0800416 out << "public android.os.IHwInterface queryLocalInterface(String descriptor) {\n";
Andreas Huber2831d512016-08-15 09:33:47 -0700417 out.indent();
418 // XXX what about potential superClasses?
419 out << "if (kInterfaceName.equals(descriptor)) {\n";
420 out.indent();
421 out << "return this;\n";
422 out.unindent();
423 out << "}\n";
424 out << "return null;\n";
425 out.unindent();
426 out << "}\n\n";
427
Andreas Huber2bb6e1e2016-10-25 13:26:43 -0700428 out << "public void registerAsService(String serviceName) {\n";
429 out.indent();
430
Steven Moreland7e367bf2016-11-04 11:31:41 -0700431 out << "registerService(interfaceChain(), serviceName);\n";
Andreas Huber2bb6e1e2016-10-25 13:26:43 -0700432
433 out.unindent();
434 out << "}\n\n";
435
Andreas Huber2831d512016-08-15 09:33:47 -0700436 out << "public void onTransact("
Steven Moreland4b39bc12016-11-16 10:42:24 -0800437 << "int _hidl_code, "
438 << "android.os.HwParcel _hidl_request, "
439 << "final android.os.HwParcel _hidl_reply, "
440 << "int _hidl_flags) {\n";
Andreas Huber2831d512016-08-15 09:33:47 -0700441
442 out.indent();
443
Steven Moreland4b39bc12016-11-16 10:42:24 -0800444 out << "switch (_hidl_code) {\n";
Andreas Huber2831d512016-08-15 09:33:47 -0700445
446 out.indent();
447
Yifan Hong10fe0b52016-10-19 14:20:17 -0700448 for (const auto &tuple : iface->allMethodsFromRoot()) {
449 const Method *method = tuple.method();
450 const Interface *superInterface = tuple.interface();
451 const bool returnsValue = !method->results().empty();
452 const bool needsCallback = method->results().size() > 1;
Andreas Huber2831d512016-08-15 09:33:47 -0700453
Yifan Hong10fe0b52016-10-19 14:20:17 -0700454 out << "case "
455 << method->getSerialId()
456 << " /* "
457 << method->name()
458 << " */:\n{\n";
Andreas Huber2831d512016-08-15 09:33:47 -0700459
Yifan Hong10fe0b52016-10-19 14:20:17 -0700460 out.indent();
Andreas Huber2831d512016-08-15 09:33:47 -0700461
Steven Moreland4b39bc12016-11-16 10:42:24 -0800462 out << "_hidl_request.enforceInterface("
Yifan Hong10fe0b52016-10-19 14:20:17 -0700463 << superInterface->fullJavaName()
464 << ".kInterfaceName);\n\n";
465
466 for (const auto &arg : method->args()) {
467 emitJavaReaderWriter(
468 out,
Steven Moreland4b39bc12016-11-16 10:42:24 -0800469 "_hidl_request",
Yifan Hong10fe0b52016-10-19 14:20:17 -0700470 arg,
471 true /* isReader */);
472 }
473
474 if (!needsCallback && returnsValue) {
475 const TypedVar *returnArg = method->results()[0];
Yifan Hong10fe0b52016-10-19 14:20:17 -0700476
Yifan Hong4ed13472016-11-02 10:44:11 -0700477 out << returnArg->type().getJavaType()
Yifan Hong10fe0b52016-10-19 14:20:17 -0700478 << " "
479 << returnArg->name()
480 << " = ";
481 }
482
483 out << method->name()
484 << "(";
485
486 bool firstField = true;
487 for (const auto &arg : method->args()) {
488 if (!firstField) {
489 out << ", ";
490 }
491
492 out << arg->name();
493
494 firstField = false;
495 }
496
497 if (needsCallback) {
498 if (!firstField) {
499 out << ", ";
500 }
501
502 out << "new " << method->name() << "Callback() {\n";
Andreas Huber2831d512016-08-15 09:33:47 -0700503 out.indent();
504
Yifan Hong10fe0b52016-10-19 14:20:17 -0700505 out << "@Override\n"
506 << "public void onValues("
507 << Method::GetJavaArgSignature(method->results())
508 << ") {\n";
Andreas Huber2831d512016-08-15 09:33:47 -0700509
Yifan Hong10fe0b52016-10-19 14:20:17 -0700510 out.indent();
Steven Moreland4b39bc12016-11-16 10:42:24 -0800511 out << "_hidl_reply.writeStatus(android.os.HwParcel.STATUS_SUCCESS);\n";
Yifan Hong10fe0b52016-10-19 14:20:17 -0700512
513 for (const auto &arg : method->results()) {
Andreas Huber2831d512016-08-15 09:33:47 -0700514 emitJavaReaderWriter(
515 out,
Steven Moreland4b39bc12016-11-16 10:42:24 -0800516 "_hidl_reply",
Andreas Huber2831d512016-08-15 09:33:47 -0700517 arg,
Yifan Hong10fe0b52016-10-19 14:20:17 -0700518 false /* isReader */);
Andreas Huber2831d512016-08-15 09:33:47 -0700519 }
520
Steven Moreland4b39bc12016-11-16 10:42:24 -0800521 out << "_hidl_reply.send();\n"
Yifan Hong10fe0b52016-10-19 14:20:17 -0700522 << "}}";
Andreas Huber2831d512016-08-15 09:33:47 -0700523
Andreas Huber2831d512016-08-15 09:33:47 -0700524 out.unindent();
Yifan Hong10fe0b52016-10-19 14:20:17 -0700525 out.unindent();
Andreas Huber2831d512016-08-15 09:33:47 -0700526 }
Yifan Hong10fe0b52016-10-19 14:20:17 -0700527
528 out << ");\n";
529
530 if (!needsCallback) {
Steven Moreland4b39bc12016-11-16 10:42:24 -0800531 out << "_hidl_reply.writeStatus(android.os.HwParcel.STATUS_SUCCESS);\n";
Yifan Hong10fe0b52016-10-19 14:20:17 -0700532
533 if (returnsValue) {
534 const TypedVar *returnArg = method->results()[0];
535
536 emitJavaReaderWriter(
537 out,
Steven Moreland4b39bc12016-11-16 10:42:24 -0800538 "_hidl_reply",
Yifan Hong10fe0b52016-10-19 14:20:17 -0700539 returnArg,
540 false /* isReader */);
541 }
542
Steven Moreland4b39bc12016-11-16 10:42:24 -0800543 out << "_hidl_reply.send();\n";
Yifan Hong10fe0b52016-10-19 14:20:17 -0700544 }
545
546 out << "break;\n";
547 out.unindent();
548 out << "}\n\n";
Andreas Huber2831d512016-08-15 09:33:47 -0700549 }
550
551 out.unindent();
552 out << "}\n";
553
554 out.unindent();
555 out << "}\n";
556
557 out.unindent();
558 out << "}\n";
559
560 out.unindent();
561 out << "}\n";
562
563 return OK;
564}
565
566status_t AST::emitJavaTypeDeclarations(Formatter &out) const {
Andreas Huber85eabdb2016-08-25 11:24:49 -0700567 return mRootScope->emitJavaTypeDeclarations(out, false /* atTopLevel */);
Andreas Huber2831d512016-08-15 09:33:47 -0700568}
569
570} // namespace android
571