summaryrefslogtreecommitdiff
path: root/tools/stats_log_api_gen/Collation.cpp
diff options
context:
space:
mode:
authorChenjie Yu <cjyu@google.com>2018-08-29 11:49:11 -0700
committerChenjie Yu <cjyu@google.com>2018-09-10 18:26:33 -0700
commit159e4f8f461097a2dfffb545f46734dd7d9610f3 (patch)
treeb03a696f749bbbb3799c0ecbd630adebf711362b /tools/stats_log_api_gen/Collation.cpp
parent1941814f8e9b44d91f996b137e8683fbf80bc70a (diff)
allow use of atom definition outside of atoms.proto in pulled atoms
There will be followup cls to add support of new types that can be nested and repeated. + skip StatsLog.write signature generation for pulled atoms. Bug: 113872139 Test: manual test Change-Id: I69d0ee0b2fe8e286e48eac20ec2c8b280c477bf0
Diffstat (limited to 'tools/stats_log_api_gen/Collation.cpp')
-rw-r--r--tools/stats_log_api_gen/Collation.cpp19
1 files changed, 14 insertions, 5 deletions
diff --git a/tools/stats_log_api_gen/Collation.cpp b/tools/stats_log_api_gen/Collation.cpp
index f294728860ae..4245700ed90d 100644
--- a/tools/stats_log_api_gen/Collation.cpp
+++ b/tools/stats_log_api_gen/Collation.cpp
@@ -195,9 +195,11 @@ int collate_atom(const Descriptor *atom, AtomDecl *atomDecl,
print_error(field, "Unkown type for field: %s\n", field->name().c_str());
errorCount++;
continue;
- } else if (javaType == JAVA_TYPE_OBJECT) {
+ } else if (javaType == JAVA_TYPE_OBJECT &&
+ atomDecl->code < PULL_ATOM_START_ID) {
// Allow attribution chain, but only at position 1.
- print_error(field, "Message type not allowed for field: %s\n",
+ print_error(field,
+ "Message type not allowed for field in pushed atoms: %s\n",
field->name().c_str());
errorCount++;
continue;
@@ -233,12 +235,19 @@ int collate_atom(const Descriptor *atom, AtomDecl *atomDecl,
java_type_t javaType = java_type(field);
AtomField atField(field->name(), javaType);
+ // Generate signature for pushed atoms
+ if (atomDecl->code < PULL_ATOM_START_ID) {
+ if (javaType == JAVA_TYPE_ENUM) {
+ // All enums are treated as ints when it comes to function signatures.
+ signature->push_back(JAVA_TYPE_INT);
+ collate_enums(*field->enum_type(), &atField);
+ } else {
+ signature->push_back(javaType);
+ }
+ }
if (javaType == JAVA_TYPE_ENUM) {
// All enums are treated as ints when it comes to function signatures.
- signature->push_back(JAVA_TYPE_INT);
collate_enums(*field->enum_type(), &atField);
- } else {
- signature->push_back(javaType);
}
atomDecl->fields.push_back(atField);