blob: cd2e247bb276f60298984ba6f3191e94e774025a [file] [log] [blame]
Christopher Wiley89eaab52015-09-15 14:46:46 -07001/*
2 * Copyright (C) 2015, 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 */
Adam Lesinskiffa16862014-01-23 18:17:42 -080016
Christopher Wileyf690be52015-09-14 15:19:10 -070017#include "aidl.h"
Adam Lesinskiffa16862014-01-23 18:17:42 -080018
Christopher Wileyf690be52015-09-14 15:19:10 -070019#include <fcntl.h>
Adam Lesinskiffa16862014-01-23 18:17:42 -080020#include <stdio.h>
21#include <stdlib.h>
22#include <string.h>
Christopher Wileyf690be52015-09-14 15:19:10 -070023#include <sys/param.h>
24#include <sys/stat.h>
25#include <unistd.h>
Jiyong Park02da7422018-07-16 16:00:26 +090026#include <algorithm>
Jiyong Park1deecc32018-07-17 01:14:41 +090027#include <iostream>
28#include <map>
29#include <memory>
Adam Lesinskiffa16862014-01-23 18:17:42 -080030
Elliott Hughes549b6e22015-08-17 12:41:46 -070031#ifdef _WIN32
Adam Lesinskiffa16862014-01-23 18:17:42 -080032#include <io.h>
Andrew Hsieh15ce9942014-05-07 20:14:30 +080033#include <direct.h>
Adam Lesinskiffa16862014-01-23 18:17:42 -080034#include <sys/stat.h>
35#endif
36
Elliott Hughes0a620672015-12-04 13:53:18 -080037#include <android-base/strings.h>
Christopher Wileyf690be52015-09-14 15:19:10 -070038
Christopher Wileyf690be52015-09-14 15:19:10 -070039#include "aidl_language.h"
Jiyong Parke05195e2018-10-08 18:24:23 +090040#include "aidl_typenames.h"
Christopher Wileyeb1acc12015-09-16 11:25:13 -070041#include "generate_cpp.h"
Christopher Wileyf690be52015-09-14 15:19:10 -070042#include "generate_java.h"
Steven Morelandc26d8142018-09-17 14:25:33 -070043#include "generate_ndk.h"
Christopher Wiley72877ac2015-10-06 14:41:42 -070044#include "import_resolver.h"
Christopher Wileyf690be52015-09-14 15:19:10 -070045#include "logging.h"
46#include "options.h"
47#include "os.h"
Christopher Wileye3550c62015-09-29 13:26:10 -070048#include "type_cpp.h"
Christopher Wiley775fa1f2015-09-22 15:00:12 -070049#include "type_java.h"
Christopher Wiley84c1eac2015-09-23 13:29:28 -070050#include "type_namespace.h"
Christopher Wileyf690be52015-09-14 15:19:10 -070051
Adam Lesinskiffa16862014-01-23 18:17:42 -080052#ifndef O_BINARY
53# define O_BINARY 0
54#endif
55
Christopher Wiley3a9911c2016-01-19 12:59:09 -080056using android::base::Join;
Christopher Wileyd76067c2015-10-19 17:00:13 -070057using android::base::Split;
Christopher Wileyc16e5e72015-09-16 10:49:40 -070058using std::cerr;
59using std::endl;
Christopher Wiley9f4c7ae2015-08-24 14:07:32 -070060using std::map;
61using std::set;
62using std::string;
Christopher Wiley84c1eac2015-09-23 13:29:28 -070063using std::unique_ptr;
Christopher Wiley9f4c7ae2015-08-24 14:07:32 -070064using std::vector;
Adam Lesinskiffa16862014-01-23 18:17:42 -080065
Christopher Wileyf690be52015-09-14 15:19:10 -070066namespace android {
67namespace aidl {
68namespace {
Adam Lesinskiffa16862014-01-23 18:17:42 -080069
Christopher Wileyf690be52015-09-14 15:19:10 -070070// The following are gotten as the offset from the allowable id's between
71// android.os.IBinder.FIRST_CALL_TRANSACTION=1 and
72// android.os.IBinder.LAST_CALL_TRANSACTION=16777215
73const int kMinUserSetMethodId = 0;
Jiyong Park309668e2018-07-28 16:55:44 +090074const int kMaxUserSetMethodId = 0x00ffffff;
75
76// IDs for meta transactions. Most of the meta transactions are implemented in
77// the framework side (Binder.java or Binder.cpp). But these are the ones that
78// are auto-implemented by the AIDL compiler.
79const int kGetInterfaceVersionId = ('_' << 24) | ('V' << 16) | ('E' << 8) | 'R';
Adam Lesinskiffa16862014-01-23 18:17:42 -080080
Steven Moreland92c55f12018-07-31 14:08:37 -070081bool check_filename(const std::string& filename, const AidlDefinedType& defined_type) {
Adam Lesinskiffa16862014-01-23 18:17:42 -080082 const char* p;
83 string expected;
84 string fn;
85 size_t len;
Adam Lesinskiffa16862014-01-23 18:17:42 -080086 bool valid = false;
87
Christopher Wileybc2df692016-06-02 16:27:26 -070088 if (!IoDelegate::GetAbsolutePath(filename, &fn)) {
89 return false;
Adam Lesinskiffa16862014-01-23 18:17:42 -080090 }
91
Steven Moreland92c55f12018-07-31 14:08:37 -070092 const std::string package = defined_type.GetPackage();
Casey Dahlinfb7da2e2015-10-08 17:26:09 -070093 if (!package.empty()) {
Adam Lesinskiffa16862014-01-23 18:17:42 -080094 expected = package;
95 expected += '.';
96 }
97
98 len = expected.length();
99 for (size_t i=0; i<len; i++) {
100 if (expected[i] == '.') {
101 expected[i] = OS_PATH_SEPARATOR;
102 }
103 }
104
Steven Moreland92c55f12018-07-31 14:08:37 -0700105 const std::string name = defined_type.GetName();
Casey Dahlinfb7da2e2015-10-08 17:26:09 -0700106 expected.append(name, 0, name.find('.'));
Christopher Wiley8f8cc9b2015-09-14 13:47:40 -0700107
Adam Lesinskiffa16862014-01-23 18:17:42 -0800108 expected += ".aidl";
109
110 len = fn.length();
111 valid = (len >= expected.length());
112
113 if (valid) {
114 p = fn.c_str() + (len - expected.length());
115
Elliott Hughesce310da2015-07-29 08:44:17 -0700116#ifdef _WIN32
Adam Lesinskiffa16862014-01-23 18:17:42 -0800117 if (OS_PATH_SEPARATOR != '/') {
118 // Input filename under cygwin most likely has / separators
119 // whereas the expected string uses \\ separators. Adjust
120 // them accordingly.
121 for (char *c = const_cast<char *>(p); *c; ++c) {
122 if (*c == '/') *c = OS_PATH_SEPARATOR;
123 }
124 }
125#endif
126
Yabin Cui482eefb2014-11-10 15:01:43 -0800127 // aidl assumes case-insensitivity on Mac Os and Windows.
128#if defined(__linux__)
Adam Lesinskiffa16862014-01-23 18:17:42 -0800129 valid = (expected == p);
130#else
131 valid = !strcasecmp(expected.c_str(), p);
132#endif
133 }
134
135 if (!valid) {
Steven Moreland92c55f12018-07-31 14:08:37 -0700136 AIDL_ERROR(defined_type) << name << " should be declared in a file called " << expected;
Adam Lesinskiffa16862014-01-23 18:17:42 -0800137 }
138
Casey Dahlin42727f82015-10-12 19:23:40 -0700139 return valid;
Adam Lesinskiffa16862014-01-23 18:17:42 -0800140}
141
Jeongik Cha37179582018-11-13 14:30:52 +0900142bool register_types(const AidlStructuredParcelable* parcel, TypeNamespace* types) {
Jeongik Cha17f7fd42018-10-31 11:27:59 +0900143 for (const auto& v : parcel->GetFields()) {
Jeongik Cha37179582018-11-13 14:30:52 +0900144 if (!types->MaybeAddContainerType(v->GetType())) {
145 return false;
146 }
Jeongik Chae51a5ea2018-11-01 06:36:09 +0000147
148 const ValidatableType* type = types->GetReturnType(v->GetType(), *parcel);
Jeongik Cha37179582018-11-13 14:30:52 +0900149 if (type == nullptr) {
150 return false;
151 }
Jeongik Chae51a5ea2018-11-01 06:36:09 +0000152 v->GetMutableType()->SetLanguageType(type);
Steven Moreland5557f1c2018-07-02 13:50:23 -0700153 }
Jeongik Cha37179582018-11-13 14:30:52 +0900154 return true;
Steven Moreland5557f1c2018-07-02 13:50:23 -0700155}
156
Jeongik Cha37179582018-11-13 14:30:52 +0900157bool register_types(const AidlInterface* c, TypeNamespace* types) {
Casey Dahlinfb7da2e2015-10-08 17:26:09 -0700158 for (const auto& m : c->GetMethods()) {
Jeongik Cha37179582018-11-13 14:30:52 +0900159 if (!types->MaybeAddContainerType(m->GetType())) {
160 return false;
161 }
Jeongik Chae51a5ea2018-11-01 06:36:09 +0000162
163 const ValidatableType* return_type = types->GetReturnType(m->GetType(), *c);
164
Jeongik Cha37179582018-11-13 14:30:52 +0900165 if (return_type == nullptr) {
166 return false;
167 }
Jeongik Chae51a5ea2018-11-01 06:36:09 +0000168 m->GetMutableType()->SetLanguageType(return_type);
169
Steven Morelandb3cd3c72018-10-11 12:37:45 -0700170 set<string> argument_names;
Jeongik Chadb0f59e2018-11-01 18:11:21 +0900171
Jeongik Chae51a5ea2018-11-01 06:36:09 +0000172 int index = 1;
Casey Dahlinf4a93112015-10-05 16:58:09 -0700173 for (const auto& arg : m->GetArguments()) {
Jeongik Cha37179582018-11-13 14:30:52 +0900174 if (!types->MaybeAddContainerType(arg->GetType())) {
175 return false;
176 }
Jeongik Chae51a5ea2018-11-01 06:36:09 +0000177
178 const ValidatableType* arg_type = types->GetArgType(*arg, index, *c);
Jeongik Cha37179582018-11-13 14:30:52 +0900179 if (arg_type == nullptr) {
180 return false;
181 }
Jeongik Chae51a5ea2018-11-01 06:36:09 +0000182 arg->GetMutableType()->SetLanguageType(arg_type);
Jiyong Park309668e2018-07-28 16:55:44 +0900183 }
Christopher Wileyfb4b22d2015-09-25 15:16:13 -0700184 }
Steven Moreland4d12f9a2018-10-31 14:30:55 -0700185
186 for (const std::unique_ptr<AidlConstantDeclaration>& constant : c->GetConstantDeclarations()) {
187 AidlTypeSpecifier* specifier = constant->GetMutableType();
188 const ValidatableType* return_type = types->GetReturnType(*specifier, *c);
Jeongik Cha37179582018-11-13 14:30:52 +0900189 if (return_type == nullptr) {
190 return false;
191 }
Steven Moreland4d12f9a2018-10-31 14:30:55 -0700192 specifier->SetLanguageType(return_type);
193 }
Jeongik Cha37179582018-11-13 14:30:52 +0900194
195 return true;
Adam Lesinskiffa16862014-01-23 18:17:42 -0800196}
197
Jiyong Park74595c12018-07-23 15:22:50 +0900198bool write_dep_file(const Options& options, const AidlDefinedType& defined_type,
Jiyong Parkb034bf02018-07-30 17:44:33 +0900199 const vector<string>& imports, const IoDelegate& io_delegate,
Jiyong Park74595c12018-07-23 15:22:50 +0900200 const string& input_file, const string& output_file) {
201 string dep_file_name = options.DependencyFile();
202 if (dep_file_name.empty() && options.AutoDepFile()) {
203 dep_file_name = output_file + ".d";
204 }
205
206 if (dep_file_name.empty()) {
207 return true; // nothing to do
208 }
Jiyong Park05463732018-08-09 16:03:02 +0900209
Jiyong Park74595c12018-07-23 15:22:50 +0900210 CodeWriterPtr writer = io_delegate.GetCodeWriter(dep_file_name);
211 if (!writer) {
212 LOG(ERROR) << "Could not open dependency file: " << dep_file_name;
213 return false;
214 }
215
216 vector<string> source_aidl = {input_file};
217 for (const auto& import : imports) {
Jiyong Parkb034bf02018-07-30 17:44:33 +0900218 source_aidl.push_back(import);
Jiyong Park74595c12018-07-23 15:22:50 +0900219 }
220
Christopher Wiley3a9911c2016-01-19 12:59:09 -0800221 // Encode that the output file depends on aidl input files.
222 writer->Write("%s : \\\n", output_file.c_str());
Jiyong Park74595c12018-07-23 15:22:50 +0900223 writer->Write(" %s", Join(source_aidl, " \\\n ").c_str());
Dan Willemsen93298ee2016-11-10 23:55:55 -0800224 writer->Write("\n");
Christopher Wileya30a45e2015-10-17 10:56:59 -0700225
Jiyong Park74595c12018-07-23 15:22:50 +0900226 if (!options.DependencyFileNinja()) {
Dan Willemsen93298ee2016-11-10 23:55:55 -0800227 writer->Write("\n");
228 // Output "<input_aidl_file>: " so make won't fail if the input .aidl file
229 // has been deleted, moved or renamed in incremental build.
Jiyong Park74595c12018-07-23 15:22:50 +0900230 for (const auto& src : source_aidl) {
Dan Willemsen93298ee2016-11-10 23:55:55 -0800231 writer->Write("%s :\n", src.c_str());
232 }
Christopher Wiley3a9911c2016-01-19 12:59:09 -0800233 }
Christopher Wileya30a45e2015-10-17 10:56:59 -0700234
Steven Morelandc26d8142018-09-17 14:25:33 -0700235 if (options.IsCppOutput()) {
Jiyong Park74595c12018-07-23 15:22:50 +0900236 if (!options.DependencyFileNinja()) {
237 using ::android::aidl::cpp::ClassNames;
238 using ::android::aidl::cpp::HeaderFile;
239 vector<string> headers;
240 for (ClassNames c : {ClassNames::CLIENT, ClassNames::SERVER, ClassNames::INTERFACE}) {
Jiyong Park05463732018-08-09 16:03:02 +0900241 headers.push_back(options.OutputHeaderDir() +
Jiyong Park74595c12018-07-23 15:22:50 +0900242 HeaderFile(defined_type, c, false /* use_os_sep */));
243 }
Christopher Wiley3a9911c2016-01-19 12:59:09 -0800244
Jiyong Park74595c12018-07-23 15:22:50 +0900245 writer->Write("\n");
246
247 // Generated headers also depend on the source aidl files.
248 writer->Write("%s : \\\n %s\n", Join(headers, " \\\n ").c_str(),
249 Join(source_aidl, " \\\n ").c_str());
Adam Lesinskiffa16862014-01-23 18:17:42 -0800250 }
Christopher Wileya30a45e2015-10-17 10:56:59 -0700251 }
Christopher Wiley3a9911c2016-01-19 12:59:09 -0800252
Christopher Wiley3a9911c2016-01-19 12:59:09 -0800253 return true;
Adam Lesinskiffa16862014-01-23 18:17:42 -0800254}
255
Jiyong Park74595c12018-07-23 15:22:50 +0900256string generate_outputFileName(const Options& options, const AidlDefinedType& defined_type) {
Steven Moreland5557f1c2018-07-02 13:50:23 -0700257 // create the path to the destination folder based on the
258 // defined_type package name
Jiyong Park74595c12018-07-23 15:22:50 +0900259 string result = options.OutputDir();
Adam Lesinskiffa16862014-01-23 18:17:42 -0800260
Jiyong Park74595c12018-07-23 15:22:50 +0900261 string package = defined_type.GetPackage();
262 size_t len = package.length();
Steven Moreland5557f1c2018-07-02 13:50:23 -0700263 for (size_t i = 0; i < len; i++) {
Jiyong Park74595c12018-07-23 15:22:50 +0900264 if (package[i] == '.') {
265 package[i] = OS_PATH_SEPARATOR;
Adam Lesinskiffa16862014-01-23 18:17:42 -0800266 }
Steven Moreland5557f1c2018-07-02 13:50:23 -0700267 }
Adam Lesinskiffa16862014-01-23 18:17:42 -0800268
Jiyong Park74595c12018-07-23 15:22:50 +0900269 result += package;
Adam Lesinskiffa16862014-01-23 18:17:42 -0800270
Steven Moreland5557f1c2018-07-02 13:50:23 -0700271 // add the filename by replacing the .aidl extension to .java
Jiyong Park74595c12018-07-23 15:22:50 +0900272 const string& name = defined_type.GetName();
Steven Moreland5557f1c2018-07-02 13:50:23 -0700273 result += OS_PATH_SEPARATOR;
274 result.append(name, 0, name.find('.'));
Jiyong Parkb03551f2018-08-06 19:20:51 +0900275 if (options.TargetLanguage() == Options::Language::JAVA) {
276 result += ".java";
Steven Morelandc26d8142018-09-17 14:25:33 -0700277 } else if (options.IsCppOutput()) {
Jiyong Parkb03551f2018-08-06 19:20:51 +0900278 result += ".cpp";
279 } else {
280 LOG(FATAL) << "Should not reach here" << endl;
281 return "";
282 }
Adam Lesinskiffa16862014-01-23 18:17:42 -0800283
Steven Moreland5557f1c2018-07-02 13:50:23 -0700284 return result;
Adam Lesinskiffa16862014-01-23 18:17:42 -0800285}
286
Jiyong Parkb034bf02018-07-30 17:44:33 +0900287bool check_and_assign_method_ids(const std::vector<std::unique_ptr<AidlMethod>>& items) {
Jiyong Park309668e2018-07-28 16:55:44 +0900288 // Check whether there are any methods with manually assigned id's and any
289 // that are not. Either all method id's must be manually assigned or all of
290 // them must not. Also, check for uplicates of user set ID's and that the
291 // ID's are within the proper bounds.
292 set<int> usedIds;
293 bool hasUnassignedIds = false;
294 bool hasAssignedIds = false;
295 for (const auto& item : items) {
296 // However, meta transactions that are added by the AIDL compiler are
297 // exceptions. They have fixed IDs but allowed to be with user-defined
298 // methods having auto-assigned IDs. This is because the Ids of the meta
299 // transactions must be stable during the entire lifetime of an interface.
300 // In other words, their IDs must be the same even when new user-defined
301 // methods are added.
302 if (item->HasId() && item->IsUserDefined()) {
303 hasAssignedIds = true;
304 // Ensure that the user set id is not duplicated.
305 if (usedIds.find(item->GetId()) != usedIds.end()) {
306 // We found a duplicate id, so throw an error.
307 AIDL_ERROR(item) << "Found duplicate method id (" << item->GetId() << ") for method "
308 << item->GetName();
309 return false;
310 }
311 // Ensure that the user set id is within the appropriate limits
312 if (item->GetId() < kMinUserSetMethodId || item->GetId() > kMaxUserSetMethodId) {
313 AIDL_ERROR(item) << "Found out of bounds id (" << item->GetId() << ") for method "
314 << item->GetName() << ". Value for id must be between "
315 << kMinUserSetMethodId << " and " << kMaxUserSetMethodId << " inclusive.";
316 return false;
317 }
318 usedIds.insert(item->GetId());
319 } else {
320 hasUnassignedIds = true;
321 }
322 if (hasAssignedIds && hasUnassignedIds) {
Jiyong Parkb034bf02018-07-30 17:44:33 +0900323 AIDL_ERROR(item) << "You must either assign id's to all methods or to none of them.";
Jiyong Park309668e2018-07-28 16:55:44 +0900324 return false;
325 }
326 }
327
328 // In the case that all methods have unassigned id's, set a unique id for them.
329 if (hasUnassignedIds) {
330 int newId = kMinUserSetMethodId;
Casey Dahlin5c69deb2015-10-01 14:44:12 -0700331 for (const auto& item : items) {
Jiyong Park309668e2018-07-28 16:55:44 +0900332 assert(newId <= kMaxUserSetMethoId);
333 if (item->IsUserDefined()) {
334 item->SetId(newId++);
Jiyong Park309668e2018-07-28 16:55:44 +0900335 }
Adam Lesinskiffa16862014-01-23 18:17:42 -0800336 }
Jiyong Park309668e2018-07-28 16:55:44 +0900337 }
338 return true;
Adam Lesinskiffa16862014-01-23 18:17:42 -0800339}
340
Christopher Wileyef140932015-11-03 09:29:19 -0800341// TODO: Remove this in favor of using the YACC parser b/25479378
342bool ParsePreprocessedLine(const string& line, string* decl,
343 vector<string>* package, string* class_name) {
344 // erase all trailing whitespace and semicolons
345 const size_t end = line.find_last_not_of(" ;\t");
346 if (end == string::npos) {
347 return false;
348 }
349 if (line.rfind(';', end) != string::npos) {
350 return false;
351 }
352
353 decl->clear();
354 string type;
355 vector<string> pieces = Split(line.substr(0, end + 1), " \t");
356 for (const string& piece : pieces) {
357 if (piece.empty()) {
358 continue;
359 }
360 if (decl->empty()) {
361 *decl = std::move(piece);
362 } else if (type.empty()) {
363 type = std::move(piece);
364 } else {
365 return false;
366 }
367 }
368
369 // Note that this logic is absolutely wrong. Given a parcelable
370 // org.some.Foo.Bar, the class name is Foo.Bar, but this code will claim that
371 // the class is just Bar. However, this was the way it was done in the past.
372 //
373 // See b/17415692
374 size_t dot_pos = type.rfind('.');
375 if (dot_pos != string::npos) {
376 *class_name = type.substr(dot_pos + 1);
377 *package = Split(type.substr(0, dot_pos), ".");
378 } else {
379 *class_name = type;
380 package->clear();
381 }
382
383 return true;
384}
385
Christopher Wiley4a2884b2015-10-07 11:27:45 -0700386} // namespace
387
388namespace internals {
389
Jiyong Park1deecc32018-07-17 01:14:41 +0900390bool parse_preprocessed_file(const IoDelegate& io_delegate, const string& filename,
391 TypeNamespace* types, AidlTypenames& typenames) {
Christopher Wileyef140932015-11-03 09:29:19 -0800392 bool success = true;
393 unique_ptr<LineReader> line_reader = io_delegate.GetLineReader(filename);
394 if (!line_reader) {
395 LOG(ERROR) << "cannot open preprocessed file: " << filename;
396 success = false;
397 return success;
398 }
399
400 string line;
401 unsigned lineno = 1;
402 for ( ; line_reader->ReadLine(&line); ++lineno) {
403 if (line.empty() || line.compare(0, 2, "//") == 0) {
404 // skip comments and empty lines
405 continue;
406 }
407
408 string decl;
409 vector<string> package;
410 string class_name;
411 if (!ParsePreprocessedLine(line, &decl, &package, &class_name)) {
412 success = false;
413 break;
414 }
415
Steven Moreland46e9da82018-07-27 15:45:29 -0700416 AidlLocation::Point point = {.line = lineno, .column = 0 /*column*/};
417 AidlLocation location = AidlLocation(filename, point, point);
418
Christopher Wileyef140932015-11-03 09:29:19 -0800419 if (decl == "parcelable") {
Jiyong Parka6605ab2018-11-11 14:30:21 +0900420 AidlParcelable* doc = new AidlParcelable(
421 location, new AidlQualifiedName(location, class_name, ""), package, "" /* comments */);
Jiyong Park1deecc32018-07-17 01:14:41 +0900422 types->AddParcelableType(*doc, filename);
423 typenames.AddPreprocessedType(unique_ptr<AidlParcelable>(doc));
Steven Morelanded83a282018-07-17 13:27:29 -0700424 } else if (decl == "structured_parcelable") {
425 auto temp = new std::vector<std::unique_ptr<AidlVariableDeclaration>>();
Jiyong Parka6605ab2018-11-11 14:30:21 +0900426 AidlStructuredParcelable* doc =
427 new AidlStructuredParcelable(location, new AidlQualifiedName(location, class_name, ""),
428 package, "" /* comments */, temp);
Jiyong Park1deecc32018-07-17 01:14:41 +0900429 types->AddParcelableType(*doc, filename);
430 typenames.AddPreprocessedType(unique_ptr<AidlStructuredParcelable>(doc));
Christopher Wileyef140932015-11-03 09:29:19 -0800431 } else if (decl == "interface") {
Casey Dahlind40e2fe2015-11-24 14:06:52 -0800432 auto temp = new std::vector<std::unique_ptr<AidlMember>>();
Steven Moreland46e9da82018-07-27 15:45:29 -0700433 AidlInterface* doc = new AidlInterface(location, class_name, "", false, temp, package);
Jiyong Park1deecc32018-07-17 01:14:41 +0900434 types->AddBinderType(*doc, filename);
435 typenames.AddPreprocessedType(unique_ptr<AidlInterface>(doc));
Christopher Wileyef140932015-11-03 09:29:19 -0800436 } else {
437 success = false;
438 break;
439 }
440 }
441 if (!success) {
442 LOG(ERROR) << filename << ':' << lineno
443 << " malformed preprocessed file line: '" << line << "'";
444 }
445
446 return success;
447}
448
Jiyong Parkfbbfa932018-07-30 21:44:10 +0900449AidlError load_and_validate_aidl(const std::string& input_file_name, const Options& options,
450 const IoDelegate& io_delegate, TypeNamespace* types,
Jiyong Parkb034bf02018-07-30 17:44:33 +0900451 vector<AidlDefinedType*>* defined_types,
452 vector<string>* imported_files) {
Christopher Wiley632801d2015-11-05 14:15:49 -0800453 AidlError err = AidlError::OK;
Adam Lesinskiffa16862014-01-23 18:17:42 -0800454
Jiyong Parkb034bf02018-07-30 17:44:33 +0900455 //////////////////////////////////////////////////////////////////////////
456 // Loading phase
457 //////////////////////////////////////////////////////////////////////////
Jiyong Parkfbbfa932018-07-30 21:44:10 +0900458
Jiyong Parkb034bf02018-07-30 17:44:33 +0900459 // Parse the main input file
Steven Moreland64e29be2018-08-08 18:52:19 -0700460 std::unique_ptr<Parser> main_parser =
461 Parser::Parse(input_file_name, io_delegate, types->typenames_);
462 if (main_parser == nullptr) {
Jiyong Parkb034bf02018-07-30 17:44:33 +0900463 return AidlError::PARSE_ERROR;
464 }
Steven Moreland64e29be2018-08-08 18:52:19 -0700465 if (!types->AddDefinedTypes(main_parser->GetDefinedTypes(), input_file_name)) {
Jiyong Parkb034bf02018-07-30 17:44:33 +0900466 return AidlError::BAD_TYPE;
467 }
468
469 // Import the preprocessed file
Jiyong Parkfbbfa932018-07-30 21:44:10 +0900470 for (const string& s : options.PreprocessedFiles()) {
Jiyong Park1d2df7d2018-07-23 15:22:50 +0900471 if (!parse_preprocessed_file(io_delegate, s, types, types->typenames_)) {
Christopher Wiley632801d2015-11-05 14:15:49 -0800472 err = AidlError::BAD_PRE_PROCESSED_FILE;
Christopher Wileyef140932015-11-03 09:29:19 -0800473 }
Christopher Wiley3a9d1582015-09-16 12:42:14 -0700474 }
Christopher Wiley632801d2015-11-05 14:15:49 -0800475 if (err != AidlError::OK) {
Christopher Wiley3a9d1582015-09-16 12:42:14 -0700476 return err;
477 }
Adam Lesinskiffa16862014-01-23 18:17:42 -0800478
Jiyong Parkb034bf02018-07-30 17:44:33 +0900479 // Find files to import and parse them
Jiyong Parke59c3682018-09-11 23:10:25 +0900480 vector<string> import_paths;
Jiyong Park8c380532018-08-30 14:55:26 +0900481 ImportResolver import_resolver{io_delegate, input_file_name, options.ImportDirs(),
482 options.InputFiles()};
Jiyong Parke59c3682018-09-11 23:10:25 +0900483
484 set<string> type_from_import_statements;
Steven Moreland64e29be2018-08-08 18:52:19 -0700485 for (const auto& import : main_parser->GetImports()) {
Jiyong Parke05195e2018-10-08 18:24:23 +0900486 if (!AidlTypenames::IsBuiltinTypename(import->GetNeededClass())) {
487 type_from_import_statements.emplace(import->GetNeededClass());
488 }
Jiyong Parke59c3682018-09-11 23:10:25 +0900489 }
490
491 // When referencing a type using fully qualified name it should be imported
492 // without the import statement. To support that, add all unresolved
493 // typespecs encountered during the parsing to the import_candidates list.
494 // Note that there is no guarantee that the typespecs are all fully qualified.
495 // It will be determined by calling FindImportFile().
496 set<string> unresolved_types;
497 for (const auto type : main_parser->GetUnresolvedTypespecs()) {
498 if (!AidlTypenames::IsBuiltinTypename(type->GetName())) {
499 unresolved_types.emplace(type->GetName());
500 }
501 }
502 set<string> import_candidates(type_from_import_statements);
503 import_candidates.insert(unresolved_types.begin(), unresolved_types.end());
504 for (const auto& import : import_candidates) {
505 if (types->HasImportType(import)) {
Christopher Wileyfb4b22d2015-09-25 15:16:13 -0700506 // There are places in the Android tree where an import doesn't resolve,
507 // but we'll pick the type up through the preprocessed types.
508 // This seems like an error, but legacy support demands we support it...
Christopher Wileyc16e5e72015-09-16 10:49:40 -0700509 continue;
510 }
Jiyong Parke59c3682018-09-11 23:10:25 +0900511 string import_path = import_resolver.FindImportFile(import);
Christopher Wiley72877ac2015-10-06 14:41:42 -0700512 if (import_path.empty()) {
Jiyong Parke59c3682018-09-11 23:10:25 +0900513 if (type_from_import_statements.find(import) != type_from_import_statements.end()) {
514 // Complain only when the import from the import statement has failed.
515 AIDL_ERROR(import) << "couldn't find import for class " << import;
516 err = AidlError::BAD_IMPORT;
517 }
Christopher Wileyc16e5e72015-09-16 10:49:40 -0700518 continue;
519 }
Casey Dahlin2cc93162015-10-02 16:14:17 -0700520
Jiyong Parke59c3682018-09-11 23:10:25 +0900521 import_paths.emplace_back(import_path);
Jiyong Parkb034bf02018-07-30 17:44:33 +0900522
Steven Moreland64e29be2018-08-08 18:52:19 -0700523 std::unique_ptr<Parser> import_parser =
524 Parser::Parse(import_path, io_delegate, types->typenames_);
525 if (import_parser == nullptr) {
Jiyong Parke59c3682018-09-11 23:10:25 +0900526 cerr << "error while importing " << import_path << " for " << import << endl;
Christopher Wiley632801d2015-11-05 14:15:49 -0800527 err = AidlError::BAD_IMPORT;
Christopher Wileyc16e5e72015-09-16 10:49:40 -0700528 continue;
529 }
Steven Moreland64e29be2018-08-08 18:52:19 -0700530 if (!types->AddDefinedTypes(import_parser->GetDefinedTypes(), import_path)) {
Jiyong Parkb034bf02018-07-30 17:44:33 +0900531 return AidlError::BAD_TYPE;
532 }
Christopher Wileyc16e5e72015-09-16 10:49:40 -0700533 }
Christopher Wiley632801d2015-11-05 14:15:49 -0800534 if (err != AidlError::OK) {
Christopher Wileyc16e5e72015-09-16 10:49:40 -0700535 return err;
Christopher Wiley3a9d1582015-09-16 12:42:14 -0700536 }
Adam Lesinskiffa16862014-01-23 18:17:42 -0800537
Jiyong Park3c35e392018-08-30 13:10:30 +0900538 for (const auto& imported_file : options.ImportFiles()) {
Jiyong Parke59c3682018-09-11 23:10:25 +0900539 import_paths.emplace_back(imported_file);
Jiyong Park3c35e392018-08-30 13:10:30 +0900540
541 std::unique_ptr<Parser> import_parser =
542 Parser::Parse(imported_file, io_delegate, types->typenames_);
543 if (import_parser == nullptr) {
544 AIDL_ERROR(imported_file) << "error while importing " << imported_file;
545 err = AidlError::BAD_IMPORT;
546 continue;
547 }
548 if (!types->AddDefinedTypes(import_parser->GetDefinedTypes(), imported_file)) {
549 return AidlError::BAD_TYPE;
550 }
551 }
552 if (err != AidlError::OK) {
553 return err;
554 }
Jiyong Park96c16a92018-08-16 16:37:09 +0900555 const bool is_check_api = options.GetTask() == Options::Task::CHECK_API;
Jiyong Parkb034bf02018-07-30 17:44:33 +0900556
557 // Resolve the unresolved type references found from the input file
Jiyong Park96c16a92018-08-16 16:37:09 +0900558 if (!is_check_api && !main_parser->Resolve()) {
559 // Resolution is not need for check api because all typespecs are
560 // using fully qualified names.
Jiyong Park1deecc32018-07-17 01:14:41 +0900561 return AidlError::BAD_TYPE;
562 }
Jeongik Cha37179582018-11-13 14:30:52 +0900563 if (!is_check_api) {
564 for (const auto defined_type : main_parser->GetDefinedTypes()) {
565 AidlInterface* interface = defined_type->AsInterface();
566 AidlStructuredParcelable* parcelable = defined_type->AsStructuredParcelable();
Jiyong Park1deecc32018-07-17 01:14:41 +0900567
Jeongik Cha37179582018-11-13 14:30:52 +0900568 // Link the AIDL type with the type of the target language. This will
569 // be removed when the migration to AidlTypenames is done.
570 defined_type->SetLanguageType(types->GetDefinedType(*defined_type));
Jeongik Chadb0f59e2018-11-01 18:11:21 +0900571
Jeongik Cha37179582018-11-13 14:30:52 +0900572 if (interface != nullptr) {
573 if (!register_types(interface, types)) {
574 return AidlError::BAD_TYPE;
575 }
576 }
577 if (parcelable != nullptr) {
578 if (!register_types(parcelable, types)) {
579 return AidlError::BAD_TYPE;
580 }
581 }
Jeongik Chadb0f59e2018-11-01 18:11:21 +0900582 }
583 }
584
585 //////////////////////////////////////////////////////////////////////////
586 // Validation phase
587 //////////////////////////////////////////////////////////////////////////
588
589 AidlTypenames& typenames = types->typenames_;
590
Steven Morelande2c64b42018-09-18 15:06:37 -0700591 // For legacy reasons, by default, compiling an unstructured parcelable (which contains no output)
592 // is allowed. This must not be returned as an error until the very end of this procedure since
593 // this may be considered a success, and we should first check that there are not other, more
594 // serious failures.
595 bool contains_unstructured_parcelable = false;
Adam Lesinskiffa16862014-01-23 18:17:42 -0800596
Steven Moreland64e29be2018-08-08 18:52:19 -0700597 const int num_defined_types = main_parser->GetDefinedTypes().size();
598 for (const auto defined_type : main_parser->GetDefinedTypes()) {
Jeongik Chadb0f59e2018-11-01 18:11:21 +0900599 CHECK(defined_type != nullptr);
Steven Morelande2c64b42018-09-18 15:06:37 -0700600 AidlParcelable* unstructuredParcelable = defined_type->AsUnstructuredParcelable();
601 if (unstructuredParcelable != nullptr) {
602 AIDL_ERROR(unstructuredParcelable)
603 << "Refusing to generate code with unstructured parcelables. Declared parcelables should "
604 "be in their own file and/or cannot be used with --structured interfaces.";
605 contains_unstructured_parcelable = true;
606 continue;
607 }
608
Jiyong Parkb034bf02018-07-30 17:44:33 +0900609 // Ensure that a type is either an interface or a structured parcelable
610 AidlInterface* interface = defined_type->AsInterface();
611 AidlStructuredParcelable* parcelable = defined_type->AsStructuredParcelable();
612 CHECK(interface != nullptr || parcelable != nullptr);
613
614 // Ensure that foo.bar.IFoo is defined in <some_path>/foo/bar/IFoo.aidl
Jiyong Parke59c3682018-09-11 23:10:25 +0900615 if (num_defined_types == 1 && !check_filename(input_file_name, *defined_type)) {
Jiyong Parkb034bf02018-07-30 17:44:33 +0900616 return AidlError::BAD_PACKAGE;
617 }
618
Jiyong Parkb034bf02018-07-30 17:44:33 +0900619 // Check the referenced types in parsed_doc to make sure we've imported them
Jiyong Park96c16a92018-08-16 16:37:09 +0900620 if (!is_check_api) {
621 // No need to do this for check api because all typespecs are already
622 // using fully qualified name and we don't import in AIDL files.
Jeongik Chadb0f59e2018-11-01 18:11:21 +0900623 if (!defined_type->CheckValid(typenames)) {
Jiyong Park96c16a92018-08-16 16:37:09 +0900624 return AidlError::BAD_TYPE;
625 }
Jiyong Parkb034bf02018-07-30 17:44:33 +0900626 }
627
628 if (interface != nullptr) {
629 // add the meta-method 'int getInterfaceVersion()' if version is specified.
630 if (options.Version() > 0) {
631 AidlTypeSpecifier* ret =
Steven Moreland02e012e2018-08-02 14:58:10 -0700632 new AidlTypeSpecifier(AIDL_LOCATION_HERE, "int", false, nullptr, "");
Jiyong Parkb034bf02018-07-30 17:44:33 +0900633 vector<unique_ptr<AidlArgument>>* args = new vector<unique_ptr<AidlArgument>>();
634 AidlMethod* method =
Steven Moreland02e012e2018-08-02 14:58:10 -0700635 new AidlMethod(AIDL_LOCATION_HERE, false, ret, "getInterfaceVersion", args, "",
Jiyong Parkb034bf02018-07-30 17:44:33 +0900636 kGetInterfaceVersionId, false /* is_user_defined */);
637 interface->GetMutableMethods().emplace_back(method);
638 }
639 if (!check_and_assign_method_ids(interface->GetMethods())) {
640 return AidlError::BAD_METHOD_ID;
641 }
Jiyong Parkb034bf02018-07-30 17:44:33 +0900642 }
Christopher Wiley632801d2015-11-05 14:15:49 -0800643 }
Adam Lesinskiffa16862014-01-23 18:17:42 -0800644
Jiyong Parkfbbfa932018-07-30 21:44:10 +0900645 if (options.IsStructured()) {
Jeongik Chadb0f59e2018-11-01 18:11:21 +0900646 typenames.IterateTypes([&](const AidlDefinedType& type) {
Steven Moreland6cee3482018-07-18 14:39:58 -0700647 if (type.AsUnstructuredParcelable() != nullptr) {
Steven Moreland1eac5fa2018-08-27 19:35:05 -0700648 err = AidlError::NOT_STRUCTURED;
Steven Moreland6cee3482018-07-18 14:39:58 -0700649 LOG(ERROR) << type.GetCanonicalName()
650 << " is not structured, but this is a structured interface.";
651 }
652 });
653 }
654 if (err != AidlError::OK) {
655 return err;
656 }
657
Jiyong Parkb034bf02018-07-30 17:44:33 +0900658 if (defined_types != nullptr) {
Steven Moreland64e29be2018-08-08 18:52:19 -0700659 *defined_types = main_parser->GetDefinedTypes();
Jiyong Park309668e2018-07-28 16:55:44 +0900660 }
661
Jiyong Parkb034bf02018-07-30 17:44:33 +0900662 if (imported_files != nullptr) {
Jiyong Parke59c3682018-09-11 23:10:25 +0900663 *imported_files = import_paths;
Christopher Wiley3a9d1582015-09-16 12:42:14 -0700664 }
Casey Dahlin0edf3422015-10-07 12:34:59 -0700665
Steven Morelande2c64b42018-09-18 15:06:37 -0700666 if (contains_unstructured_parcelable) {
667 // Considered a success for the legacy case, so this must be returned last.
668 return AidlError::FOUND_PARCELABLE;
669 }
670
Christopher Wiley632801d2015-11-05 14:15:49 -0800671 return AidlError::OK;
Christopher Wileyeb1acc12015-09-16 11:25:13 -0700672}
673
Casey Dahlin2cc93162015-10-02 16:14:17 -0700674} // namespace internals
675
Jiyong Parkb034bf02018-07-30 17:44:33 +0900676int compile_aidl(const Options& options, const IoDelegate& io_delegate) {
677 const Options::Language lang = options.TargetLanguage();
Jiyong Park74595c12018-07-23 15:22:50 +0900678 for (const string& input_file : options.InputFiles()) {
Jiyong Parkb034bf02018-07-30 17:44:33 +0900679 // Create type namespace that will hold the types identified by the parser.
680 // This two namespaces that are specific to the target language will be
681 // unified to AidlTypenames which is agnostic to the target language.
682 cpp::TypeNamespace cpp_types;
683 cpp_types.Init();
684
685 java::JavaTypeNamespace java_types;
686 java_types.Init();
687
688 TypeNamespace* types;
Steven Morelandc26d8142018-09-17 14:25:33 -0700689 if (options.IsCppOutput()) {
Jiyong Parkb034bf02018-07-30 17:44:33 +0900690 types = &cpp_types;
691 } else if (lang == Options::Language::JAVA) {
692 types = &java_types;
693 } else {
694 LOG(FATAL) << "Unsupported target language." << endl;
Jiyong Park74595c12018-07-23 15:22:50 +0900695 return 1;
696 }
697
Jiyong Parkb034bf02018-07-30 17:44:33 +0900698 vector<AidlDefinedType*> defined_types;
699 vector<string> imported_files;
Jiyong Park74595c12018-07-23 15:22:50 +0900700
Jiyong Parkb034bf02018-07-30 17:44:33 +0900701 AidlError aidl_err = internals::load_and_validate_aidl(input_file, options, io_delegate, types,
702 &defined_types, &imported_files);
Jiyong Park74595c12018-07-23 15:22:50 +0900703 if (aidl_err == AidlError::FOUND_PARCELABLE && !options.FailOnParcelable()) {
704 // We aborted code generation because this file contains parcelables.
705 // However, we were not told to complain if we find parcelables.
706 // Just generate a dep file and exit quietly. The dep file is for a legacy
707 // use case by the SDK.
Jiyong Parkb034bf02018-07-30 17:44:33 +0900708 for (const auto defined_type : defined_types) {
709 write_dep_file(options, *defined_type, imported_files, io_delegate, input_file, "");
710 }
Jiyong Park74595c12018-07-23 15:22:50 +0900711 return 0;
712 }
713 if (aidl_err != AidlError::OK) {
714 return 1;
715 }
Christopher Wileyeb1acc12015-09-16 11:25:13 -0700716
Jiyong Parkb034bf02018-07-30 17:44:33 +0900717 for (const auto defined_type : defined_types) {
718 CHECK(defined_type != nullptr);
Steven Moreland5557f1c2018-07-02 13:50:23 -0700719
Jiyong Parkb034bf02018-07-30 17:44:33 +0900720 string output_file_name = options.OutputFile();
721 // if needed, generate the output file name from the base folder
722 if (output_file_name.empty() && !options.OutputDir().empty()) {
Jiyong Parkb03551f2018-08-06 19:20:51 +0900723 output_file_name = generate_outputFileName(options, *defined_type);
724 if (output_file_name.empty()) {
Jiyong Parkb034bf02018-07-30 17:44:33 +0900725 return 1;
726 }
727 }
Jiyong Park74595c12018-07-23 15:22:50 +0900728
Jiyong Parkb034bf02018-07-30 17:44:33 +0900729 if (!write_dep_file(options, *defined_type, imported_files, io_delegate, input_file,
730 output_file_name)) {
731 return 1;
732 }
Jiyong Park74595c12018-07-23 15:22:50 +0900733
Jiyong Parkb034bf02018-07-30 17:44:33 +0900734 bool success = false;
735 if (lang == Options::Language::CPP) {
736 success =
737 cpp::GenerateCpp(output_file_name, options, cpp_types, *defined_type, io_delegate);
Steven Morelandc26d8142018-09-17 14:25:33 -0700738 } else if (lang == Options::Language::NDK) {
739 ndk::GenerateNdk(output_file_name, options, cpp_types.typenames_, *defined_type,
740 io_delegate);
741 success = true;
Jiyong Parkb034bf02018-07-30 17:44:33 +0900742 } else if (lang == Options::Language::JAVA) {
743 success = java::generate_java(output_file_name, input_file, defined_type, &java_types,
744 io_delegate, options);
745 } else {
746 LOG(FATAL) << "Should not reach here" << endl;
747 return 1;
748 }
749 if (!success) {
750 return 1;
751 }
Jiyong Park74595c12018-07-23 15:22:50 +0900752 }
Christopher Wiley3a9d1582015-09-16 12:42:14 -0700753 }
Jiyong Park74595c12018-07-23 15:22:50 +0900754 return 0;
Adam Lesinskiffa16862014-01-23 18:17:42 -0800755}
756
Jiyong Park74595c12018-07-23 15:22:50 +0900757bool preprocess_aidl(const Options& options, const IoDelegate& io_delegate) {
758 unique_ptr<CodeWriter> writer = io_delegate.GetCodeWriter(options.OutputFile());
Adam Lesinskiffa16862014-01-23 18:17:42 -0800759
Jiyong Park74595c12018-07-23 15:22:50 +0900760 for (const auto& file : options.InputFiles()) {
Jiyong Park1deecc32018-07-17 01:14:41 +0900761 AidlTypenames typenames;
Steven Moreland64e29be2018-08-08 18:52:19 -0700762 std::unique_ptr<Parser> p = Parser::Parse(file, io_delegate, typenames);
763 if (p == nullptr) return false;
Casey Dahlin59401da2015-10-09 18:16:45 -0700764
Steven Moreland64e29be2018-08-08 18:52:19 -0700765 for (const auto& defined_type : p->GetDefinedTypes()) {
Steven Morelanded83a282018-07-17 13:27:29 -0700766 if (!writer->Write("%s %s;\n", defined_type->GetPreprocessDeclarationName().c_str(),
Steven Morelandc258abc2018-07-10 14:03:38 -0700767 defined_type->GetCanonicalName().c_str())) {
Casey Dahlinc1f39b42015-11-24 10:34:34 -0800768 return false;
769 }
Adam Lesinskiffa16862014-01-23 18:17:42 -0800770 }
Casey Dahlinc1f39b42015-11-24 10:34:34 -0800771 }
Adam Lesinskiffa16862014-01-23 18:17:42 -0800772
Casey Dahlinc1f39b42015-11-24 10:34:34 -0800773 return writer->Close();
Adam Lesinskiffa16862014-01-23 18:17:42 -0800774}
Christopher Wileyfdeb0f42015-09-11 15:38:22 -0700775
Jiyong Parke59c3682018-09-11 23:10:25 +0900776static string GetApiDumpPathFor(const AidlDefinedType& defined_type, const Options& options) {
777 string package_as_path = Join(Split(defined_type.GetPackage(), "."), OS_PATH_SEPARATOR);
778 CHECK(!options.OutputDir().empty() && options.OutputDir().back() == '/');
779 return options.OutputDir() + package_as_path + OS_PATH_SEPARATOR + defined_type.GetName() +
780 ".aidl";
781}
Jiyong Parkb034bf02018-07-30 17:44:33 +0900782
Jiyong Parke59c3682018-09-11 23:10:25 +0900783bool dump_api(const Options& options, const IoDelegate& io_delegate) {
Jiyong Park74595c12018-07-23 15:22:50 +0900784 for (const auto& file : options.InputFiles()) {
Jiyong Parke59c3682018-09-11 23:10:25 +0900785 java::JavaTypeNamespace ns;
786 ns.Init();
Jiyong Parkb034bf02018-07-30 17:44:33 +0900787 vector<AidlDefinedType*> defined_types;
Jiyong Parke59c3682018-09-11 23:10:25 +0900788 if (internals::load_and_validate_aidl(file, options, io_delegate, &ns, &defined_types,
Jiyong Parkb034bf02018-07-30 17:44:33 +0900789 nullptr) == AidlError::OK) {
790 for (const auto type : defined_types) {
Jiyong Parke59c3682018-09-11 23:10:25 +0900791 unique_ptr<CodeWriter> writer =
792 io_delegate.GetCodeWriter(GetApiDumpPathFor(*type, options));
Steven Morelandec0531d2018-09-20 11:11:20 -0700793 if (!type->GetPackage().empty()) {
794 (*writer) << "package " << type->GetPackage() << ";\n";
795 }
Jiyong Parke59c3682018-09-11 23:10:25 +0900796 type->Write(writer.get());
Jiyong Parkb034bf02018-07-30 17:44:33 +0900797 }
Jiyong Park02da7422018-07-16 16:00:26 +0900798 } else {
799 return false;
800 }
801 }
Jiyong Parke59c3682018-09-11 23:10:25 +0900802 return true;
Jiyong Park02da7422018-07-16 16:00:26 +0900803}
804
Christopher Wileyfdeb0f42015-09-11 15:38:22 -0700805} // namespace android
806} // namespace aidl