summaryrefslogtreecommitdiff
path: root/tools/stats_log_api_gen/native_writer.cpp
diff options
context:
space:
mode:
authorMuhammad Qureshi <muhammadq@google.com>2020-04-01 16:11:53 -0700
committerMuhammad Qureshi <muhammadq@google.com>2020-04-03 17:00:55 -0700
commit3f9c330eefa661c2f443568f4dd97a3057b1323d (patch)
tree35be331b62727f265c2c990b27ec1e25b09e5418 /tools/stats_log_api_gen/native_writer.cpp
parent5afebd9a448bfb2112ca51645a2f48570064c9c1 (diff)
Make state_option top-level boolean annotations
- Add AnnotationId enum stats-log-api-gen - Rename RESET_STATE annotation to TRIGGER_STATE_RESET. Also rename the proto annotation. Bug: 152412767 Test: stats-log-api-gen-test Test: m statslog-framework-java-gen Change-Id: I2c12ea0b9222ef28b8cc11ea36b272e518a96259
Diffstat (limited to 'tools/stats_log_api_gen/native_writer.cpp')
-rw-r--r--tools/stats_log_api_gen/native_writer.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/tools/stats_log_api_gen/native_writer.cpp b/tools/stats_log_api_gen/native_writer.cpp
index d8db62087f8f..0c6c0099e459 100644
--- a/tools/stats_log_api_gen/native_writer.cpp
+++ b/tools/stats_log_api_gen/native_writer.cpp
@@ -30,7 +30,6 @@ static void write_native_annotation_constants(FILE* out) {
fprintf(out, "\n");
}
-
static void write_annotations(FILE* out, int argIndex,
const FieldNumberToAtomDeclSet& fieldNumberToAtomDeclSet,
const string& methodPrefix, const string& methodSuffix) {
@@ -47,11 +46,10 @@ static void write_annotations(FILE* out, int argIndex,
int resetState = -1;
int defaultState = -1;
for (const shared_ptr<Annotation>& annotation : annotations) {
- const string& annotationConstant =
- ANNOTATION_ID_CONSTANTS.at(annotation->annotationId);
+ const string& annotationConstant = ANNOTATION_ID_CONSTANTS.at(annotation->annotationId);
switch (annotation->type) {
case ANNOTATION_TYPE_INT:
- if (ANNOTATION_ID_RESET_STATE == annotation->annotationId) {
+ if (ANNOTATION_ID_TRIGGER_STATE_RESET == annotation->annotationId) {
resetState = annotation->value.intValue;
} else if (ANNOTATION_ID_DEFAULT_STATE == annotation->annotationId) {
defaultState = annotation->value.intValue;
@@ -74,7 +72,7 @@ static void write_annotations(FILE* out, int argIndex,
}
if (defaultState != -1 && resetState != -1) {
const string& annotationConstant =
- ANNOTATION_ID_CONSTANTS.at(ANNOTATION_ID_RESET_STATE);
+ ANNOTATION_ID_CONSTANTS.at(ANNOTATION_ID_TRIGGER_STATE_RESET);
fprintf(out, " if (arg%d == %d) {\n", argIndex, resetState);
fprintf(out, " %saddInt32Annotation(%s%s, %d);\n", methodPrefix.c_str(),
methodSuffix.c_str(), annotationConstant.c_str(), defaultState);