blob: d5e6d600df194bb4172706993d300634e7accdfe [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>
Christopher Wileyc16e5e72015-09-16 10:49:40 -070020#include <iostream>
Christopher Wileyf690be52015-09-14 15:19:10 -070021#include <map>
Adam Lesinskiffa16862014-01-23 18:17:42 -080022#include <stdio.h>
23#include <stdlib.h>
24#include <string.h>
Christopher Wileyf690be52015-09-14 15:19:10 -070025#include <sys/param.h>
26#include <sys/stat.h>
27#include <unistd.h>
Adam Lesinskiffa16862014-01-23 18:17:42 -080028
Elliott Hughes549b6e22015-08-17 12:41:46 -070029#ifdef _WIN32
Adam Lesinskiffa16862014-01-23 18:17:42 -080030#include <io.h>
Andrew Hsieh15ce9942014-05-07 20:14:30 +080031#include <direct.h>
Adam Lesinskiffa16862014-01-23 18:17:42 -080032#include <sys/stat.h>
33#endif
34
Elliott Hughes0a620672015-12-04 13:53:18 -080035#include <android-base/strings.h>
Christopher Wileyf690be52015-09-14 15:19:10 -070036
Christopher Wileyf690be52015-09-14 15:19:10 -070037#include "aidl_language.h"
Christopher Wileyeb1acc12015-09-16 11:25:13 -070038#include "generate_cpp.h"
Christopher Wileyf690be52015-09-14 15:19:10 -070039#include "generate_java.h"
Christopher Wiley72877ac2015-10-06 14:41:42 -070040#include "import_resolver.h"
Christopher Wileyf690be52015-09-14 15:19:10 -070041#include "logging.h"
42#include "options.h"
43#include "os.h"
Christopher Wileye3550c62015-09-29 13:26:10 -070044#include "type_cpp.h"
Christopher Wiley775fa1f2015-09-22 15:00:12 -070045#include "type_java.h"
Christopher Wiley84c1eac2015-09-23 13:29:28 -070046#include "type_namespace.h"
Christopher Wileyf690be52015-09-14 15:19:10 -070047
Adam Lesinskiffa16862014-01-23 18:17:42 -080048#ifndef O_BINARY
49# define O_BINARY 0
50#endif
51
Christopher Wiley3a9911c2016-01-19 12:59:09 -080052using android::base::Join;
Christopher Wileyd76067c2015-10-19 17:00:13 -070053using android::base::Split;
Christopher Wileyc16e5e72015-09-16 10:49:40 -070054using std::cerr;
55using std::endl;
Christopher Wiley9f4c7ae2015-08-24 14:07:32 -070056using std::map;
57using std::set;
58using std::string;
Christopher Wiley84c1eac2015-09-23 13:29:28 -070059using std::unique_ptr;
Christopher Wiley9f4c7ae2015-08-24 14:07:32 -070060using std::vector;
Adam Lesinskiffa16862014-01-23 18:17:42 -080061
Christopher Wileyf690be52015-09-14 15:19:10 -070062namespace android {
63namespace aidl {
64namespace {
Adam Lesinskiffa16862014-01-23 18:17:42 -080065
Christopher Wileyf690be52015-09-14 15:19:10 -070066// The following are gotten as the offset from the allowable id's between
67// android.os.IBinder.FIRST_CALL_TRANSACTION=1 and
68// android.os.IBinder.LAST_CALL_TRANSACTION=16777215
69const int kMinUserSetMethodId = 0;
70const int kMaxUserSetMethodId = 16777214;
Adam Lesinskiffa16862014-01-23 18:17:42 -080071
Casey Dahlin42727f82015-10-12 19:23:40 -070072bool check_filename(const std::string& filename,
73 const std::string& package,
74 const std::string& name,
75 unsigned line) {
Adam Lesinskiffa16862014-01-23 18:17:42 -080076 const char* p;
77 string expected;
78 string fn;
79 size_t len;
Adam Lesinskiffa16862014-01-23 18:17:42 -080080 bool valid = false;
81
Christopher Wileybc2df692016-06-02 16:27:26 -070082 if (!IoDelegate::GetAbsolutePath(filename, &fn)) {
83 return false;
Adam Lesinskiffa16862014-01-23 18:17:42 -080084 }
85
Casey Dahlinfb7da2e2015-10-08 17:26:09 -070086 if (!package.empty()) {
Adam Lesinskiffa16862014-01-23 18:17:42 -080087 expected = package;
88 expected += '.';
89 }
90
91 len = expected.length();
92 for (size_t i=0; i<len; i++) {
93 if (expected[i] == '.') {
94 expected[i] = OS_PATH_SEPARATOR;
95 }
96 }
97
Casey Dahlinfb7da2e2015-10-08 17:26:09 -070098 expected.append(name, 0, name.find('.'));
Christopher Wiley8f8cc9b2015-09-14 13:47:40 -070099
Adam Lesinskiffa16862014-01-23 18:17:42 -0800100 expected += ".aidl";
101
102 len = fn.length();
103 valid = (len >= expected.length());
104
105 if (valid) {
106 p = fn.c_str() + (len - expected.length());
107
Elliott Hughesce310da2015-07-29 08:44:17 -0700108#ifdef _WIN32
Adam Lesinskiffa16862014-01-23 18:17:42 -0800109 if (OS_PATH_SEPARATOR != '/') {
110 // Input filename under cygwin most likely has / separators
111 // whereas the expected string uses \\ separators. Adjust
112 // them accordingly.
113 for (char *c = const_cast<char *>(p); *c; ++c) {
114 if (*c == '/') *c = OS_PATH_SEPARATOR;
115 }
116 }
117#endif
118
Yabin Cui482eefb2014-11-10 15:01:43 -0800119 // aidl assumes case-insensitivity on Mac Os and Windows.
120#if defined(__linux__)
Adam Lesinskiffa16862014-01-23 18:17:42 -0800121 valid = (expected == p);
122#else
123 valid = !strcasecmp(expected.c_str(), p);
124#endif
125 }
126
127 if (!valid) {
Steven Moreland6ddc37f2018-07-02 13:05:50 -0700128 fprintf(stderr, "%s:%d %s should be declared in a file called %s.\n",
Casey Dahlinfb7da2e2015-10-08 17:26:09 -0700129 filename.c_str(), line, name.c_str(), expected.c_str());
Adam Lesinskiffa16862014-01-23 18:17:42 -0800130 }
131
Casey Dahlin42727f82015-10-12 19:23:40 -0700132 return valid;
Adam Lesinskiffa16862014-01-23 18:17:42 -0800133}
134
Steven Morelandc258abc2018-07-10 14:03:38 -0700135bool check_filenames(const std::string& filename, const AidlDocument& doc) {
Casey Dahlin42727f82015-10-12 19:23:40 -0700136 bool success = true;
137
Steven Morelandc258abc2018-07-10 14:03:38 -0700138 for (const auto& item : doc.GetDefinedTypes()) {
Casey Dahlinc1f39b42015-11-24 10:34:34 -0800139 success &= check_filename(filename, item->GetPackage(), item->GetName(),
140 item->GetLine());
141 }
Casey Dahlin42727f82015-10-12 19:23:40 -0700142
143 return success;
Adam Lesinskiffa16862014-01-23 18:17:42 -0800144}
145
Steven Morelandc258abc2018-07-10 14:03:38 -0700146bool gather_types(const std::string& filename, const AidlDocument& doc, TypeNamespace* types) {
Christopher Wiley84c1eac2015-09-23 13:29:28 -0700147 bool success = true;
Adam Lesinskiffa16862014-01-23 18:17:42 -0800148
Steven Morelandc258abc2018-07-10 14:03:38 -0700149 for (const auto& item : doc.GetDefinedTypes()) {
150 const AidlInterface* interface = item->AsInterface();
151 if (interface != nullptr) {
152 success &= types->AddBinderType(*interface, filename);
153 continue;
154 }
Casey Dahlin42727f82015-10-12 19:23:40 -0700155
Steven Morelandc258abc2018-07-10 14:03:38 -0700156 const AidlParcelable* parcelable = item->AsParcelable();
157 if (parcelable != nullptr) {
158 success &= types->AddParcelableType(*parcelable, filename);
159 continue;
160 }
Casey Dahlin42727f82015-10-12 19:23:40 -0700161
Steven Morelandc258abc2018-07-10 14:03:38 -0700162 CHECK(false) << "aidl internal error: unrecognized type";
Christopher Wiley84c1eac2015-09-23 13:29:28 -0700163 }
Casey Dahlin42727f82015-10-12 19:23:40 -0700164
Christopher Wiley84c1eac2015-09-23 13:29:28 -0700165 return success;
Adam Lesinskiffa16862014-01-23 18:17:42 -0800166}
167
Steven Moreland5557f1c2018-07-02 13:50:23 -0700168int check_types(const string& filename, const AidlStructuredParcelable* parcel,
169 TypeNamespace* types) {
170 int err = 0;
171 for (const auto& v : parcel->GetFields()) {
172 if (!types->MaybeAddContainerType(v->GetType())) {
173 err = 1; // return type is invalid
174 }
175
176 const ValidatableType* type = types->GetReturnType(v->GetType(), filename, *parcel);
177 if (!type) {
178 err = 1;
179 }
180
181 v->GetMutableType()->SetLanguageType(type);
182 }
183
184 return err;
185}
186
Christopher Wileyfb4b22d2015-09-25 15:16:13 -0700187int check_types(const string& filename,
Casey Dahlin98a544b2015-10-14 14:22:55 -0700188 const AidlInterface* c,
Christopher Wileyfb4b22d2015-09-25 15:16:13 -0700189 TypeNamespace* types) {
190 int err = 0;
Casey Dahlinf4a93112015-10-05 16:58:09 -0700191
Casey Dahlinc5afb402016-03-01 13:54:05 -0800192 if (c->IsUtf8() && c->IsUtf8InCpp()) {
193 cerr << filename << ":" << c->GetLine()
194 << "Interface cannot be marked as both @utf8 and @utf8InCpp";
195 err = 1;
196 }
197
Casey Dahlinf4a93112015-10-05 16:58:09 -0700198 // Has to be a pointer due to deleting copy constructor. No idea why.
199 map<string, const AidlMethod*> method_names;
Casey Dahlinfb7da2e2015-10-08 17:26:09 -0700200 for (const auto& m : c->GetMethods()) {
Casey Dahlin0c6fcec2015-10-20 13:32:21 -0700201 bool oneway = m->IsOneway() || c->IsOneway();
202
Christopher Wiley934a82d2016-01-27 13:02:24 -0800203 if (!types->MaybeAddContainerType(m->GetType())) {
Christopher Wileyfb4b22d2015-09-25 15:16:13 -0700204 err = 1; // return type is invalid
Adam Lesinskiffa16862014-01-23 18:17:42 -0800205 }
206
Casey Dahlina2f77c42015-12-01 18:26:02 -0800207 const ValidatableType* return_type =
Casey Dahlinc5afb402016-03-01 13:54:05 -0800208 types->GetReturnType(m->GetType(), filename, *c);
Casey Dahlina2f77c42015-12-01 18:26:02 -0800209
Casey Dahlin57dbe242015-12-04 11:44:02 -0800210 if (!return_type) {
211 err = 1;
Casey Dahlina2f77c42015-12-01 18:26:02 -0800212 }
213
214 m->GetMutableType()->SetLanguageType(return_type);
215
Casey Dahlin0c6fcec2015-10-20 13:32:21 -0700216 if (oneway && m->GetType().GetName() != "void") {
217 cerr << filename << ":" << m->GetLine()
Christopher Wiley45db9ee2015-10-26 18:53:53 -0700218 << " oneway method '" << m->GetName() << "' cannot return a value"
219 << endl;
Casey Dahlin0c6fcec2015-10-20 13:32:21 -0700220 err = 1;
221 }
222
Adam Lesinskiffa16862014-01-23 18:17:42 -0800223 int index = 1;
Casey Dahlinf4a93112015-10-05 16:58:09 -0700224 for (const auto& arg : m->GetArguments()) {
Christopher Wiley934a82d2016-01-27 13:02:24 -0800225 if (!types->MaybeAddContainerType(arg->GetType())) {
Christopher Wileyfb4b22d2015-09-25 15:16:13 -0700226 err = 1;
227 }
Casey Dahlin0c6fcec2015-10-20 13:32:21 -0700228
Casey Dahlina2f77c42015-12-01 18:26:02 -0800229 const ValidatableType* arg_type =
Casey Dahlinc5afb402016-03-01 13:54:05 -0800230 types->GetArgType(*arg, index, filename, *c);
Casey Dahlina2f77c42015-12-01 18:26:02 -0800231
Casey Dahlin57dbe242015-12-04 11:44:02 -0800232 if (!arg_type) {
233 err = 1;
Casey Dahlina2f77c42015-12-01 18:26:02 -0800234 }
235
236 arg->GetMutableType()->SetLanguageType(arg_type);
237
Casey Dahlin0c6fcec2015-10-20 13:32:21 -0700238 if (oneway && arg->IsOut()) {
239 cerr << filename << ":" << m->GetLine()
Christopher Wiley45db9ee2015-10-26 18:53:53 -0700240 << " oneway method '" << m->GetName()
241 << "' cannot have out parameters" << endl;
Casey Dahlin0c6fcec2015-10-20 13:32:21 -0700242 err = 1;
243 }
Adam Lesinskiffa16862014-01-23 18:17:42 -0800244 }
245
Casey Dahlinf4a93112015-10-05 16:58:09 -0700246 auto it = method_names.find(m->GetName());
Christopher Wileyfb4b22d2015-09-25 15:16:13 -0700247 // prevent duplicate methods
Casey Dahlinf4a93112015-10-05 16:58:09 -0700248 if (it == method_names.end()) {
249 method_names[m->GetName()] = m.get();
Christopher Wileyfb4b22d2015-09-25 15:16:13 -0700250 } else {
Casey Dahlinf4a93112015-10-05 16:58:09 -0700251 cerr << filename << ":" << m->GetLine()
252 << " attempt to redefine method " << m->GetName() << "," << endl
253 << filename << ":" << it->second->GetLine()
Christopher Wileyfb4b22d2015-09-25 15:16:13 -0700254 << " previously defined here." << endl;
255 err = 1;
Adam Lesinskiffa16862014-01-23 18:17:42 -0800256 }
Christopher Wileyfb4b22d2015-09-25 15:16:13 -0700257 }
258 return err;
Adam Lesinskiffa16862014-01-23 18:17:42 -0800259}
260
Christopher Wiley3a9911c2016-01-19 12:59:09 -0800261void write_common_dep_file(const string& output_file,
262 const vector<string>& aidl_sources,
Dan Willemsen93298ee2016-11-10 23:55:55 -0800263 CodeWriter* writer,
264 const bool ninja) {
Christopher Wiley3a9911c2016-01-19 12:59:09 -0800265 // Encode that the output file depends on aidl input files.
266 writer->Write("%s : \\\n", output_file.c_str());
267 writer->Write(" %s", Join(aidl_sources, " \\\n ").c_str());
Dan Willemsen93298ee2016-11-10 23:55:55 -0800268 writer->Write("\n");
Christopher Wileya30a45e2015-10-17 10:56:59 -0700269
Dan Willemsen93298ee2016-11-10 23:55:55 -0800270 if (!ninja) {
271 writer->Write("\n");
272 // Output "<input_aidl_file>: " so make won't fail if the input .aidl file
273 // has been deleted, moved or renamed in incremental build.
274 for (const auto& src : aidl_sources) {
275 writer->Write("%s :\n", src.c_str());
276 }
Christopher Wiley3a9911c2016-01-19 12:59:09 -0800277 }
278}
Christopher Wileya30a45e2015-10-17 10:56:59 -0700279
Christopher Wiley3a9911c2016-01-19 12:59:09 -0800280bool write_java_dep_file(const JavaOptions& options,
281 const vector<unique_ptr<AidlImport>>& imports,
Christopher Wileyf8136192016-04-12 14:19:35 -0700282 const IoDelegate& io_delegate,
283 const string& output_file_name) {
Christopher Wiley3a9911c2016-01-19 12:59:09 -0800284 string dep_file_name = options.DependencyFilePath();
285 if (dep_file_name.empty()) {
286 return true; // nothing to do
287 }
288 CodeWriterPtr writer = io_delegate.GetCodeWriter(dep_file_name);
289 if (!writer) {
290 LOG(ERROR) << "Could not open dependency file: " << dep_file_name;
291 return false;
292 }
293
294 vector<string> source_aidl = {options.input_file_name_};
Christopher Wileya30a45e2015-10-17 10:56:59 -0700295 for (const auto& import : imports) {
Christopher Wiley3a9911c2016-01-19 12:59:09 -0800296 if (!import->GetFilename().empty()) {
297 source_aidl.push_back(import->GetFilename());
Adam Lesinskiffa16862014-01-23 18:17:42 -0800298 }
Christopher Wileya30a45e2015-10-17 10:56:59 -0700299 }
Christopher Wiley3a9911c2016-01-19 12:59:09 -0800300
Dan Willemsen93298ee2016-11-10 23:55:55 -0800301 write_common_dep_file(output_file_name, source_aidl, writer.get(),
302 options.DependencyFileNinja());
Christopher Wiley3a9911c2016-01-19 12:59:09 -0800303
304 return true;
305}
306
Steven Moreland5557f1c2018-07-02 13:50:23 -0700307bool write_cpp_dep_file(const CppOptions& options, const AidlDefinedType& defined_type,
Christopher Wiley3a9911c2016-01-19 12:59:09 -0800308 const vector<unique_ptr<AidlImport>>& imports,
309 const IoDelegate& io_delegate) {
310 using ::android::aidl::cpp::HeaderFile;
311 using ::android::aidl::cpp::ClassNames;
312
313 string dep_file_name = options.DependencyFilePath();
314 if (dep_file_name.empty()) {
315 return true; // nothing to do
316 }
317 CodeWriterPtr writer = io_delegate.GetCodeWriter(dep_file_name);
318 if (!writer) {
319 LOG(ERROR) << "Could not open dependency file: " << dep_file_name;
320 return false;
321 }
322
323 vector<string> source_aidl = {options.InputFileName()};
324 for (const auto& import : imports) {
325 if (!import->GetFilename().empty()) {
326 source_aidl.push_back(import->GetFilename());
327 }
328 }
329
Dan Willemsen93298ee2016-11-10 23:55:55 -0800330 write_common_dep_file(options.OutputCppFilePath(), source_aidl, writer.get(),
331 options.DependencyFileNinja());
332
333 if (!options.DependencyFileNinja()) {
334 vector<string> headers;
335 for (ClassNames c : {ClassNames::CLIENT,
336 ClassNames::SERVER,
337 ClassNames::INTERFACE}) {
338 headers.push_back(options.OutputHeaderDir() + '/' +
Steven Moreland5557f1c2018-07-02 13:50:23 -0700339 HeaderFile(defined_type, c, false /* use_os_sep */));
Dan Willemsen93298ee2016-11-10 23:55:55 -0800340 }
341
342 writer->Write("\n");
343
344 // Generated headers also depend on the source aidl files.
345 writer->Write("%s : \\\n %s\n", Join(headers, " \\\n ").c_str(),
346 Join(source_aidl, " \\\n ").c_str());
Christopher Wiley3a9911c2016-01-19 12:59:09 -0800347 }
348
Christopher Wiley3a9911c2016-01-19 12:59:09 -0800349 return true;
Adam Lesinskiffa16862014-01-23 18:17:42 -0800350}
351
Steven Moreland5557f1c2018-07-02 13:50:23 -0700352string generate_outputFileName(const JavaOptions& options, const AidlDefinedType& defined_type) {
353 const string& name = defined_type.GetName();
354 string package = defined_type.GetPackage();
355 string result;
Adam Lesinskiffa16862014-01-23 18:17:42 -0800356
Steven Moreland5557f1c2018-07-02 13:50:23 -0700357 // create the path to the destination folder based on the
358 // defined_type package name
359 result = options.output_base_folder_;
360 result += OS_PATH_SEPARATOR;
Adam Lesinskiffa16862014-01-23 18:17:42 -0800361
Steven Moreland5557f1c2018-07-02 13:50:23 -0700362 string packageStr = package;
363 size_t len = packageStr.length();
364 for (size_t i = 0; i < len; i++) {
365 if (packageStr[i] == '.') {
366 packageStr[i] = OS_PATH_SEPARATOR;
Adam Lesinskiffa16862014-01-23 18:17:42 -0800367 }
Steven Moreland5557f1c2018-07-02 13:50:23 -0700368 }
Adam Lesinskiffa16862014-01-23 18:17:42 -0800369
Steven Moreland5557f1c2018-07-02 13:50:23 -0700370 result += packageStr;
Adam Lesinskiffa16862014-01-23 18:17:42 -0800371
Steven Moreland5557f1c2018-07-02 13:50:23 -0700372 // add the filename by replacing the .aidl extension to .java
373 result += OS_PATH_SEPARATOR;
374 result.append(name, 0, name.find('.'));
375 result += ".java";
Adam Lesinskiffa16862014-01-23 18:17:42 -0800376
Steven Moreland5557f1c2018-07-02 13:50:23 -0700377 return result;
Adam Lesinskiffa16862014-01-23 18:17:42 -0800378}
379
Christopher Wileyf690be52015-09-14 15:19:10 -0700380int check_and_assign_method_ids(const char * filename,
Casey Dahlin5c69deb2015-10-01 14:44:12 -0700381 const std::vector<std::unique_ptr<AidlMethod>>& items) {
Adam Lesinskiffa16862014-01-23 18:17:42 -0800382 // Check whether there are any methods with manually assigned id's and any that are not.
383 // Either all method id's must be manually assigned or all of them must not.
384 // Also, check for duplicates of user set id's and that the id's are within the proper bounds.
385 set<int> usedIds;
Adam Lesinskiffa16862014-01-23 18:17:42 -0800386 bool hasUnassignedIds = false;
387 bool hasAssignedIds = false;
Casey Dahlin5c69deb2015-10-01 14:44:12 -0700388 for (const auto& item : items) {
Casey Dahlinf4a93112015-10-05 16:58:09 -0700389 if (item->HasId()) {
Casey Dahlindff80e52015-09-29 13:57:06 -0700390 hasAssignedIds = true;
Casey Dahlindff80e52015-09-29 13:57:06 -0700391 // Ensure that the user set id is not duplicated.
Casey Dahlinf4a93112015-10-05 16:58:09 -0700392 if (usedIds.find(item->GetId()) != usedIds.end()) {
Casey Dahlindff80e52015-09-29 13:57:06 -0700393 // We found a duplicate id, so throw an error.
Adam Lesinskiffa16862014-01-23 18:17:42 -0800394 fprintf(stderr,
Casey Dahlindff80e52015-09-29 13:57:06 -0700395 "%s:%d Found duplicate method id (%d) for method: %s\n",
Casey Dahlinf4a93112015-10-05 16:58:09 -0700396 filename, item->GetLine(),
397 item->GetId(), item->GetName().c_str());
Adam Lesinskiffa16862014-01-23 18:17:42 -0800398 return 1;
399 }
Casey Dahlindff80e52015-09-29 13:57:06 -0700400 // Ensure that the user set id is within the appropriate limits
Casey Dahlinf4a93112015-10-05 16:58:09 -0700401 if (item->GetId() < kMinUserSetMethodId ||
402 item->GetId() > kMaxUserSetMethodId) {
Casey Dahlindff80e52015-09-29 13:57:06 -0700403 fprintf(stderr, "%s:%d Found out of bounds id (%d) for method: %s\n",
Casey Dahlinf4a93112015-10-05 16:58:09 -0700404 filename, item->GetLine(),
405 item->GetId(), item->GetName().c_str());
Casey Dahlindff80e52015-09-29 13:57:06 -0700406 fprintf(stderr, " Value for id must be between %d and %d inclusive.\n",
407 kMinUserSetMethodId, kMaxUserSetMethodId);
408 return 1;
409 }
Casey Dahlinf4a93112015-10-05 16:58:09 -0700410 usedIds.insert(item->GetId());
Casey Dahlindff80e52015-09-29 13:57:06 -0700411 } else {
412 hasUnassignedIds = true;
413 }
414 if (hasAssignedIds && hasUnassignedIds) {
415 fprintf(stderr,
416 "%s: You must either assign id's to all methods or to none of them.\n",
417 filename);
418 return 1;
Adam Lesinskiffa16862014-01-23 18:17:42 -0800419 }
Adam Lesinskiffa16862014-01-23 18:17:42 -0800420 }
421
422 // In the case that all methods have unassigned id's, set a unique id for them.
423 if (hasUnassignedIds) {
424 int newId = 0;
Casey Dahlin5c69deb2015-10-01 14:44:12 -0700425 for (const auto& item : items) {
Casey Dahlinf4a93112015-10-05 16:58:09 -0700426 item->SetId(newId++);
Adam Lesinskiffa16862014-01-23 18:17:42 -0800427 }
428 }
429
430 // success
431 return 0;
432}
433
Christopher Wiley69b44cf2016-05-03 13:43:33 -0700434bool validate_constants(const AidlInterface& interface) {
435 bool success = true;
436 set<string> names;
437 for (const std::unique_ptr<AidlIntConstant>& int_constant :
438 interface.GetIntConstants()) {
439 if (names.count(int_constant->GetName()) > 0) {
440 LOG(ERROR) << "Found duplicate constant name '" << int_constant->GetName()
441 << "'";
442 success = false;
443 }
444 names.insert(int_constant->GetName());
Roshan Pius3b2203d2016-07-22 16:13:20 -0700445 // We've logged an error message for this on object construction.
446 success = success && int_constant->IsValid();
Christopher Wiley69b44cf2016-05-03 13:43:33 -0700447 }
448 for (const std::unique_ptr<AidlStringConstant>& string_constant :
449 interface.GetStringConstants()) {
450 if (names.count(string_constant->GetName()) > 0) {
451 LOG(ERROR) << "Found duplicate constant name '" << string_constant->GetName()
452 << "'";
453 success = false;
454 }
455 names.insert(string_constant->GetName());
456 // We've logged an error message for this on object construction.
457 success = success && string_constant->IsValid();
458 }
459 return success;
460}
461
Christopher Wileyef140932015-11-03 09:29:19 -0800462// TODO: Remove this in favor of using the YACC parser b/25479378
463bool ParsePreprocessedLine(const string& line, string* decl,
464 vector<string>* package, string* class_name) {
465 // erase all trailing whitespace and semicolons
466 const size_t end = line.find_last_not_of(" ;\t");
467 if (end == string::npos) {
468 return false;
469 }
470 if (line.rfind(';', end) != string::npos) {
471 return false;
472 }
473
474 decl->clear();
475 string type;
476 vector<string> pieces = Split(line.substr(0, end + 1), " \t");
477 for (const string& piece : pieces) {
478 if (piece.empty()) {
479 continue;
480 }
481 if (decl->empty()) {
482 *decl = std::move(piece);
483 } else if (type.empty()) {
484 type = std::move(piece);
485 } else {
486 return false;
487 }
488 }
489
490 // Note that this logic is absolutely wrong. Given a parcelable
491 // org.some.Foo.Bar, the class name is Foo.Bar, but this code will claim that
492 // the class is just Bar. However, this was the way it was done in the past.
493 //
494 // See b/17415692
495 size_t dot_pos = type.rfind('.');
496 if (dot_pos != string::npos) {
497 *class_name = type.substr(dot_pos + 1);
498 *package = Split(type.substr(0, dot_pos), ".");
499 } else {
500 *class_name = type;
501 package->clear();
502 }
503
504 return true;
505}
506
Christopher Wiley4a2884b2015-10-07 11:27:45 -0700507} // namespace
508
509namespace internals {
510
Christopher Wileyef140932015-11-03 09:29:19 -0800511bool parse_preprocessed_file(const IoDelegate& io_delegate,
512 const string& filename, TypeNamespace* types) {
513 bool success = true;
514 unique_ptr<LineReader> line_reader = io_delegate.GetLineReader(filename);
515 if (!line_reader) {
516 LOG(ERROR) << "cannot open preprocessed file: " << filename;
517 success = false;
518 return success;
519 }
520
521 string line;
522 unsigned lineno = 1;
523 for ( ; line_reader->ReadLine(&line); ++lineno) {
524 if (line.empty() || line.compare(0, 2, "//") == 0) {
525 // skip comments and empty lines
526 continue;
527 }
528
529 string decl;
530 vector<string> package;
531 string class_name;
532 if (!ParsePreprocessedLine(line, &decl, &package, &class_name)) {
533 success = false;
534 break;
535 }
536
537 if (decl == "parcelable") {
Christopher Wiley8aa4d9f2015-11-16 19:10:45 -0800538 AidlParcelable doc(new AidlQualifiedName(class_name, ""),
539 lineno, package);
Casey Dahlinc1f39b42015-11-24 10:34:34 -0800540 types->AddParcelableType(doc, filename);
Christopher Wileyef140932015-11-03 09:29:19 -0800541 } else if (decl == "interface") {
Casey Dahlind40e2fe2015-11-24 14:06:52 -0800542 auto temp = new std::vector<std::unique_ptr<AidlMember>>();
Christopher Wileyef140932015-11-03 09:29:19 -0800543 AidlInterface doc(class_name, lineno, "", false, temp, package);
Casey Dahlinc1f39b42015-11-24 10:34:34 -0800544 types->AddBinderType(doc, filename);
Christopher Wileyef140932015-11-03 09:29:19 -0800545 } else {
546 success = false;
547 break;
548 }
549 }
550 if (!success) {
551 LOG(ERROR) << filename << ':' << lineno
552 << " malformed preprocessed file line: '" << line << "'";
553 }
554
555 return success;
556}
557
Steven Moreland5557f1c2018-07-02 13:50:23 -0700558AidlError load_and_validate_aidl(const std::vector<std::string>& preprocessed_files,
559 const std::vector<std::string>& import_paths,
560 const std::string& input_file_name, const bool generate_traces,
561 const IoDelegate& io_delegate, TypeNamespace* types,
562 std::unique_ptr<AidlDefinedType>* returned_type,
563 std::vector<std::unique_ptr<AidlImport>>* returned_imports) {
Christopher Wiley632801d2015-11-05 14:15:49 -0800564 AidlError err = AidlError::OK;
Adam Lesinskiffa16862014-01-23 18:17:42 -0800565
Casey Dahlinc1f39b42015-11-24 10:34:34 -0800566 std::map<AidlImport*,std::unique_ptr<AidlDocument>> docs;
Casey Dahlin624358c2015-10-12 19:29:51 -0700567
Christopher Wiley3a9d1582015-09-16 12:42:14 -0700568 // import the preprocessed file
Christopher Wileyeb1acc12015-09-16 11:25:13 -0700569 for (const string& s : preprocessed_files) {
Christopher Wileyef140932015-11-03 09:29:19 -0800570 if (!parse_preprocessed_file(io_delegate, s, types)) {
Christopher Wiley632801d2015-11-05 14:15:49 -0800571 err = AidlError::BAD_PRE_PROCESSED_FILE;
Christopher Wileyef140932015-11-03 09:29:19 -0800572 }
Christopher Wiley3a9d1582015-09-16 12:42:14 -0700573 }
Christopher Wiley632801d2015-11-05 14:15:49 -0800574 if (err != AidlError::OK) {
Christopher Wiley3a9d1582015-09-16 12:42:14 -0700575 return err;
576 }
Adam Lesinskiffa16862014-01-23 18:17:42 -0800577
Christopher Wileyc16e5e72015-09-16 10:49:40 -0700578 // parse the input file
Christopher Wiley4a2884b2015-10-07 11:27:45 -0700579 Parser p{io_delegate};
580 if (!p.ParseFile(input_file_name)) {
Christopher Wiley632801d2015-11-05 14:15:49 -0800581 return AidlError::PARSE_ERROR;
Christopher Wiley4a2884b2015-10-07 11:27:45 -0700582 }
Casey Dahlin2cc93162015-10-02 16:14:17 -0700583
Casey Dahlinc1f39b42015-11-24 10:34:34 -0800584 AidlDocument* parsed_doc = p.GetDocument();
585
Steven Morelandc258abc2018-07-10 14:03:38 -0700586 if (parsed_doc->GetDefinedTypes().empty()) {
587 LOG(ERROR) << "Cannot generate file without any definitions.";
588 return AidlError::BAD_TYPE;
589 }
Casey Dahlinc1f39b42015-11-24 10:34:34 -0800590
Steven Morelandc258abc2018-07-10 14:03:38 -0700591 bool has_only_unstructured_parcelables = true;
592 for (const auto& defined_type : parsed_doc->GetDefinedTypes()) {
593 if (defined_type->AsStructuredParcelable() != nullptr ||
594 defined_type->AsInterface() != nullptr) {
595 has_only_unstructured_parcelables = false;
596 break;
597 }
598 }
599 if (has_only_unstructured_parcelables) {
600 LOG(ERROR) << "Refusing to generate code with unstructured parcelables.";
Christopher Wiley632801d2015-11-05 14:15:49 -0800601 return AidlError::FOUND_PARCELABLE;
602 }
603
Steven Morelandc258abc2018-07-10 14:03:38 -0700604 if (parsed_doc->GetDefinedTypes().size() > 1) {
605 LOG(ERROR) << "Exactly one structured type is required to be defined.";
606 return AidlError::BAD_TYPE;
607 }
608
609 unique_ptr<AidlDefinedType> defined_type(parsed_doc->ReleaseDefinedType());
610 AidlInterface* interface = defined_type->AsInterface();
611 AidlStructuredParcelable* parcelable = defined_type->AsStructuredParcelable();
612
613 CHECK(interface != nullptr || parcelable != nullptr);
614
Steven Moreland5557f1c2018-07-02 13:50:23 -0700615 if (!check_filename(input_file_name.c_str(), defined_type->GetPackage(), defined_type->GetName(),
616 defined_type->GetLine()) ||
617 !types->IsValidPackage(defined_type->GetPackage())) {
618 LOG(ERROR) << "Invalid package declaration '" << defined_type->GetPackage() << "'";
Christopher Wiley632801d2015-11-05 14:15:49 -0800619 return AidlError::BAD_PACKAGE;
620 }
Adam Lesinskiffa16862014-01-23 18:17:42 -0800621
Christopher Wileyc16e5e72015-09-16 10:49:40 -0700622 // parse the imports of the input file
Christopher Wiley72877ac2015-10-06 14:41:42 -0700623 ImportResolver import_resolver{io_delegate, import_paths};
Casey Dahlin0edf3422015-10-07 12:34:59 -0700624 for (auto& import : p.GetImports()) {
Christopher Wiley934a82d2016-01-27 13:02:24 -0800625 if (types->HasImportType(*import)) {
Christopher Wileyfb4b22d2015-09-25 15:16:13 -0700626 // There are places in the Android tree where an import doesn't resolve,
627 // but we'll pick the type up through the preprocessed types.
628 // This seems like an error, but legacy support demands we support it...
Christopher Wileyc16e5e72015-09-16 10:49:40 -0700629 continue;
630 }
Casey Dahlin0edf3422015-10-07 12:34:59 -0700631 string import_path = import_resolver.FindImportFile(import->GetNeededClass());
Christopher Wiley72877ac2015-10-06 14:41:42 -0700632 if (import_path.empty()) {
Casey Dahlin0edf3422015-10-07 12:34:59 -0700633 cerr << import->GetFileFrom() << ":" << import->GetLine()
Christopher Wileyc16e5e72015-09-16 10:49:40 -0700634 << ": couldn't find import for class "
Casey Dahlin0edf3422015-10-07 12:34:59 -0700635 << import->GetNeededClass() << endl;
Christopher Wiley632801d2015-11-05 14:15:49 -0800636 err = AidlError::BAD_IMPORT;
Christopher Wileyc16e5e72015-09-16 10:49:40 -0700637 continue;
638 }
Casey Dahlin0edf3422015-10-07 12:34:59 -0700639 import->SetFilename(import_path);
Casey Dahlin2cc93162015-10-02 16:14:17 -0700640
Christopher Wiley4a2884b2015-10-07 11:27:45 -0700641 Parser p{io_delegate};
Casey Dahlin0edf3422015-10-07 12:34:59 -0700642 if (!p.ParseFile(import->GetFilename())) {
Christopher Wileyc16e5e72015-09-16 10:49:40 -0700643 cerr << "error while parsing import for class "
Casey Dahlin0edf3422015-10-07 12:34:59 -0700644 << import->GetNeededClass() << endl;
Christopher Wiley632801d2015-11-05 14:15:49 -0800645 err = AidlError::BAD_IMPORT;
Christopher Wileyc16e5e72015-09-16 10:49:40 -0700646 continue;
647 }
Christopher Wiley4a2884b2015-10-07 11:27:45 -0700648
Casey Dahlinc1f39b42015-11-24 10:34:34 -0800649 std::unique_ptr<AidlDocument> document(p.ReleaseDocument());
Steven Morelandc258abc2018-07-10 14:03:38 -0700650 if (!check_filenames(import->GetFilename(), *document)) err = AidlError::BAD_IMPORT;
Casey Dahlinc1f39b42015-11-24 10:34:34 -0800651 docs[import.get()] = std::move(document);
Christopher Wileyc16e5e72015-09-16 10:49:40 -0700652 }
Christopher Wiley632801d2015-11-05 14:15:49 -0800653 if (err != AidlError::OK) {
Christopher Wileyc16e5e72015-09-16 10:49:40 -0700654 return err;
Christopher Wiley3a9d1582015-09-16 12:42:14 -0700655 }
Adam Lesinskiffa16862014-01-23 18:17:42 -0800656
Steven Moreland5557f1c2018-07-02 13:50:23 -0700657 if (interface) {
658 // gather the types that have been declared
Steven Morelandc258abc2018-07-10 14:03:38 -0700659 if (!types->AddBinderType(*interface, input_file_name)) {
Steven Moreland5557f1c2018-07-02 13:50:23 -0700660 err = AidlError::BAD_TYPE;
661 }
662
663 interface->SetGenerateTraces(generate_traces);
Christopher Wiley84c1eac2015-09-23 13:29:28 -0700664 }
Casey Dahlinc1f39b42015-11-24 10:34:34 -0800665
Steven Moreland5557f1c2018-07-02 13:50:23 -0700666 if (parcelable) {
Steven Morelandc258abc2018-07-10 14:03:38 -0700667 if (!types->AddParcelableType(*parcelable, input_file_name)) {
Steven Moreland5557f1c2018-07-02 13:50:23 -0700668 err = AidlError::BAD_TYPE;
669 }
670 }
Casey Dahlina2f77c42015-12-01 18:26:02 -0800671
Steven Moreland5557f1c2018-07-02 13:50:23 -0700672 defined_type->SetLanguageType(types->GetDefinedType(*defined_type));
Martijn Coenenf1b50782018-02-21 21:06:23 +0100673
Casey Dahlin0edf3422015-10-07 12:34:59 -0700674 for (const auto& import : p.GetImports()) {
Casey Dahlinc1f39b42015-11-24 10:34:34 -0800675 // If we skipped an unresolved import above (see comment there) we'll have
676 // an empty bucket here.
677 const auto import_itr = docs.find(import.get());
678 if (import_itr == docs.cend()) {
679 continue;
680 }
681
Steven Morelandc258abc2018-07-10 14:03:38 -0700682 if (!gather_types(import->GetFilename(), *import_itr->second, types)) {
Christopher Wiley632801d2015-11-05 14:15:49 -0800683 err = AidlError::BAD_TYPE;
Christopher Wiley84c1eac2015-09-23 13:29:28 -0700684 }
Christopher Wiley3a9d1582015-09-16 12:42:14 -0700685 }
Adam Lesinskiffa16862014-01-23 18:17:42 -0800686
Christopher Wileyc16e5e72015-09-16 10:49:40 -0700687 // check the referenced types in parsed_doc to make sure we've imported them
Steven Morelandc258abc2018-07-10 14:03:38 -0700688 if (interface && check_types(input_file_name, interface, types) != 0) {
Steven Moreland5557f1c2018-07-02 13:50:23 -0700689 err = AidlError::BAD_TYPE;
690 }
Steven Morelandc258abc2018-07-10 14:03:38 -0700691 if (parcelable && check_types(input_file_name, parcelable, types) != 0) {
Christopher Wiley632801d2015-11-05 14:15:49 -0800692 err = AidlError::BAD_TYPE;
693 }
694 if (err != AidlError::OK) {
695 return err;
696 }
Adam Lesinskiffa16862014-01-23 18:17:42 -0800697
Christopher Wileyc16e5e72015-09-16 10:49:40 -0700698 // assign method ids and validate.
Steven Moreland5557f1c2018-07-02 13:50:23 -0700699 if (interface &&
700 check_and_assign_method_ids(input_file_name.c_str(), interface->GetMethods()) != 0) {
Christopher Wiley632801d2015-11-05 14:15:49 -0800701 return AidlError::BAD_METHOD_ID;
Christopher Wiley3a9d1582015-09-16 12:42:14 -0700702 }
Steven Moreland5557f1c2018-07-02 13:50:23 -0700703 if (interface && !validate_constants(*interface)) {
Christopher Wiley69b44cf2016-05-03 13:43:33 -0700704 return AidlError::BAD_CONSTANTS;
705 }
Adam Lesinskiffa16862014-01-23 18:17:42 -0800706
Steven Morelandc258abc2018-07-10 14:03:38 -0700707 *returned_type = std::move(defined_type);
Casey Dahlin0edf3422015-10-07 12:34:59 -0700708
709 if (returned_imports)
710 p.ReleaseImports(returned_imports);
711
Christopher Wiley632801d2015-11-05 14:15:49 -0800712 return AidlError::OK;
Christopher Wileyeb1acc12015-09-16 11:25:13 -0700713}
714
Casey Dahlin2cc93162015-10-02 16:14:17 -0700715} // namespace internals
716
Christopher Wiley4a2884b2015-10-07 11:27:45 -0700717int compile_aidl_to_cpp(const CppOptions& options,
718 const IoDelegate& io_delegate) {
Steven Moreland5557f1c2018-07-02 13:50:23 -0700719 unique_ptr<AidlDefinedType> defined_type;
Casey Dahlin0edf3422015-10-07 12:34:59 -0700720 std::vector<std::unique_ptr<AidlImport>> imports;
Christopher Wileye3550c62015-09-29 13:26:10 -0700721 unique_ptr<cpp::TypeNamespace> types(new cpp::TypeNamespace());
Christopher Wiley56799522015-10-31 10:17:04 -0700722 types->Init();
Christopher Wiley632801d2015-11-05 14:15:49 -0800723 AidlError err = internals::load_and_validate_aidl(
Steven Moreland4b37e262018-07-17 12:49:38 -0700724 options.preprocessed_files_, options.ImportPaths(), options.InputFileName(),
725 options.ShouldGenTraces(), io_delegate, types.get(), &defined_type, &imports);
Christopher Wiley632801d2015-11-05 14:15:49 -0800726 if (err != AidlError::OK) {
727 return 1;
Christopher Wileyeb1acc12015-09-16 11:25:13 -0700728 }
729
Steven Moreland5557f1c2018-07-02 13:50:23 -0700730 CHECK(defined_type != nullptr);
731
732 if (!write_cpp_dep_file(options, *defined_type, imports, io_delegate)) {
Christopher Wiley3a9911c2016-01-19 12:59:09 -0800733 return 1;
Christopher Wiley19059cb2015-11-05 16:11:56 -0800734 }
Christopher Wileyeb1acc12015-09-16 11:25:13 -0700735
Steven Moreland5557f1c2018-07-02 13:50:23 -0700736 return (cpp::GenerateCpp(options, *types, *defined_type, io_delegate)) ? 0 : 1;
Christopher Wileyeb1acc12015-09-16 11:25:13 -0700737}
738
Christopher Wiley4a2884b2015-10-07 11:27:45 -0700739int compile_aidl_to_java(const JavaOptions& options,
740 const IoDelegate& io_delegate) {
Steven Moreland5557f1c2018-07-02 13:50:23 -0700741 unique_ptr<AidlDefinedType> defined_type;
Casey Dahlin0edf3422015-10-07 12:34:59 -0700742 std::vector<std::unique_ptr<AidlImport>> imports;
Christopher Wileydb154a52015-09-28 16:32:25 -0700743 unique_ptr<java::JavaTypeNamespace> types(new java::JavaTypeNamespace());
Christopher Wiley56799522015-10-31 10:17:04 -0700744 types->Init();
Christopher Wiley632801d2015-11-05 14:15:49 -0800745 AidlError aidl_err = internals::load_and_validate_aidl(
Steven Moreland5557f1c2018-07-02 13:50:23 -0700746 options.preprocessed_files_, options.import_paths_, options.input_file_name_,
747 options.gen_traces_, io_delegate, types.get(), &defined_type, &imports);
Christopher Wiley632801d2015-11-05 14:15:49 -0800748 if (aidl_err == AidlError::FOUND_PARCELABLE && !options.fail_on_parcelable_) {
749 // We aborted code generation because this file contains parcelables.
750 // However, we were not told to complain if we find parcelables.
Christopher Wileyb1bbdf82016-04-21 11:43:45 -0700751 // Just generate a dep file and exit quietly. The dep file is for a legacy
752 // use case by the SDK.
753 write_java_dep_file(options, imports, io_delegate, "");
Christopher Wiley632801d2015-11-05 14:15:49 -0800754 return 0;
755 }
756 if (aidl_err != AidlError::OK) {
757 return 1;
Christopher Wileyeb1acc12015-09-16 11:25:13 -0700758 }
Christopher Wileyeb1acc12015-09-16 11:25:13 -0700759
Steven Moreland5557f1c2018-07-02 13:50:23 -0700760 CHECK(defined_type != nullptr);
761
Christopher Wiley3a9d1582015-09-16 12:42:14 -0700762 string output_file_name = options.output_file_name_;
763 // if needed, generate the output file name from the base folder
Christopher Wiley632801d2015-11-05 14:15:49 -0800764 if (output_file_name.empty() && !options.output_base_folder_.empty()) {
Steven Moreland5557f1c2018-07-02 13:50:23 -0700765 output_file_name = generate_outputFileName(options, *defined_type);
Christopher Wiley3a9d1582015-09-16 12:42:14 -0700766 }
Adam Lesinskiffa16862014-01-23 18:17:42 -0800767
Casey Dahlin64533512015-10-23 17:11:21 -0700768 // make sure the folders of the output file all exists
769 if (!io_delegate.CreatePathForFile(output_file_name)) {
770 return 1;
771 }
772
Christopher Wileyf8136192016-04-12 14:19:35 -0700773 if (!write_java_dep_file(options, imports, io_delegate, output_file_name)) {
Christopher Wiley3a9911c2016-01-19 12:59:09 -0800774 return 1;
Christopher Wiley3a9d1582015-09-16 12:42:14 -0700775 }
Adam Lesinskiffa16862014-01-23 18:17:42 -0800776
Steven Moreland5557f1c2018-07-02 13:50:23 -0700777 return generate_java(output_file_name, options.input_file_name_.c_str(), defined_type.get(),
778 types.get(), io_delegate, options);
Adam Lesinskiffa16862014-01-23 18:17:42 -0800779}
780
Casey Dahlinc1f39b42015-11-24 10:34:34 -0800781bool preprocess_aidl(const JavaOptions& options,
782 const IoDelegate& io_delegate) {
783 unique_ptr<CodeWriter> writer =
784 io_delegate.GetCodeWriter(options.output_file_name_);
Adam Lesinskiffa16862014-01-23 18:17:42 -0800785
Casey Dahlinc1f39b42015-11-24 10:34:34 -0800786 for (const auto& file : options.files_to_preprocess_) {
787 Parser p{io_delegate};
788 if (!p.ParseFile(file))
789 return false;
790 AidlDocument* doc = p.GetDocument();
791 string line;
Casey Dahlin59401da2015-10-09 18:16:45 -0700792
Steven Morelandc258abc2018-07-10 14:03:38 -0700793 for (const auto& defined_type : doc->GetDefinedTypes()) {
794 if (!writer->Write("%s %s;\n", defined_type->GetAidlDeclarationName().c_str(),
795 defined_type->GetCanonicalName().c_str())) {
Casey Dahlinc1f39b42015-11-24 10:34:34 -0800796 return false;
797 }
Adam Lesinskiffa16862014-01-23 18:17:42 -0800798 }
Casey Dahlinc1f39b42015-11-24 10:34:34 -0800799 }
Adam Lesinskiffa16862014-01-23 18:17:42 -0800800
Casey Dahlinc1f39b42015-11-24 10:34:34 -0800801 return writer->Close();
Adam Lesinskiffa16862014-01-23 18:17:42 -0800802}
Christopher Wileyfdeb0f42015-09-11 15:38:22 -0700803
804} // namespace android
805} // namespace aidl