Andreas Huber | 1aec397 | 2016-08-26 09:26:32 -0700 | [diff] [blame] | 1 | /* |
| 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 Huber | 2831d51 | 2016-08-15 09:33:47 -0700 | [diff] [blame] | 17 | #include "AST.h" |
| 18 | |
| 19 | #include "Coordinator.h" |
Andreas Huber | 2831d51 | 2016-08-15 09:33:47 -0700 | [diff] [blame] | 20 | #include "Interface.h" |
| 21 | #include "Method.h" |
| 22 | #include "Scope.h" |
| 23 | |
Iliyan Malchev | a72e0d2 | 2016-09-09 11:03:08 -0700 | [diff] [blame] | 24 | #include <hidl-util/Formatter.h> |
Andreas Huber | 2831d51 | 2016-08-15 09:33:47 -0700 | [diff] [blame] | 25 | #include <android-base/logging.h> |
| 26 | |
| 27 | namespace android { |
| 28 | |
Andreas Huber | 2831d51 | 2016-08-15 09:33:47 -0700 | [diff] [blame] | 29 | void AST::emitJavaReaderWriter( |
| 30 | Formatter &out, |
| 31 | const std::string &parcelObj, |
| 32 | const TypedVar *arg, |
Yifan Hong | a47eef3 | 2016-12-12 10:38:54 -0800 | [diff] [blame] | 33 | bool isReader, |
| 34 | bool addPrefixToName) const { |
Andreas Huber | 2831d51 | 2016-08-15 09:33:47 -0700 | [diff] [blame] | 35 | if (isReader) { |
Yifan Hong | 4ed1347 | 2016-11-02 10:44:11 -0700 | [diff] [blame] | 36 | out << arg->type().getJavaType() |
Andreas Huber | 2831d51 | 2016-08-15 09:33:47 -0700 | [diff] [blame] | 37 | << " " |
Yifan Hong | a47eef3 | 2016-12-12 10:38:54 -0800 | [diff] [blame] | 38 | << (addPrefixToName ? "_hidl_out_" : "") |
Andreas Huber | 2831d51 | 2016-08-15 09:33:47 -0700 | [diff] [blame] | 39 | << arg->name() |
| 40 | << " = "; |
| 41 | } |
| 42 | |
Yifan Hong | a47eef3 | 2016-12-12 10:38:54 -0800 | [diff] [blame] | 43 | arg->type().emitJavaReaderWriter(out, parcelObj, |
| 44 | (addPrefixToName ? "_hidl_out_" : "") + arg->name(), |
| 45 | isReader); |
Andreas Huber | 2831d51 | 2016-08-15 09:33:47 -0700 | [diff] [blame] | 46 | } |
| 47 | |
Andreas Huber | 0fa9e39 | 2016-08-31 09:05:44 -0700 | [diff] [blame] | 48 | status_t AST::generateJavaTypes( |
Andreas Huber | d29724f | 2016-09-14 09:33:13 -0700 | [diff] [blame] | 49 | const std::string &outputPath, const std::string &limitToType) const { |
Andreas Huber | 85eabdb | 2016-08-25 11:24:49 -0700 | [diff] [blame] | 50 | // Splits types.hal up into one java file per declared type. |
| 51 | |
Steven Moreland | d537ab0 | 2016-09-12 10:32:01 -0700 | [diff] [blame] | 52 | for (const auto &type : mRootScope->getSubTypes()) { |
| 53 | std::string typeName = type->localName(); |
Andreas Huber | 85eabdb | 2016-08-25 11:24:49 -0700 | [diff] [blame] | 54 | |
| 55 | if (type->isTypeDef()) { |
| 56 | continue; |
| 57 | } |
| 58 | |
Andreas Huber | d29724f | 2016-09-14 09:33:13 -0700 | [diff] [blame] | 59 | if (!limitToType.empty() && typeName != limitToType) { |
Andreas Huber | 0fa9e39 | 2016-08-31 09:05:44 -0700 | [diff] [blame] | 60 | continue; |
| 61 | } |
| 62 | |
Andreas Huber | 85eabdb | 2016-08-25 11:24:49 -0700 | [diff] [blame] | 63 | std::string path = outputPath; |
| 64 | path.append(mCoordinator->convertPackageRootToPath(mPackage)); |
Yifan Hong | 97288ac | 2016-12-12 16:03:51 -0800 | [diff] [blame] | 65 | path.append(mCoordinator->getPackagePath(mPackage, true /* relative */, |
| 66 | true /* sanitized */)); |
Andreas Huber | 85eabdb | 2016-08-25 11:24:49 -0700 | [diff] [blame] | 67 | path.append(typeName); |
| 68 | path.append(".java"); |
| 69 | |
| 70 | CHECK(Coordinator::MakeParentHierarchy(path)); |
| 71 | FILE *file = fopen(path.c_str(), "w"); |
| 72 | |
| 73 | if (file == NULL) { |
| 74 | return -errno; |
| 75 | } |
| 76 | |
| 77 | Formatter out(file); |
| 78 | |
| 79 | std::vector<std::string> packageComponents; |
| 80 | getPackageAndVersionComponents( |
| 81 | &packageComponents, true /* cpp_compatible */); |
| 82 | |
| 83 | out << "package " << mPackage.javaPackage() << ";\n\n"; |
| 84 | |
Iliyan Malchev | 800273d | 2016-09-02 15:25:07 -0700 | [diff] [blame] | 85 | out << "\n"; |
| 86 | |
Andreas Huber | 85eabdb | 2016-08-25 11:24:49 -0700 | [diff] [blame] | 87 | status_t err = |
| 88 | type->emitJavaTypeDeclarations(out, true /* atTopLevel */); |
| 89 | |
| 90 | if (err != OK) { |
| 91 | return err; |
| 92 | } |
| 93 | } |
| 94 | |
| 95 | return OK; |
| 96 | } |
| 97 | |
Andreas Huber | 0fa9e39 | 2016-08-31 09:05:44 -0700 | [diff] [blame] | 98 | status_t AST::generateJava( |
Andreas Huber | d29724f | 2016-09-14 09:33:13 -0700 | [diff] [blame] | 99 | const std::string &outputPath, const std::string &limitToType) const { |
Andreas Huber | 0fa9e39 | 2016-08-31 09:05:44 -0700 | [diff] [blame] | 100 | if (!isJavaCompatible()) { |
Andreas Huber | 70a59e1 | 2016-08-16 12:57:01 -0700 | [diff] [blame] | 101 | fprintf(stderr, |
| 102 | "ERROR: This interface is not Java compatible. The Java backend" |
Andreas Huber | f03332a | 2016-09-22 15:35:43 -0700 | [diff] [blame] | 103 | " does NOT support union types nor native handles. " |
| 104 | "In addition, vectors of arrays are limited to at most " |
Andreas Huber | 86a112b | 2016-10-19 14:25:16 -0700 | [diff] [blame] | 105 | "one-dimensional arrays and vectors of {vectors,interfaces} are" |
| 106 | " not supported.\n"); |
Andreas Huber | 70a59e1 | 2016-08-16 12:57:01 -0700 | [diff] [blame] | 107 | |
Andreas Huber | 2831d51 | 2016-08-15 09:33:47 -0700 | [diff] [blame] | 108 | return UNKNOWN_ERROR; |
| 109 | } |
| 110 | |
Andreas Huber | 0fa9e39 | 2016-08-31 09:05:44 -0700 | [diff] [blame] | 111 | std::string ifaceName; |
| 112 | if (!AST::isInterface(&ifaceName)) { |
| 113 | return generateJavaTypes(outputPath, limitToType); |
| 114 | } |
| 115 | |
| 116 | const Interface *iface = mRootScope->getInterface(); |
| 117 | |
Jayant Chowdhary | 3f32c1f | 2016-09-15 16:53:56 -0700 | [diff] [blame] | 118 | const std::string baseName = iface->getBaseName(); |
Andreas Huber | 2831d51 | 2016-08-15 09:33:47 -0700 | [diff] [blame] | 119 | |
| 120 | std::string path = outputPath; |
| 121 | path.append(mCoordinator->convertPackageRootToPath(mPackage)); |
Yifan Hong | 97288ac | 2016-12-12 16:03:51 -0800 | [diff] [blame] | 122 | path.append(mCoordinator->getPackagePath(mPackage, true /* relative */, |
| 123 | true /* sanitized */)); |
Andreas Huber | 2831d51 | 2016-08-15 09:33:47 -0700 | [diff] [blame] | 124 | path.append(ifaceName); |
| 125 | path.append(".java"); |
| 126 | |
| 127 | CHECK(Coordinator::MakeParentHierarchy(path)); |
| 128 | FILE *file = fopen(path.c_str(), "w"); |
| 129 | |
| 130 | if (file == NULL) { |
| 131 | return -errno; |
| 132 | } |
| 133 | |
| 134 | Formatter out(file); |
| 135 | |
| 136 | std::vector<std::string> packageComponents; |
| 137 | getPackageAndVersionComponents( |
| 138 | &packageComponents, true /* cpp_compatible */); |
| 139 | |
| 140 | out << "package " << mPackage.javaPackage() << ";\n\n"; |
| 141 | |
Andreas Huber | 2831d51 | 2016-08-15 09:33:47 -0700 | [diff] [blame] | 142 | out.setNamespace(mPackage.javaPackage() + "."); |
| 143 | |
Andreas Huber | 2831d51 | 2016-08-15 09:33:47 -0700 | [diff] [blame] | 144 | const Interface *superType = iface->superType(); |
| 145 | |
| 146 | out << "public interface " << ifaceName << " extends "; |
| 147 | |
| 148 | if (superType != NULL) { |
| 149 | out << superType->fullJavaName(); |
| 150 | } else { |
Yifan Hong | 1af7353 | 2016-11-09 14:32:58 -0800 | [diff] [blame] | 151 | out << "android.os.IHwInterface"; |
Andreas Huber | 2831d51 | 2016-08-15 09:33:47 -0700 | [diff] [blame] | 152 | } |
| 153 | |
| 154 | out << " {\n"; |
| 155 | out.indent(); |
| 156 | |
| 157 | out << "public static final String kInterfaceName = \"" |
| 158 | << mPackage.string() |
| 159 | << "::" |
| 160 | << ifaceName |
| 161 | << "\";\n\n"; |
| 162 | |
Andreas Huber | 77641fb | 2017-04-04 14:42:09 -0700 | [diff] [blame] | 163 | out << "/* package private */ static " |
Andreas Huber | 2831d51 | 2016-08-15 09:33:47 -0700 | [diff] [blame] | 164 | << ifaceName |
Yifan Hong | 1af7353 | 2016-11-09 14:32:58 -0800 | [diff] [blame] | 165 | << " asInterface(android.os.IHwBinder binder) {\n"; |
Andreas Huber | 2831d51 | 2016-08-15 09:33:47 -0700 | [diff] [blame] | 166 | |
| 167 | out.indent(); |
| 168 | |
| 169 | out << "if (binder == null) {\n"; |
| 170 | out.indent(); |
| 171 | out << "return null;\n"; |
| 172 | out.unindent(); |
| 173 | out << "}\n\n"; |
| 174 | |
Yifan Hong | 1af7353 | 2016-11-09 14:32:58 -0800 | [diff] [blame] | 175 | out << "android.os.IHwInterface iface =\n"; |
Andreas Huber | 2831d51 | 2016-08-15 09:33:47 -0700 | [diff] [blame] | 176 | out.indent(); |
| 177 | out.indent(); |
| 178 | out << "binder.queryLocalInterface(kInterfaceName);\n\n"; |
| 179 | out.unindent(); |
| 180 | out.unindent(); |
| 181 | |
| 182 | out << "if ((iface != null) && (iface instanceof " |
| 183 | << ifaceName |
| 184 | << ")) {\n"; |
| 185 | |
| 186 | out.indent(); |
| 187 | out << "return (" << ifaceName << ")iface;\n"; |
| 188 | out.unindent(); |
| 189 | out << "}\n\n"; |
| 190 | |
Andreas Huber | 77641fb | 2017-04-04 14:42:09 -0700 | [diff] [blame] | 191 | out << ifaceName << " proxy = new " << ifaceName << ".Proxy(binder);\n\n"; |
| 192 | out << "try {\n"; |
| 193 | out.indent(); |
| 194 | out << "for (String descriptor : proxy.interfaceChain()) {\n"; |
| 195 | out.indent(); |
| 196 | out << "if (descriptor.equals(kInterfaceName)) {\n"; |
| 197 | out.indent(); |
| 198 | out << "return proxy;\n"; |
| 199 | out.unindent(); |
| 200 | out << "}\n"; |
| 201 | out.unindent(); |
| 202 | out << "}\n"; |
| 203 | out.unindent(); |
| 204 | out << "} catch (android.os.RemoteException e) {\n"; |
| 205 | out.indent(); |
| 206 | out.unindent(); |
| 207 | out << "}\n\n"; |
| 208 | |
| 209 | out << "return null;\n"; |
| 210 | |
| 211 | out.unindent(); |
| 212 | out << "}\n\n"; |
| 213 | |
| 214 | out << "public static " |
| 215 | << ifaceName |
| 216 | << " castFrom(android.os.IHwInterface iface) {\n"; |
| 217 | out.indent(); |
| 218 | |
| 219 | out << "return (iface == null) ? null : " |
| 220 | << ifaceName |
| 221 | << ".asInterface(iface.asBinder());\n"; |
Andreas Huber | 2831d51 | 2016-08-15 09:33:47 -0700 | [diff] [blame] | 222 | |
| 223 | out.unindent(); |
| 224 | out << "}\n\n"; |
| 225 | |
Yifan Hong | 084d11f | 2016-12-21 15:33:43 -0800 | [diff] [blame] | 226 | out << "@Override\npublic android.os.IHwBinder asBinder();\n\n"; |
Andreas Huber | 2831d51 | 2016-08-15 09:33:47 -0700 | [diff] [blame] | 227 | |
Andreas Huber | 2bb6e1e | 2016-10-25 13:26:43 -0700 | [diff] [blame] | 228 | out << "public static " |
| 229 | << ifaceName |
Yifan Hong | 38e563d | 2017-03-27 10:33:09 -0700 | [diff] [blame] | 230 | << " getService(String serviceName) throws android.os.RemoteException {\n"; |
Andreas Huber | 2bb6e1e | 2016-10-25 13:26:43 -0700 | [diff] [blame] | 231 | |
| 232 | out.indent(); |
| 233 | |
| 234 | out << "return " |
| 235 | << ifaceName |
Yifan Hong | 1af7353 | 2016-11-09 14:32:58 -0800 | [diff] [blame] | 236 | << ".asInterface(android.os.HwBinder.getService(\"" |
Steven Moreland | 7e367bf | 2016-11-04 11:31:41 -0700 | [diff] [blame] | 237 | << iface->fqName().string() |
| 238 | << "\",serviceName));\n"; |
Andreas Huber | 2bb6e1e | 2016-10-25 13:26:43 -0700 | [diff] [blame] | 239 | |
| 240 | out.unindent(); |
| 241 | |
| 242 | out << "}\n\n"; |
| 243 | |
Chris Phoenix | db0d634 | 2017-01-11 16:10:00 -0800 | [diff] [blame] | 244 | out << "public static " |
| 245 | << ifaceName |
Yifan Hong | 38e563d | 2017-03-27 10:33:09 -0700 | [diff] [blame] | 246 | << " getService() throws android.os.RemoteException {\n"; |
Chris Phoenix | db0d634 | 2017-01-11 16:10:00 -0800 | [diff] [blame] | 247 | |
| 248 | out.indent(); |
| 249 | |
| 250 | out << "return " |
| 251 | << ifaceName |
| 252 | << ".asInterface(android.os.HwBinder.getService(\"" |
| 253 | << iface->fqName().string() |
| 254 | << "\",\"default\"));\n"; |
| 255 | |
| 256 | out.unindent(); |
| 257 | |
| 258 | out << "}\n\n"; |
| 259 | |
Andreas Huber | 2831d51 | 2016-08-15 09:33:47 -0700 | [diff] [blame] | 260 | status_t err = emitJavaTypeDeclarations(out); |
| 261 | |
| 262 | if (err != OK) { |
| 263 | return err; |
| 264 | } |
| 265 | |
Andreas Huber | 2831d51 | 2016-08-15 09:33:47 -0700 | [diff] [blame] | 266 | for (const auto &method : iface->methods()) { |
Andreas Huber | 37065d6 | 2017-02-07 14:36:54 -0800 | [diff] [blame] | 267 | if (method->isHiddenFromJava()) { |
| 268 | continue; |
| 269 | } |
| 270 | |
Andreas Huber | 2831d51 | 2016-08-15 09:33:47 -0700 | [diff] [blame] | 271 | const bool returnsValue = !method->results().empty(); |
| 272 | const bool needsCallback = method->results().size() > 1; |
| 273 | |
| 274 | if (needsCallback) { |
Steven Moreland | bcd7903 | 2016-12-16 20:50:23 -0800 | [diff] [blame] | 275 | out << "\npublic interface " |
Andreas Huber | 2831d51 | 2016-08-15 09:33:47 -0700 | [diff] [blame] | 276 | << method->name() |
| 277 | << "Callback {\n"; |
| 278 | |
| 279 | out.indent(); |
| 280 | |
Yifan Hong | 7d234ea | 2017-03-30 15:40:22 -0700 | [diff] [blame] | 281 | out << "public void onValues("; |
| 282 | method->emitJavaResultSignature(out); |
| 283 | out << ");\n"; |
Andreas Huber | 2831d51 | 2016-08-15 09:33:47 -0700 | [diff] [blame] | 284 | |
| 285 | out.unindent(); |
| 286 | out << "}\n\n"; |
| 287 | } |
| 288 | |
| 289 | if (returnsValue && !needsCallback) { |
Yifan Hong | 4ed1347 | 2016-11-02 10:44:11 -0700 | [diff] [blame] | 290 | out << method->results()[0]->type().getJavaType(); |
Andreas Huber | 2831d51 | 2016-08-15 09:33:47 -0700 | [diff] [blame] | 291 | } else { |
| 292 | out << "void"; |
| 293 | } |
| 294 | |
| 295 | out << " " |
| 296 | << method->name() |
Yifan Hong | 7d234ea | 2017-03-30 15:40:22 -0700 | [diff] [blame] | 297 | << "("; |
| 298 | method->emitJavaArgSignature(out); |
Andreas Huber | 2831d51 | 2016-08-15 09:33:47 -0700 | [diff] [blame] | 299 | |
| 300 | if (needsCallback) { |
| 301 | if (!method->args().empty()) { |
| 302 | out << ", "; |
| 303 | } |
| 304 | |
| 305 | out << method->name() |
| 306 | << "Callback cb"; |
| 307 | } |
| 308 | |
Steven Moreland | dad1b30 | 2016-12-20 15:56:00 -0800 | [diff] [blame] | 309 | out << ")\n"; |
| 310 | out.indent(); |
Yifan Hong | 38e563d | 2017-03-27 10:33:09 -0700 | [diff] [blame] | 311 | out << "throws android.os.RemoteException;\n"; |
Steven Moreland | dad1b30 | 2016-12-20 15:56:00 -0800 | [diff] [blame] | 312 | out.unindent(); |
Andreas Huber | 2831d51 | 2016-08-15 09:33:47 -0700 | [diff] [blame] | 313 | } |
| 314 | |
| 315 | out << "\npublic static final class Proxy implements " |
| 316 | << ifaceName |
| 317 | << " {\n"; |
| 318 | |
| 319 | out.indent(); |
| 320 | |
Yifan Hong | 1af7353 | 2016-11-09 14:32:58 -0800 | [diff] [blame] | 321 | out << "private android.os.IHwBinder mRemote;\n\n"; |
| 322 | out << "public Proxy(android.os.IHwBinder remote) {\n"; |
Andreas Huber | 2831d51 | 2016-08-15 09:33:47 -0700 | [diff] [blame] | 323 | out.indent(); |
Yifan Hong | 729e796 | 2016-12-21 16:04:27 -0800 | [diff] [blame] | 324 | out << "mRemote = java.util.Objects.requireNonNull(remote);\n"; |
Andreas Huber | 2831d51 | 2016-08-15 09:33:47 -0700 | [diff] [blame] | 325 | out.unindent(); |
| 326 | out << "}\n\n"; |
| 327 | |
Yifan Hong | 084d11f | 2016-12-21 15:33:43 -0800 | [diff] [blame] | 328 | out << "@Override\npublic android.os.IHwBinder asBinder() {\n"; |
Andreas Huber | 2831d51 | 2016-08-15 09:33:47 -0700 | [diff] [blame] | 329 | out.indent(); |
| 330 | out << "return mRemote;\n"; |
| 331 | out.unindent(); |
| 332 | out << "}\n\n"; |
| 333 | |
Yifan Hong | e45b530 | 2017-02-22 10:49:07 -0800 | [diff] [blame] | 334 | |
| 335 | out << "@Override\npublic String toString() "; |
| 336 | out.block([&] { |
| 337 | out.sTry([&] { |
| 338 | out << "return this.interfaceDescriptor() + \"@Proxy\";\n"; |
Yifan Hong | 38e563d | 2017-03-27 10:33:09 -0700 | [diff] [blame] | 339 | }).sCatch("android.os.RemoteException ex", [&] { |
Yifan Hong | e45b530 | 2017-02-22 10:49:07 -0800 | [diff] [blame] | 340 | out << "/* ignored; handled below. */\n"; |
| 341 | }).endl(); |
| 342 | out << "return \"[class or subclass of \" + " |
| 343 | << ifaceName << ".kInterfaceName + \"]@Proxy\";\n"; |
| 344 | }).endl().endl(); |
| 345 | |
Yifan Hong | 10fe0b5 | 2016-10-19 14:20:17 -0700 | [diff] [blame] | 346 | const Interface *prevInterface = nullptr; |
| 347 | for (const auto &tuple : iface->allMethodsFromRoot()) { |
| 348 | const Method *method = tuple.method(); |
Andreas Huber | 37065d6 | 2017-02-07 14:36:54 -0800 | [diff] [blame] | 349 | |
| 350 | if (method->isHiddenFromJava()) { |
| 351 | continue; |
| 352 | } |
| 353 | |
Yifan Hong | 10fe0b5 | 2016-10-19 14:20:17 -0700 | [diff] [blame] | 354 | const Interface *superInterface = tuple.interface(); |
| 355 | if (prevInterface != superInterface) { |
| 356 | out << "// Methods from " |
| 357 | << superInterface->fullName() |
| 358 | << " follow.\n"; |
| 359 | prevInterface = superInterface; |
| 360 | } |
| 361 | const bool returnsValue = !method->results().empty(); |
| 362 | const bool needsCallback = method->results().size() > 1; |
Andreas Huber | 2831d51 | 2016-08-15 09:33:47 -0700 | [diff] [blame] | 363 | |
Yifan Hong | 084d11f | 2016-12-21 15:33:43 -0800 | [diff] [blame] | 364 | out << "@Override\npublic "; |
Yifan Hong | 10fe0b5 | 2016-10-19 14:20:17 -0700 | [diff] [blame] | 365 | if (returnsValue && !needsCallback) { |
Yifan Hong | 4ed1347 | 2016-11-02 10:44:11 -0700 | [diff] [blame] | 366 | out << method->results()[0]->type().getJavaType(); |
Yifan Hong | 10fe0b5 | 2016-10-19 14:20:17 -0700 | [diff] [blame] | 367 | } else { |
| 368 | out << "void"; |
| 369 | } |
Andreas Huber | 2831d51 | 2016-08-15 09:33:47 -0700 | [diff] [blame] | 370 | |
Yifan Hong | 10fe0b5 | 2016-10-19 14:20:17 -0700 | [diff] [blame] | 371 | out << " " |
| 372 | << method->name() |
Yifan Hong | 7d234ea | 2017-03-30 15:40:22 -0700 | [diff] [blame] | 373 | << "("; |
| 374 | method->emitJavaArgSignature(out); |
Andreas Huber | 2831d51 | 2016-08-15 09:33:47 -0700 | [diff] [blame] | 375 | |
Yifan Hong | 10fe0b5 | 2016-10-19 14:20:17 -0700 | [diff] [blame] | 376 | if (needsCallback) { |
| 377 | if (!method->args().empty()) { |
| 378 | out << ", "; |
Andreas Huber | 2831d51 | 2016-08-15 09:33:47 -0700 | [diff] [blame] | 379 | } |
| 380 | |
Yifan Hong | 10fe0b5 | 2016-10-19 14:20:17 -0700 | [diff] [blame] | 381 | out << method->name() |
| 382 | << "Callback cb"; |
| 383 | } |
Andreas Huber | 2831d51 | 2016-08-15 09:33:47 -0700 | [diff] [blame] | 384 | |
Steven Moreland | dad1b30 | 2016-12-20 15:56:00 -0800 | [diff] [blame] | 385 | out << ")\n"; |
Yifan Hong | 10fe0b5 | 2016-10-19 14:20:17 -0700 | [diff] [blame] | 386 | out.indent(); |
Steven Moreland | dad1b30 | 2016-12-20 15:56:00 -0800 | [diff] [blame] | 387 | out.indent(); |
Yifan Hong | 38e563d | 2017-03-27 10:33:09 -0700 | [diff] [blame] | 388 | out << "throws android.os.RemoteException {\n"; |
Steven Moreland | dad1b30 | 2016-12-20 15:56:00 -0800 | [diff] [blame] | 389 | out.unindent(); |
Andreas Huber | 2831d51 | 2016-08-15 09:33:47 -0700 | [diff] [blame] | 390 | |
Martijn Coenen | 115d428 | 2016-12-19 05:14:04 +0100 | [diff] [blame] | 391 | if (method->isHidlReserved() && method->overridesJavaImpl(IMPL_PROXY)) { |
| 392 | method->javaImpl(IMPL_PROXY, out); |
| 393 | out.unindent(); |
| 394 | out << "}\n"; |
| 395 | continue; |
| 396 | } |
Steven Moreland | 4b39bc1 | 2016-11-16 10:42:24 -0800 | [diff] [blame] | 397 | out << "android.os.HwParcel _hidl_request = new android.os.HwParcel();\n"; |
| 398 | out << "_hidl_request.writeInterfaceToken(" |
Yifan Hong | 10fe0b5 | 2016-10-19 14:20:17 -0700 | [diff] [blame] | 399 | << superInterface->fullJavaName() |
| 400 | << ".kInterfaceName);\n"; |
Andreas Huber | 2831d51 | 2016-08-15 09:33:47 -0700 | [diff] [blame] | 401 | |
Yifan Hong | 10fe0b5 | 2016-10-19 14:20:17 -0700 | [diff] [blame] | 402 | for (const auto &arg : method->args()) { |
| 403 | emitJavaReaderWriter( |
| 404 | out, |
Steven Moreland | 4b39bc1 | 2016-11-16 10:42:24 -0800 | [diff] [blame] | 405 | "_hidl_request", |
Yifan Hong | 10fe0b5 | 2016-10-19 14:20:17 -0700 | [diff] [blame] | 406 | arg, |
Yifan Hong | a47eef3 | 2016-12-12 10:38:54 -0800 | [diff] [blame] | 407 | false /* isReader */, |
| 408 | false /* addPrefixToName */); |
Yifan Hong | 10fe0b5 | 2016-10-19 14:20:17 -0700 | [diff] [blame] | 409 | } |
Andreas Huber | 2831d51 | 2016-08-15 09:33:47 -0700 | [diff] [blame] | 410 | |
Martijn Coenen | 4de083b | 2017-03-16 18:49:43 +0100 | [diff] [blame] | 411 | out << "\nandroid.os.HwParcel _hidl_reply = new android.os.HwParcel();\n"; |
Andreas Huber | 2831d51 | 2016-08-15 09:33:47 -0700 | [diff] [blame] | 412 | |
Martijn Coenen | 4de083b | 2017-03-16 18:49:43 +0100 | [diff] [blame] | 413 | out.sTry([&] { |
| 414 | out << "mRemote.transact(" |
| 415 | << method->getSerialId() |
| 416 | << " /* " |
| 417 | << method->name() |
| 418 | << " */, _hidl_request, _hidl_reply, "; |
Yifan Hong | 10fe0b5 | 2016-10-19 14:20:17 -0700 | [diff] [blame] | 419 | |
Martijn Coenen | 4de083b | 2017-03-16 18:49:43 +0100 | [diff] [blame] | 420 | if (method->isOneway()) { |
| 421 | out << "android.os.IHwBinder.FLAG_ONEWAY"; |
| 422 | } else { |
| 423 | out << "0 /* flags */"; |
Andreas Huber | 2831d51 | 2016-08-15 09:33:47 -0700 | [diff] [blame] | 424 | } |
| 425 | |
Martijn Coenen | 4de083b | 2017-03-16 18:49:43 +0100 | [diff] [blame] | 426 | out << ");\n"; |
Andreas Huber | 8b5da22 | 2016-08-18 14:28:18 -0700 | [diff] [blame] | 427 | |
Martijn Coenen | 4de083b | 2017-03-16 18:49:43 +0100 | [diff] [blame] | 428 | if (!method->isOneway()) { |
| 429 | out << "_hidl_reply.verifySuccess();\n"; |
| 430 | } else { |
| 431 | CHECK(!returnsValue); |
| 432 | } |
| 433 | |
| 434 | out << "_hidl_request.releaseTemporaryStorage();\n"; |
| 435 | |
| 436 | if (returnsValue) { |
| 437 | out << "\n"; |
| 438 | |
Andreas Huber | 2831d51 | 2016-08-15 09:33:47 -0700 | [diff] [blame] | 439 | for (const auto &arg : method->results()) { |
Martijn Coenen | 4de083b | 2017-03-16 18:49:43 +0100 | [diff] [blame] | 440 | emitJavaReaderWriter( |
| 441 | out, |
| 442 | "_hidl_reply", |
| 443 | arg, |
| 444 | true /* isReader */, |
| 445 | true /* addPrefixToName */); |
Andreas Huber | 2831d51 | 2016-08-15 09:33:47 -0700 | [diff] [blame] | 446 | } |
Andreas Huber | 2831d51 | 2016-08-15 09:33:47 -0700 | [diff] [blame] | 447 | |
Martijn Coenen | 4de083b | 2017-03-16 18:49:43 +0100 | [diff] [blame] | 448 | if (needsCallback) { |
| 449 | out << "cb.onValues("; |
| 450 | |
| 451 | bool firstField = true; |
| 452 | for (const auto &arg : method->results()) { |
| 453 | if (!firstField) { |
| 454 | out << ", "; |
| 455 | } |
| 456 | |
| 457 | out << "_hidl_out_" << arg->name(); |
| 458 | firstField = false; |
| 459 | } |
| 460 | |
| 461 | out << ");\n"; |
| 462 | } else { |
| 463 | const std::string returnName = method->results()[0]->name(); |
| 464 | out << "return _hidl_out_" << returnName << ";\n"; |
| 465 | } |
Yifan Hong | 10fe0b5 | 2016-10-19 14:20:17 -0700 | [diff] [blame] | 466 | } |
Martijn Coenen | 4de083b | 2017-03-16 18:49:43 +0100 | [diff] [blame] | 467 | }).sFinally([&] { |
| 468 | out << "_hidl_reply.release();\n"; |
| 469 | }).endl(); |
Yifan Hong | 10fe0b5 | 2016-10-19 14:20:17 -0700 | [diff] [blame] | 470 | |
| 471 | out.unindent(); |
| 472 | out << "}\n\n"; |
Andreas Huber | 2831d51 | 2016-08-15 09:33:47 -0700 | [diff] [blame] | 473 | } |
| 474 | |
| 475 | out.unindent(); |
| 476 | out << "}\n"; |
| 477 | |
| 478 | //////////////////////////////////////////////////////////////////////////// |
| 479 | |
Yifan Hong | 1af7353 | 2016-11-09 14:32:58 -0800 | [diff] [blame] | 480 | out << "\npublic static abstract class Stub extends android.os.HwBinder " |
Andreas Huber | 2831d51 | 2016-08-15 09:33:47 -0700 | [diff] [blame] | 481 | << "implements " |
| 482 | << ifaceName << " {\n"; |
| 483 | |
| 484 | out.indent(); |
| 485 | |
Yifan Hong | 084d11f | 2016-12-21 15:33:43 -0800 | [diff] [blame] | 486 | out << "@Override\npublic android.os.IHwBinder asBinder() {\n"; |
Andreas Huber | 2831d51 | 2016-08-15 09:33:47 -0700 | [diff] [blame] | 487 | out.indent(); |
| 488 | out << "return this;\n"; |
| 489 | out.unindent(); |
| 490 | out << "}\n\n"; |
| 491 | |
Yifan Hong | 10fe0b5 | 2016-10-19 14:20:17 -0700 | [diff] [blame] | 492 | for (Method *method : iface->hidlReservedMethods()) { |
Andreas Huber | 37065d6 | 2017-02-07 14:36:54 -0800 | [diff] [blame] | 493 | if (method->isHiddenFromJava()) { |
| 494 | continue; |
| 495 | } |
| 496 | |
Martijn Coenen | af712c0 | 2016-11-16 15:26:27 +0100 | [diff] [blame] | 497 | // b/32383557 this is a hack. We need to change this if we have more reserved methods. |
| 498 | CHECK_LE(method->results().size(), 1u); |
| 499 | std::string resultType = method->results().size() == 0 ? "void" : |
| 500 | method->results()[0]->type().getJavaType(); |
Yifan Hong | 084d11f | 2016-12-21 15:33:43 -0800 | [diff] [blame] | 501 | out << "@Override\npublic final " |
Martijn Coenen | af712c0 | 2016-11-16 15:26:27 +0100 | [diff] [blame] | 502 | << resultType |
Yifan Hong | 10fe0b5 | 2016-10-19 14:20:17 -0700 | [diff] [blame] | 503 | << " " |
| 504 | << method->name() |
Yifan Hong | 7d234ea | 2017-03-30 15:40:22 -0700 | [diff] [blame] | 505 | << "("; |
| 506 | method->emitJavaArgSignature(out); |
| 507 | out << ") {\n"; |
Martijn Coenen | 115d428 | 2016-12-19 05:14:04 +0100 | [diff] [blame] | 508 | |
Yifan Hong | 10fe0b5 | 2016-10-19 14:20:17 -0700 | [diff] [blame] | 509 | out.indent(); |
Steven Moreland | 937408a | 2017-03-20 09:54:18 -0700 | [diff] [blame] | 510 | method->javaImpl(IMPL_INTERFACE, out); |
Yifan Hong | 10fe0b5 | 2016-10-19 14:20:17 -0700 | [diff] [blame] | 511 | out.unindent(); |
| 512 | out << "\n}\n\n"; |
| 513 | } |
| 514 | |
Yifan Hong | 084d11f | 2016-12-21 15:33:43 -0800 | [diff] [blame] | 515 | out << "@Override\n" |
| 516 | << "public android.os.IHwInterface queryLocalInterface(String descriptor) {\n"; |
Andreas Huber | 2831d51 | 2016-08-15 09:33:47 -0700 | [diff] [blame] | 517 | out.indent(); |
| 518 | // XXX what about potential superClasses? |
| 519 | out << "if (kInterfaceName.equals(descriptor)) {\n"; |
| 520 | out.indent(); |
| 521 | out << "return this;\n"; |
| 522 | out.unindent(); |
| 523 | out << "}\n"; |
| 524 | out << "return null;\n"; |
| 525 | out.unindent(); |
| 526 | out << "}\n\n"; |
| 527 | |
Yifan Hong | 38e563d | 2017-03-27 10:33:09 -0700 | [diff] [blame] | 528 | out << "public void registerAsService(String serviceName) throws android.os.RemoteException {\n"; |
Andreas Huber | 2bb6e1e | 2016-10-25 13:26:43 -0700 | [diff] [blame] | 529 | out.indent(); |
| 530 | |
Martijn Coenen | bc9f5c9 | 2017-03-06 13:04:05 +0100 | [diff] [blame] | 531 | out << "registerService(serviceName);\n"; |
Andreas Huber | 2bb6e1e | 2016-10-25 13:26:43 -0700 | [diff] [blame] | 532 | |
| 533 | out.unindent(); |
| 534 | out << "}\n\n"; |
| 535 | |
Yifan Hong | e45b530 | 2017-02-22 10:49:07 -0800 | [diff] [blame] | 536 | out << "@Override\npublic String toString() "; |
| 537 | out.block([&] { |
| 538 | out << "return this.interfaceDescriptor() + \"@Stub\";\n"; |
| 539 | }).endl().endl(); |
| 540 | |
Yifan Hong | 084d11f | 2016-12-21 15:33:43 -0800 | [diff] [blame] | 541 | out << "@Override\n" |
| 542 | << "public void onTransact(" |
Steven Moreland | 4b39bc1 | 2016-11-16 10:42:24 -0800 | [diff] [blame] | 543 | << "int _hidl_code, " |
| 544 | << "android.os.HwParcel _hidl_request, " |
| 545 | << "final android.os.HwParcel _hidl_reply, " |
Steven Moreland | dad1b30 | 2016-12-20 15:56:00 -0800 | [diff] [blame] | 546 | << "int _hidl_flags)\n"; |
Andreas Huber | 2831d51 | 2016-08-15 09:33:47 -0700 | [diff] [blame] | 547 | out.indent(); |
Steven Moreland | dad1b30 | 2016-12-20 15:56:00 -0800 | [diff] [blame] | 548 | out.indent(); |
Yifan Hong | 38e563d | 2017-03-27 10:33:09 -0700 | [diff] [blame] | 549 | out << "throws android.os.RemoteException {\n"; |
Steven Moreland | dad1b30 | 2016-12-20 15:56:00 -0800 | [diff] [blame] | 550 | out.unindent(); |
Andreas Huber | 2831d51 | 2016-08-15 09:33:47 -0700 | [diff] [blame] | 551 | |
Steven Moreland | 4b39bc1 | 2016-11-16 10:42:24 -0800 | [diff] [blame] | 552 | out << "switch (_hidl_code) {\n"; |
Andreas Huber | 2831d51 | 2016-08-15 09:33:47 -0700 | [diff] [blame] | 553 | |
| 554 | out.indent(); |
| 555 | |
Yifan Hong | 10fe0b5 | 2016-10-19 14:20:17 -0700 | [diff] [blame] | 556 | for (const auto &tuple : iface->allMethodsFromRoot()) { |
| 557 | const Method *method = tuple.method(); |
Andreas Huber | 37065d6 | 2017-02-07 14:36:54 -0800 | [diff] [blame] | 558 | |
Yifan Hong | 10fe0b5 | 2016-10-19 14:20:17 -0700 | [diff] [blame] | 559 | const Interface *superInterface = tuple.interface(); |
| 560 | const bool returnsValue = !method->results().empty(); |
| 561 | const bool needsCallback = method->results().size() > 1; |
Andreas Huber | 2831d51 | 2016-08-15 09:33:47 -0700 | [diff] [blame] | 562 | |
Yifan Hong | 10fe0b5 | 2016-10-19 14:20:17 -0700 | [diff] [blame] | 563 | out << "case " |
| 564 | << method->getSerialId() |
| 565 | << " /* " |
| 566 | << method->name() |
| 567 | << " */:\n{\n"; |
Andreas Huber | 2831d51 | 2016-08-15 09:33:47 -0700 | [diff] [blame] | 568 | |
Yifan Hong | 10fe0b5 | 2016-10-19 14:20:17 -0700 | [diff] [blame] | 569 | out.indent(); |
Andreas Huber | 37065d6 | 2017-02-07 14:36:54 -0800 | [diff] [blame] | 570 | |
Martijn Coenen | 115d428 | 2016-12-19 05:14:04 +0100 | [diff] [blame] | 571 | if (method->isHidlReserved() && method->overridesJavaImpl(IMPL_STUB)) { |
| 572 | method->javaImpl(IMPL_STUB, out); |
| 573 | out.unindent(); |
| 574 | out << "break;\n"; |
| 575 | out << "}\n\n"; |
| 576 | continue; |
| 577 | } |
Andreas Huber | 2831d51 | 2016-08-15 09:33:47 -0700 | [diff] [blame] | 578 | |
Steven Moreland | 4b39bc1 | 2016-11-16 10:42:24 -0800 | [diff] [blame] | 579 | out << "_hidl_request.enforceInterface(" |
Yifan Hong | 10fe0b5 | 2016-10-19 14:20:17 -0700 | [diff] [blame] | 580 | << superInterface->fullJavaName() |
| 581 | << ".kInterfaceName);\n\n"; |
| 582 | |
Andreas Huber | 37065d6 | 2017-02-07 14:36:54 -0800 | [diff] [blame] | 583 | if (method->isHiddenFromJava()) { |
| 584 | // This is a method hidden from the Java side of things, it must not |
| 585 | // return any value and will simply signal success. |
| 586 | CHECK(!returnsValue); |
| 587 | |
| 588 | out << "_hidl_reply.writeStatus(android.os.HwParcel.STATUS_SUCCESS);\n"; |
| 589 | out << "_hidl_reply.send();\n"; |
| 590 | out << "break;\n"; |
| 591 | out.unindent(); |
| 592 | out << "}\n\n"; |
| 593 | continue; |
| 594 | } |
| 595 | |
Yifan Hong | 10fe0b5 | 2016-10-19 14:20:17 -0700 | [diff] [blame] | 596 | for (const auto &arg : method->args()) { |
| 597 | emitJavaReaderWriter( |
| 598 | out, |
Steven Moreland | 4b39bc1 | 2016-11-16 10:42:24 -0800 | [diff] [blame] | 599 | "_hidl_request", |
Yifan Hong | 10fe0b5 | 2016-10-19 14:20:17 -0700 | [diff] [blame] | 600 | arg, |
Yifan Hong | a47eef3 | 2016-12-12 10:38:54 -0800 | [diff] [blame] | 601 | true /* isReader */, |
| 602 | false /* addPrefixToName */); |
Yifan Hong | 10fe0b5 | 2016-10-19 14:20:17 -0700 | [diff] [blame] | 603 | } |
| 604 | |
| 605 | if (!needsCallback && returnsValue) { |
| 606 | const TypedVar *returnArg = method->results()[0]; |
Yifan Hong | 10fe0b5 | 2016-10-19 14:20:17 -0700 | [diff] [blame] | 607 | |
Yifan Hong | 4ed1347 | 2016-11-02 10:44:11 -0700 | [diff] [blame] | 608 | out << returnArg->type().getJavaType() |
Yifan Hong | a47eef3 | 2016-12-12 10:38:54 -0800 | [diff] [blame] | 609 | << " _hidl_out_" |
Yifan Hong | 10fe0b5 | 2016-10-19 14:20:17 -0700 | [diff] [blame] | 610 | << returnArg->name() |
| 611 | << " = "; |
| 612 | } |
| 613 | |
| 614 | out << method->name() |
| 615 | << "("; |
| 616 | |
| 617 | bool firstField = true; |
| 618 | for (const auto &arg : method->args()) { |
| 619 | if (!firstField) { |
| 620 | out << ", "; |
| 621 | } |
| 622 | |
| 623 | out << arg->name(); |
| 624 | |
| 625 | firstField = false; |
| 626 | } |
| 627 | |
| 628 | if (needsCallback) { |
| 629 | if (!firstField) { |
| 630 | out << ", "; |
| 631 | } |
| 632 | |
| 633 | out << "new " << method->name() << "Callback() {\n"; |
Andreas Huber | 2831d51 | 2016-08-15 09:33:47 -0700 | [diff] [blame] | 634 | out.indent(); |
| 635 | |
Yifan Hong | 10fe0b5 | 2016-10-19 14:20:17 -0700 | [diff] [blame] | 636 | out << "@Override\n" |
Yifan Hong | 7d234ea | 2017-03-30 15:40:22 -0700 | [diff] [blame] | 637 | << "public void onValues("; |
| 638 | method->emitJavaResultSignature(out); |
| 639 | out << ") {\n"; |
Andreas Huber | 2831d51 | 2016-08-15 09:33:47 -0700 | [diff] [blame] | 640 | |
Yifan Hong | 10fe0b5 | 2016-10-19 14:20:17 -0700 | [diff] [blame] | 641 | out.indent(); |
Steven Moreland | 4b39bc1 | 2016-11-16 10:42:24 -0800 | [diff] [blame] | 642 | out << "_hidl_reply.writeStatus(android.os.HwParcel.STATUS_SUCCESS);\n"; |
Yifan Hong | 10fe0b5 | 2016-10-19 14:20:17 -0700 | [diff] [blame] | 643 | |
| 644 | for (const auto &arg : method->results()) { |
Andreas Huber | 2831d51 | 2016-08-15 09:33:47 -0700 | [diff] [blame] | 645 | emitJavaReaderWriter( |
| 646 | out, |
Steven Moreland | 4b39bc1 | 2016-11-16 10:42:24 -0800 | [diff] [blame] | 647 | "_hidl_reply", |
Andreas Huber | 2831d51 | 2016-08-15 09:33:47 -0700 | [diff] [blame] | 648 | arg, |
Yifan Hong | a47eef3 | 2016-12-12 10:38:54 -0800 | [diff] [blame] | 649 | false /* isReader */, |
| 650 | false /* addPrefixToName */); |
| 651 | // no need to add _hidl_out because out vars are are scoped |
Andreas Huber | 2831d51 | 2016-08-15 09:33:47 -0700 | [diff] [blame] | 652 | } |
| 653 | |
Steven Moreland | 4b39bc1 | 2016-11-16 10:42:24 -0800 | [diff] [blame] | 654 | out << "_hidl_reply.send();\n" |
Yifan Hong | 10fe0b5 | 2016-10-19 14:20:17 -0700 | [diff] [blame] | 655 | << "}}"; |
Andreas Huber | 2831d51 | 2016-08-15 09:33:47 -0700 | [diff] [blame] | 656 | |
Andreas Huber | 2831d51 | 2016-08-15 09:33:47 -0700 | [diff] [blame] | 657 | out.unindent(); |
Yifan Hong | 10fe0b5 | 2016-10-19 14:20:17 -0700 | [diff] [blame] | 658 | out.unindent(); |
Andreas Huber | 2831d51 | 2016-08-15 09:33:47 -0700 | [diff] [blame] | 659 | } |
Yifan Hong | 10fe0b5 | 2016-10-19 14:20:17 -0700 | [diff] [blame] | 660 | |
| 661 | out << ");\n"; |
| 662 | |
Martijn Coenen | 0bb0d41 | 2017-02-08 10:21:30 +0100 | [diff] [blame] | 663 | if (!needsCallback && !method->isOneway()) { |
Steven Moreland | 4b39bc1 | 2016-11-16 10:42:24 -0800 | [diff] [blame] | 664 | out << "_hidl_reply.writeStatus(android.os.HwParcel.STATUS_SUCCESS);\n"; |
Yifan Hong | 10fe0b5 | 2016-10-19 14:20:17 -0700 | [diff] [blame] | 665 | |
| 666 | if (returnsValue) { |
| 667 | const TypedVar *returnArg = method->results()[0]; |
| 668 | |
| 669 | emitJavaReaderWriter( |
| 670 | out, |
Steven Moreland | 4b39bc1 | 2016-11-16 10:42:24 -0800 | [diff] [blame] | 671 | "_hidl_reply", |
Yifan Hong | 10fe0b5 | 2016-10-19 14:20:17 -0700 | [diff] [blame] | 672 | returnArg, |
Yifan Hong | a47eef3 | 2016-12-12 10:38:54 -0800 | [diff] [blame] | 673 | false /* isReader */, |
| 674 | true /* addPrefixToName */); |
Yifan Hong | 10fe0b5 | 2016-10-19 14:20:17 -0700 | [diff] [blame] | 675 | } |
| 676 | |
Steven Moreland | 4b39bc1 | 2016-11-16 10:42:24 -0800 | [diff] [blame] | 677 | out << "_hidl_reply.send();\n"; |
Yifan Hong | 10fe0b5 | 2016-10-19 14:20:17 -0700 | [diff] [blame] | 678 | } |
| 679 | |
| 680 | out << "break;\n"; |
| 681 | out.unindent(); |
| 682 | out << "}\n\n"; |
Andreas Huber | 2831d51 | 2016-08-15 09:33:47 -0700 | [diff] [blame] | 683 | } |
| 684 | |
| 685 | out.unindent(); |
| 686 | out << "}\n"; |
| 687 | |
| 688 | out.unindent(); |
| 689 | out << "}\n"; |
| 690 | |
| 691 | out.unindent(); |
| 692 | out << "}\n"; |
| 693 | |
| 694 | out.unindent(); |
| 695 | out << "}\n"; |
| 696 | |
| 697 | return OK; |
| 698 | } |
| 699 | |
| 700 | status_t AST::emitJavaTypeDeclarations(Formatter &out) const { |
Andreas Huber | 85eabdb | 2016-08-25 11:24:49 -0700 | [diff] [blame] | 701 | return mRootScope->emitJavaTypeDeclarations(out, false /* atTopLevel */); |
Andreas Huber | 2831d51 | 2016-08-15 09:33:47 -0700 | [diff] [blame] | 702 | } |
| 703 | |
| 704 | } // namespace android |