Yao Chen | d54f9dd | 2017-10-17 17:37:48 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2017, The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #include "Collation.h" |
Yangster-mac | ba5b9e4 | 2018-01-10 21:31:59 -0800 | [diff] [blame] | 18 | #include "frameworks/base/cmds/statsd/src/atoms.pb.h" |
Yao Chen | d54f9dd | 2017-10-17 17:37:48 +0000 | [diff] [blame] | 19 | |
| 20 | #include <stdio.h> |
| 21 | #include <map> |
| 22 | |
| 23 | namespace android { |
| 24 | namespace stats_log_api_gen { |
| 25 | |
Stefan Lafon | 9478f35 | 2017-10-30 21:20:20 -0700 | [diff] [blame] | 26 | using google::protobuf::EnumDescriptor; |
Yao Chen | d54f9dd | 2017-10-17 17:37:48 +0000 | [diff] [blame] | 27 | using google::protobuf::FieldDescriptor; |
| 28 | using google::protobuf::FileDescriptor; |
| 29 | using google::protobuf::SourceLocation; |
| 30 | using std::map; |
| 31 | |
| 32 | |
| 33 | // |
| 34 | // AtomDecl class |
| 35 | // |
| 36 | |
| 37 | AtomDecl::AtomDecl() |
| 38 | :code(0), |
| 39 | name() |
| 40 | { |
| 41 | } |
| 42 | |
| 43 | AtomDecl::AtomDecl(const AtomDecl& that) |
Yao Chen | 9c1debe | 2018-02-19 14:39:19 -0800 | [diff] [blame] | 44 | : code(that.code), |
| 45 | name(that.name), |
| 46 | message(that.message), |
| 47 | fields(that.fields), |
| 48 | primaryFields(that.primaryFields), |
Yao Chen | c40a19d | 2018-03-15 16:48:25 -0700 | [diff] [blame] | 49 | exclusiveField(that.exclusiveField), |
Yao Chen | bbdd67d | 2018-10-24 12:15:56 -0700 | [diff] [blame] | 50 | uidField(that.uidField), |
| 51 | binaryFields(that.binaryFields) {} |
Yao Chen | d54f9dd | 2017-10-17 17:37:48 +0000 | [diff] [blame] | 52 | |
| 53 | AtomDecl::AtomDecl(int c, const string& n, const string& m) |
| 54 | :code(c), |
| 55 | name(n), |
| 56 | message(m) |
| 57 | { |
| 58 | } |
| 59 | |
| 60 | AtomDecl::~AtomDecl() |
| 61 | { |
| 62 | } |
| 63 | |
| 64 | |
| 65 | /** |
| 66 | * Print an error message for a FieldDescriptor, including the file name and line number. |
| 67 | */ |
| 68 | static void |
| 69 | print_error(const FieldDescriptor* field, const char* format, ...) |
| 70 | { |
| 71 | const Descriptor* message = field->containing_type(); |
| 72 | const FileDescriptor* file = message->file(); |
| 73 | |
| 74 | SourceLocation loc; |
| 75 | if (field->GetSourceLocation(&loc)) { |
| 76 | // TODO: this will work if we can figure out how to pass --include_source_info to protoc |
| 77 | fprintf(stderr, "%s:%d: ", file->name().c_str(), loc.start_line); |
| 78 | } else { |
| 79 | fprintf(stderr, "%s: ", file->name().c_str()); |
| 80 | } |
| 81 | va_list args; |
| 82 | va_start(args, format); |
| 83 | vfprintf(stderr, format, args); |
| 84 | va_end (args); |
| 85 | } |
| 86 | |
| 87 | /** |
| 88 | * Convert a protobuf type into a java type. |
| 89 | */ |
| 90 | static java_type_t |
| 91 | java_type(const FieldDescriptor* field) |
| 92 | { |
| 93 | int protoType = field->type(); |
| 94 | switch (protoType) { |
| 95 | case FieldDescriptor::TYPE_DOUBLE: |
| 96 | return JAVA_TYPE_DOUBLE; |
| 97 | case FieldDescriptor::TYPE_FLOAT: |
| 98 | return JAVA_TYPE_FLOAT; |
| 99 | case FieldDescriptor::TYPE_INT64: |
| 100 | return JAVA_TYPE_LONG; |
| 101 | case FieldDescriptor::TYPE_UINT64: |
| 102 | return JAVA_TYPE_LONG; |
| 103 | case FieldDescriptor::TYPE_INT32: |
| 104 | return JAVA_TYPE_INT; |
| 105 | case FieldDescriptor::TYPE_FIXED64: |
| 106 | return JAVA_TYPE_LONG; |
| 107 | case FieldDescriptor::TYPE_FIXED32: |
| 108 | return JAVA_TYPE_INT; |
| 109 | case FieldDescriptor::TYPE_BOOL: |
| 110 | return JAVA_TYPE_BOOLEAN; |
| 111 | case FieldDescriptor::TYPE_STRING: |
| 112 | return JAVA_TYPE_STRING; |
| 113 | case FieldDescriptor::TYPE_GROUP: |
| 114 | return JAVA_TYPE_UNKNOWN; |
| 115 | case FieldDescriptor::TYPE_MESSAGE: |
| 116 | // TODO: not the final package name |
Yangster-mac | 7604aea | 2017-12-11 22:55:49 -0800 | [diff] [blame] | 117 | if (field->message_type()->full_name() == |
Yangster-mac | 2087716 | 2017-12-22 17:19:39 -0800 | [diff] [blame] | 118 | "android.os.statsd.AttributionNode") { |
Yangster-mac | 7604aea | 2017-12-11 22:55:49 -0800 | [diff] [blame] | 119 | return JAVA_TYPE_ATTRIBUTION_CHAIN; |
Yangster-mac | 48b3d62 | 2018-08-18 12:38:11 -0700 | [diff] [blame] | 120 | } else if (field->message_type()->full_name() == |
| 121 | "android.os.statsd.KeyValuePair") { |
| 122 | return JAVA_TYPE_KEY_VALUE_PAIR; |
Yao Chen | bbdd67d | 2018-10-24 12:15:56 -0700 | [diff] [blame] | 123 | } else if (field->options().GetExtension(os::statsd::log_mode) == |
| 124 | os::statsd::LogMode::MODE_BYTES) { |
| 125 | return JAVA_TYPE_BYTE_ARRAY; |
Yao Chen | d54f9dd | 2017-10-17 17:37:48 +0000 | [diff] [blame] | 126 | } else { |
| 127 | return JAVA_TYPE_OBJECT; |
| 128 | } |
| 129 | case FieldDescriptor::TYPE_BYTES: |
| 130 | return JAVA_TYPE_BYTE_ARRAY; |
| 131 | case FieldDescriptor::TYPE_UINT32: |
| 132 | return JAVA_TYPE_INT; |
| 133 | case FieldDescriptor::TYPE_ENUM: |
Stefan Lafon | 9478f35 | 2017-10-30 21:20:20 -0700 | [diff] [blame] | 134 | return JAVA_TYPE_ENUM; |
Yao Chen | d54f9dd | 2017-10-17 17:37:48 +0000 | [diff] [blame] | 135 | case FieldDescriptor::TYPE_SFIXED32: |
| 136 | return JAVA_TYPE_INT; |
| 137 | case FieldDescriptor::TYPE_SFIXED64: |
| 138 | return JAVA_TYPE_LONG; |
| 139 | case FieldDescriptor::TYPE_SINT32: |
| 140 | return JAVA_TYPE_INT; |
| 141 | case FieldDescriptor::TYPE_SINT64: |
| 142 | return JAVA_TYPE_LONG; |
| 143 | default: |
| 144 | return JAVA_TYPE_UNKNOWN; |
| 145 | } |
| 146 | } |
| 147 | |
| 148 | /** |
Yangster-mac | ba5b9e4 | 2018-01-10 21:31:59 -0800 | [diff] [blame] | 149 | * Gather the enums info. |
| 150 | */ |
| 151 | void collate_enums(const EnumDescriptor &enumDescriptor, AtomField *atomField) { |
| 152 | for (int i = 0; i < enumDescriptor.value_count(); i++) { |
| 153 | atomField->enumValues[enumDescriptor.value(i)->number()] = |
| 154 | enumDescriptor.value(i)->name().c_str(); |
| 155 | } |
| 156 | } |
| 157 | |
| 158 | /** |
Yangster-mac | 7604aea | 2017-12-11 22:55:49 -0800 | [diff] [blame] | 159 | * Gather the info about an atom proto. |
| 160 | */ |
| 161 | int collate_atom(const Descriptor *atom, AtomDecl *atomDecl, |
| 162 | vector<java_type_t> *signature) { |
| 163 | |
| 164 | int errorCount = 0; |
| 165 | // Build a sorted list of the fields. Descriptor has them in source file |
| 166 | // order. |
| 167 | map<int, const FieldDescriptor *> fields; |
| 168 | for (int j = 0; j < atom->field_count(); j++) { |
| 169 | const FieldDescriptor *field = atom->field(j); |
| 170 | fields[field->number()] = field; |
| 171 | } |
| 172 | |
| 173 | // Check that the parameters start at 1 and go up sequentially. |
| 174 | int expectedNumber = 1; |
| 175 | for (map<int, const FieldDescriptor *>::const_iterator it = fields.begin(); |
| 176 | it != fields.end(); it++) { |
| 177 | const int number = it->first; |
| 178 | const FieldDescriptor *field = it->second; |
| 179 | if (number != expectedNumber) { |
| 180 | print_error(field, |
| 181 | "Fields must be numbered consecutively starting at 1:" |
| 182 | " '%s' is %d but should be %d\n", |
| 183 | field->name().c_str(), number, expectedNumber); |
| 184 | errorCount++; |
| 185 | expectedNumber = number; |
| 186 | continue; |
| 187 | } |
| 188 | expectedNumber++; |
| 189 | } |
| 190 | |
| 191 | // Check that only allowed types are present. Remove any invalid ones. |
| 192 | for (map<int, const FieldDescriptor *>::const_iterator it = fields.begin(); |
| 193 | it != fields.end(); it++) { |
| 194 | const FieldDescriptor *field = it->second; |
Yao Chen | bbdd67d | 2018-10-24 12:15:56 -0700 | [diff] [blame] | 195 | bool isBinaryField = field->options().GetExtension(os::statsd::log_mode) == |
| 196 | os::statsd::LogMode::MODE_BYTES; |
Yangster-mac | 7604aea | 2017-12-11 22:55:49 -0800 | [diff] [blame] | 197 | |
| 198 | java_type_t javaType = java_type(field); |
| 199 | |
| 200 | if (javaType == JAVA_TYPE_UNKNOWN) { |
| 201 | print_error(field, "Unkown type for field: %s\n", field->name().c_str()); |
| 202 | errorCount++; |
| 203 | continue; |
Chenjie Yu | 159e4f8 | 2018-08-29 11:49:11 -0700 | [diff] [blame] | 204 | } else if (javaType == JAVA_TYPE_OBJECT && |
| 205 | atomDecl->code < PULL_ATOM_START_ID) { |
Yao Chen | bbdd67d | 2018-10-24 12:15:56 -0700 | [diff] [blame] | 206 | // Allow attribution chain, but only at position 1. |
| 207 | print_error(field, |
| 208 | "Message type not allowed for field in pushed atoms: %s\n", |
| 209 | field->name().c_str()); |
| 210 | errorCount++; |
| 211 | continue; |
| 212 | } else if (javaType == JAVA_TYPE_BYTE_ARRAY && !isBinaryField) { |
| 213 | print_error(field, "Raw bytes type not allowed for field: %s\n", |
| 214 | field->name().c_str()); |
| 215 | errorCount++; |
| 216 | continue; |
| 217 | } |
| 218 | |
| 219 | if (isBinaryField && javaType != JAVA_TYPE_BYTE_ARRAY) { |
| 220 | print_error(field, "Cannot mark field %s as bytes.\n", |
| 221 | field->name().c_str()); |
| 222 | errorCount++; |
| 223 | continue; |
Yangster-mac | 7604aea | 2017-12-11 22:55:49 -0800 | [diff] [blame] | 224 | } |
| 225 | } |
| 226 | |
| 227 | // Check that if there's an attribution chain, it's at position 1. |
| 228 | for (map<int, const FieldDescriptor *>::const_iterator it = fields.begin(); |
| 229 | it != fields.end(); it++) { |
| 230 | int number = it->first; |
| 231 | if (number != 1) { |
| 232 | const FieldDescriptor *field = it->second; |
| 233 | java_type_t javaType = java_type(field); |
| 234 | if (javaType == JAVA_TYPE_ATTRIBUTION_CHAIN) { |
| 235 | print_error( |
| 236 | field, |
| 237 | "AttributionChain fields must have field id 1, in message: '%s'\n", |
| 238 | atom->name().c_str()); |
| 239 | errorCount++; |
| 240 | } |
| 241 | } |
| 242 | } |
| 243 | |
| 244 | // Build the type signature and the atom data. |
| 245 | for (map<int, const FieldDescriptor *>::const_iterator it = fields.begin(); |
| 246 | it != fields.end(); it++) { |
| 247 | const FieldDescriptor *field = it->second; |
| 248 | java_type_t javaType = java_type(field); |
Yao Chen | bbdd67d | 2018-10-24 12:15:56 -0700 | [diff] [blame] | 249 | bool isBinaryField = field->options().GetExtension(os::statsd::log_mode) == |
| 250 | os::statsd::LogMode::MODE_BYTES; |
Yangster-mac | 7604aea | 2017-12-11 22:55:49 -0800 | [diff] [blame] | 251 | |
| 252 | AtomField atField(field->name(), javaType); |
Chenjie Yu | 159e4f8 | 2018-08-29 11:49:11 -0700 | [diff] [blame] | 253 | // Generate signature for pushed atoms |
| 254 | if (atomDecl->code < PULL_ATOM_START_ID) { |
| 255 | if (javaType == JAVA_TYPE_ENUM) { |
| 256 | // All enums are treated as ints when it comes to function signatures. |
| 257 | signature->push_back(JAVA_TYPE_INT); |
| 258 | collate_enums(*field->enum_type(), &atField); |
Yao Chen | bbdd67d | 2018-10-24 12:15:56 -0700 | [diff] [blame] | 259 | } else if (javaType == JAVA_TYPE_OBJECT && isBinaryField) { |
| 260 | signature->push_back(JAVA_TYPE_BYTE_ARRAY); |
Chenjie Yu | 159e4f8 | 2018-08-29 11:49:11 -0700 | [diff] [blame] | 261 | } else { |
Yao Chen | bbdd67d | 2018-10-24 12:15:56 -0700 | [diff] [blame] | 262 | signature->push_back(javaType); |
Chenjie Yu | 159e4f8 | 2018-08-29 11:49:11 -0700 | [diff] [blame] | 263 | } |
| 264 | } |
Yangster-mac | 7604aea | 2017-12-11 22:55:49 -0800 | [diff] [blame] | 265 | if (javaType == JAVA_TYPE_ENUM) { |
| 266 | // All enums are treated as ints when it comes to function signatures. |
Yangster-mac | ba5b9e4 | 2018-01-10 21:31:59 -0800 | [diff] [blame] | 267 | collate_enums(*field->enum_type(), &atField); |
Yangster-mac | 7604aea | 2017-12-11 22:55:49 -0800 | [diff] [blame] | 268 | } |
| 269 | atomDecl->fields.push_back(atField); |
Yao Chen | 9c1debe | 2018-02-19 14:39:19 -0800 | [diff] [blame] | 270 | |
Yangster-mac | b6b77c6 | 2018-10-12 19:33:24 -0700 | [diff] [blame] | 271 | if (field->options().GetExtension(os::statsd::state_field_option).option() == |
Yao Chen | 9c1debe | 2018-02-19 14:39:19 -0800 | [diff] [blame] | 272 | os::statsd::StateField::PRIMARY) { |
| 273 | if (javaType == JAVA_TYPE_UNKNOWN || |
| 274 | javaType == JAVA_TYPE_ATTRIBUTION_CHAIN || |
| 275 | javaType == JAVA_TYPE_OBJECT || javaType == JAVA_TYPE_BYTE_ARRAY) { |
| 276 | errorCount++; |
| 277 | } |
| 278 | atomDecl->primaryFields.push_back(it->first); |
| 279 | } |
| 280 | |
Yangster-mac | b6b77c6 | 2018-10-12 19:33:24 -0700 | [diff] [blame] | 281 | if (field->options().GetExtension(os::statsd::state_field_option).option() == |
Yao Chen | 9c1debe | 2018-02-19 14:39:19 -0800 | [diff] [blame] | 282 | os::statsd::StateField::EXCLUSIVE) { |
| 283 | if (javaType == JAVA_TYPE_UNKNOWN || |
| 284 | javaType == JAVA_TYPE_ATTRIBUTION_CHAIN || |
| 285 | javaType == JAVA_TYPE_OBJECT || javaType == JAVA_TYPE_BYTE_ARRAY) { |
| 286 | errorCount++; |
| 287 | } |
| 288 | |
| 289 | if (atomDecl->exclusiveField == 0) { |
| 290 | atomDecl->exclusiveField = it->first; |
| 291 | } else { |
| 292 | errorCount++; |
| 293 | } |
| 294 | } |
Yao Chen | c40a19d | 2018-03-15 16:48:25 -0700 | [diff] [blame] | 295 | |
| 296 | if (field->options().GetExtension(os::statsd::is_uid) == true) { |
| 297 | if (javaType != JAVA_TYPE_INT) { |
| 298 | errorCount++; |
| 299 | } |
| 300 | |
| 301 | if (atomDecl->uidField == 0) { |
| 302 | atomDecl->uidField = it->first; |
| 303 | } else { |
| 304 | errorCount++; |
| 305 | } |
| 306 | } |
Yao Chen | bbdd67d | 2018-10-24 12:15:56 -0700 | [diff] [blame] | 307 | // Binary field validity is already checked above. |
| 308 | if (isBinaryField) { |
| 309 | atomDecl->binaryFields.push_back(it->first); |
| 310 | } |
Yangster-mac | 7604aea | 2017-12-11 22:55:49 -0800 | [diff] [blame] | 311 | } |
| 312 | |
| 313 | return errorCount; |
| 314 | } |
| 315 | |
Yangster-mac | ba5b9e4 | 2018-01-10 21:31:59 -0800 | [diff] [blame] | 316 | // This function flattens the fields of the AttributionNode proto in an Atom proto and generates |
| 317 | // the corresponding atom decl and signature. |
| 318 | bool get_non_chained_node(const Descriptor *atom, AtomDecl *atomDecl, |
| 319 | vector<java_type_t> *signature) { |
| 320 | // Build a sorted list of the fields. Descriptor has them in source file |
| 321 | // order. |
| 322 | map<int, const FieldDescriptor *> fields; |
| 323 | for (int j = 0; j < atom->field_count(); j++) { |
| 324 | const FieldDescriptor *field = atom->field(j); |
| 325 | fields[field->number()] = field; |
| 326 | } |
| 327 | |
| 328 | AtomDecl attributionDecl; |
| 329 | vector<java_type_t> attributionSignature; |
| 330 | collate_atom(android::os::statsd::AttributionNode::descriptor(), |
| 331 | &attributionDecl, &attributionSignature); |
| 332 | |
| 333 | // Build the type signature and the atom data. |
| 334 | bool has_attribution_node = false; |
| 335 | for (map<int, const FieldDescriptor *>::const_iterator it = fields.begin(); |
| 336 | it != fields.end(); it++) { |
| 337 | const FieldDescriptor *field = it->second; |
| 338 | java_type_t javaType = java_type(field); |
| 339 | if (javaType == JAVA_TYPE_ATTRIBUTION_CHAIN) { |
| 340 | atomDecl->fields.insert( |
| 341 | atomDecl->fields.end(), |
| 342 | attributionDecl.fields.begin(), attributionDecl.fields.end()); |
| 343 | signature->insert( |
| 344 | signature->end(), |
| 345 | attributionSignature.begin(), attributionSignature.end()); |
| 346 | has_attribution_node = true; |
| 347 | |
| 348 | } else { |
| 349 | AtomField atField(field->name(), javaType); |
| 350 | if (javaType == JAVA_TYPE_ENUM) { |
| 351 | // All enums are treated as ints when it comes to function signatures. |
| 352 | signature->push_back(JAVA_TYPE_INT); |
| 353 | collate_enums(*field->enum_type(), &atField); |
| 354 | } else { |
| 355 | signature->push_back(javaType); |
| 356 | } |
| 357 | atomDecl->fields.push_back(atField); |
| 358 | } |
| 359 | } |
| 360 | return has_attribution_node; |
| 361 | } |
| 362 | |
Yangster-mac | 7604aea | 2017-12-11 22:55:49 -0800 | [diff] [blame] | 363 | /** |
Yao Chen | d54f9dd | 2017-10-17 17:37:48 +0000 | [diff] [blame] | 364 | * Gather the info about the atoms. |
| 365 | */ |
Yangster-mac | 7604aea | 2017-12-11 22:55:49 -0800 | [diff] [blame] | 366 | int collate_atoms(const Descriptor *descriptor, Atoms *atoms) { |
| 367 | int errorCount = 0; |
| 368 | const bool dbg = false; |
Yao Chen | d54f9dd | 2017-10-17 17:37:48 +0000 | [diff] [blame] | 369 | |
Yangster-mac | 7604aea | 2017-12-11 22:55:49 -0800 | [diff] [blame] | 370 | for (int i = 0; i < descriptor->field_count(); i++) { |
| 371 | const FieldDescriptor *atomField = descriptor->field(i); |
Yao Chen | d54f9dd | 2017-10-17 17:37:48 +0000 | [diff] [blame] | 372 | |
| 373 | if (dbg) { |
Yangster-mac | 7604aea | 2017-12-11 22:55:49 -0800 | [diff] [blame] | 374 | printf(" %s (%d)\n", atomField->name().c_str(), atomField->number()); |
Yao Chen | d54f9dd | 2017-10-17 17:37:48 +0000 | [diff] [blame] | 375 | } |
| 376 | |
Yangster-mac | 7604aea | 2017-12-11 22:55:49 -0800 | [diff] [blame] | 377 | // StatsEvent only has one oneof, which contains only messages. Don't allow |
| 378 | // other types. |
| 379 | if (atomField->type() != FieldDescriptor::TYPE_MESSAGE) { |
| 380 | print_error(atomField, |
| 381 | "Bad type for atom. StatsEvent can only have message type " |
| 382 | "fields: %s\n", |
| 383 | atomField->name().c_str()); |
| 384 | errorCount++; |
| 385 | continue; |
| 386 | } |
| 387 | |
| 388 | const Descriptor *atom = atomField->message_type(); |
| 389 | AtomDecl atomDecl(atomField->number(), atomField->name(), atom->name()); |
| 390 | vector<java_type_t> signature; |
| 391 | errorCount += collate_atom(atom, &atomDecl, &signature); |
Yao Chen | 9c1debe | 2018-02-19 14:39:19 -0800 | [diff] [blame] | 392 | if (atomDecl.primaryFields.size() != 0 && atomDecl.exclusiveField == 0) { |
| 393 | errorCount++; |
| 394 | } |
Yangster-mac | 7604aea | 2017-12-11 22:55:49 -0800 | [diff] [blame] | 395 | atoms->signatures.insert(signature); |
| 396 | atoms->decls.insert(atomDecl); |
Yangster-mac | ba5b9e4 | 2018-01-10 21:31:59 -0800 | [diff] [blame] | 397 | |
| 398 | AtomDecl nonChainedAtomDecl(atomField->number(), atomField->name(), atom->name()); |
| 399 | vector<java_type_t> nonChainedSignature; |
| 400 | if (get_non_chained_node(atom, &nonChainedAtomDecl, &nonChainedSignature)) { |
| 401 | atoms->non_chained_signatures.insert(nonChainedSignature); |
| 402 | atoms->non_chained_decls.insert(nonChainedAtomDecl); |
| 403 | } |
Yangster-mac | 7604aea | 2017-12-11 22:55:49 -0800 | [diff] [blame] | 404 | } |
| 405 | |
| 406 | if (dbg) { |
| 407 | printf("signatures = [\n"); |
| 408 | for (set<vector<java_type_t>>::const_iterator it = |
| 409 | atoms->signatures.begin(); |
| 410 | it != atoms->signatures.end(); it++) { |
| 411 | printf(" "); |
| 412 | for (vector<java_type_t>::const_iterator jt = it->begin(); |
| 413 | jt != it->end(); jt++) { |
| 414 | printf(" %d", (int)*jt); |
| 415 | } |
| 416 | printf("\n"); |
| 417 | } |
| 418 | printf("]\n"); |
| 419 | } |
| 420 | |
| 421 | return errorCount; |
Yao Chen | d54f9dd | 2017-10-17 17:37:48 +0000 | [diff] [blame] | 422 | } |
| 423 | |
| 424 | } // namespace stats_log_api_gen |
| 425 | } // namespace android |