diff options
| -rw-r--r-- | Android.bp | 8 | ||||
| -rw-r--r-- | core/jni/Android.bp | 10 | ||||
| -rw-r--r-- | core/jni/AndroidRuntime.cpp | 2 | ||||
| -rw-r--r-- | tools/stats_log_api_gen/Android.bp | 2 | ||||
| -rw-r--r-- | tools/stats_log_api_gen/java_writer.cpp | 6 | ||||
| -rw-r--r-- | tools/stats_log_api_gen/java_writer_q.cpp | 64 | ||||
| -rw-r--r-- | tools/stats_log_api_gen/java_writer_q.h | 4 | ||||
| -rw-r--r-- | tools/stats_log_api_gen/main.cpp | 523 | ||||
| -rw-r--r-- | tools/stats_log_api_gen/native_writer.cpp | 22 | ||||
| -rw-r--r-- | tools/stats_log_api_gen/native_writer_q.cpp | 276 | ||||
| -rw-r--r-- | tools/stats_log_api_gen/native_writer_q.h | 49 | ||||
| -rw-r--r-- | tools/stats_log_api_gen/utils.cpp | 12 | ||||
| -rw-r--r-- | tools/stats_log_api_gen/utils.h | 2 |
13 files changed, 17 insertions, 963 deletions
diff --git a/Android.bp b/Android.bp index 9152843b06ae..c4d2ebaea484 100644 --- a/Android.bp +++ b/Android.bp @@ -271,7 +271,6 @@ filegroup { // etc. ":framework-javastream-protos", - ":framework-statslog-gen", // StatsLogInternal.java ":statslog-framework-java-gen", // FrameworkStatsLog.java // telephony annotations @@ -617,13 +616,6 @@ java_library { } genrule { - name: "framework-statslog-gen", - tools: ["stats-log-api-gen"], - cmd: "$(location stats-log-api-gen) --java $(out) --worksource", - out: ["android/util/StatsLogInternal.java"], -} - -genrule { name: "statslog-framework-java-gen", tools: ["stats-log-api-gen"], cmd: "$(location stats-log-api-gen) --java $(out) --module framework" + diff --git a/core/jni/Android.bp b/core/jni/Android.bp index ade2c7d86faf..9ddaa981c382 100644 --- a/core/jni/Android.bp +++ b/core/jni/Android.bp @@ -1,13 +1,4 @@ -genrule { - name: "android_util_StatsLogInternal.cpp", - tools: ["stats-log-api-gen"], - cmd: "$(location stats-log-api-gen) --jni $(genDir)/android_util_StatsLogInternal.cpp", - out: [ - "android_util_StatsLogInternal.cpp", - ], -} - cc_library_shared { name: "libandroid_runtime", host_supported: true, @@ -277,7 +268,6 @@ cc_library_shared { // our headers include libnativewindow's public headers "libnativewindow", ], - generated_sources: ["android_util_StatsLogInternal.cpp"], header_libs: ["bionic_libc_platform_headers"], }, host: { diff --git a/core/jni/AndroidRuntime.cpp b/core/jni/AndroidRuntime.cpp index c41398c97ca0..ba7aef7c208e 100644 --- a/core/jni/AndroidRuntime.cpp +++ b/core/jni/AndroidRuntime.cpp @@ -108,7 +108,6 @@ namespace android { extern int register_android_app_admin_SecurityLog(JNIEnv* env); extern int register_android_content_AssetManager(JNIEnv* env); extern int register_android_util_EventLog(JNIEnv* env); -extern int register_android_util_StatsLogInternal(JNIEnv* env); extern int register_android_util_Log(JNIEnv* env); extern int register_android_util_MemoryIntArray(JNIEnv* env); extern int register_android_content_StringBlock(JNIEnv* env); @@ -1435,7 +1434,6 @@ static const RegJNIRec gRegJNI[] = { REG_JNI(register_android_util_EventLog), REG_JNI(register_android_util_Log), REG_JNI(register_android_util_MemoryIntArray), - REG_JNI(register_android_util_StatsLogInternal), REG_JNI(register_android_app_admin_SecurityLog), REG_JNI(register_android_content_AssetManager), REG_JNI(register_android_content_StringBlock), diff --git a/tools/stats_log_api_gen/Android.bp b/tools/stats_log_api_gen/Android.bp index 843e82023afe..cbf6fe88e565 100644 --- a/tools/stats_log_api_gen/Android.bp +++ b/tools/stats_log_api_gen/Android.bp @@ -26,11 +26,9 @@ cc_binary_host { "java_writer_q.cpp", "main.cpp", "native_writer.cpp", - "native_writer_q.cpp", "utils.cpp", ], cflags: [ - //"-DSTATS_SCHEMA_LEGACY", "-Wall", "-Werror", ], diff --git a/tools/stats_log_api_gen/java_writer.cpp b/tools/stats_log_api_gen/java_writer.cpp index c29936b96c14..209d511c8a05 100644 --- a/tools/stats_log_api_gen/java_writer.cpp +++ b/tools/stats_log_api_gen/java_writer.cpp @@ -59,9 +59,6 @@ static int write_java_methods( } // Print method signature. - if (DEFAULT_MODULE_NAME == moduleName) { - fprintf(out, " /** @hide */\n"); - } fprintf(out, " public static void write(int code"); vector<java_type_t> signature = signature_to_modules_it->first; int argIndex = 1; @@ -273,9 +270,6 @@ int write_stats_log_java(FILE* out, const Atoms& atoms, const AtomDecl &attribut fprintf(out, "\n"); fprintf(out, "/**\n"); fprintf(out, " * Utility class for logging statistics events.\n"); - if (DEFAULT_MODULE_NAME == moduleName) { - fprintf(out, " * @hide\n"); - } fprintf(out, " */\n"); fprintf(out, "public class %s {\n", javaClass.c_str()); diff --git a/tools/stats_log_api_gen/java_writer_q.cpp b/tools/stats_log_api_gen/java_writer_q.cpp index 12c050d8ef8d..8f2112a03e46 100644 --- a/tools/stats_log_api_gen/java_writer_q.cpp +++ b/tools/stats_log_api_gen/java_writer_q.cpp @@ -609,69 +609,5 @@ int write_stats_log_java_q_for_module(FILE* out, const Atoms& atoms, return errors; } -#if defined(STATS_SCHEMA_LEGACY) -static void write_java_method( - FILE* out, - const string& method_name, - const map<vector<java_type_t>, set<string>>& signatures_to_modules, - const AtomDecl &attributionDecl) { - - for (auto signature_to_modules_it = signatures_to_modules.begin(); - signature_to_modules_it != signatures_to_modules.end(); signature_to_modules_it++) { - vector<java_type_t> signature = signature_to_modules_it->first; - fprintf(out, " /** @hide */\n"); - fprintf(out, " public static native int %s(int code", method_name.c_str()); - int argIndex = 1; - for (vector<java_type_t>::const_iterator arg = signature.begin(); - arg != signature.end(); arg++) { - if (*arg == JAVA_TYPE_ATTRIBUTION_CHAIN) { - for (auto chainField : attributionDecl.fields) { - fprintf(out, ", %s[] %s", - java_type_name(chainField.javaType), chainField.name.c_str()); - } - } else if (*arg == JAVA_TYPE_KEY_VALUE_PAIR) { - fprintf(out, ", android.util.SparseArray<Object> valueMap"); - } else { - fprintf(out, ", %s arg%d", java_type_name(*arg), argIndex); - } - argIndex++; - } - fprintf(out, ");\n"); - fprintf(out, "\n"); - } -} - -int write_stats_log_java_q(FILE* out, const Atoms& atoms, const AtomDecl &attributionDecl, - const bool supportWorkSource) { - // Print prelude - fprintf(out, "// This file is autogenerated\n"); - fprintf(out, "\n"); - fprintf(out, "package android.util;\n"); - fprintf(out, "\n"); - fprintf(out, "\n"); - fprintf(out, "/**\n"); - fprintf(out, " * API For logging statistics events.\n"); - fprintf(out, " * @hide\n"); - fprintf(out, " */\n"); - fprintf(out, "public class StatsLogInternal {\n"); - write_java_atom_codes(out, atoms, DEFAULT_MODULE_NAME); - - write_java_enum_values(out, atoms, DEFAULT_MODULE_NAME); - - // Print write methods - fprintf(out, " // Write methods\n"); - write_java_method(out, "write", atoms.signatures_to_modules, attributionDecl); - write_java_method(out, "write_non_chained", atoms.non_chained_signatures_to_modules, - attributionDecl); - if (supportWorkSource) { - write_java_work_source_methods(out, atoms.signatures_to_modules, DEFAULT_MODULE_NAME); - } - - fprintf(out, "}\n"); - - return 0; -} -#endif - } // namespace stats_log_api_gen } // namespace android diff --git a/tools/stats_log_api_gen/java_writer_q.h b/tools/stats_log_api_gen/java_writer_q.h index 7d734df1e118..6ccb225ce973 100644 --- a/tools/stats_log_api_gen/java_writer_q.h +++ b/tools/stats_log_api_gen/java_writer_q.h @@ -49,9 +49,5 @@ int write_stats_log_java_q_for_module(FILE* out, const Atoms& atoms, const AtomDecl &attributionDecl, const string& moduleName, const string& javaClass, const string& javaPackage, const bool supportWorkSource); -#if defined(STATS_SCHEMA_LEGACY) -int write_stats_log_java_q(FILE* out, const Atoms& atoms, const AtomDecl &attributionDecl, - const bool supportWorkSource); -#endif } // namespace stats_log_api_gen } // namespace android diff --git a/tools/stats_log_api_gen/main.cpp b/tools/stats_log_api_gen/main.cpp index ddbf22c7f12a..120c2a2caada 100644 --- a/tools/stats_log_api_gen/main.cpp +++ b/tools/stats_log_api_gen/main.cpp @@ -1,10 +1,7 @@ - #include "Collation.h" #include "atoms_info_writer.h" -#if !defined(STATS_SCHEMA_LEGACY) #include "java_writer.h" -#endif #include "java_writer_q.h" #include "native_writer.h" #include "utils.h" @@ -28,463 +25,6 @@ namespace stats_log_api_gen { using android::os::statsd::Atom; -// Hide the JNI write helpers that are not used in the new schema. -// TODO(b/145100015): Remove this and other JNI related functionality once StatsEvent migration is -// complete. -#if defined(STATS_SCHEMA_LEGACY) -// JNI helpers. -static const char* -jni_type_name(java_type_t type) -{ - switch (type) { - case JAVA_TYPE_BOOLEAN: - return "jboolean"; - case JAVA_TYPE_INT: - case JAVA_TYPE_ENUM: - return "jint"; - case JAVA_TYPE_LONG: - return "jlong"; - case JAVA_TYPE_FLOAT: - return "jfloat"; - case JAVA_TYPE_DOUBLE: - return "jdouble"; - case JAVA_TYPE_STRING: - return "jstring"; - case JAVA_TYPE_BYTE_ARRAY: - return "jbyteArray"; - default: - return "UNKNOWN"; - } -} - -static const char* -jni_array_type_name(java_type_t type) -{ - switch (type) { - case JAVA_TYPE_INT: - return "jintArray"; - case JAVA_TYPE_FLOAT: - return "jfloatArray"; - case JAVA_TYPE_STRING: - return "jobjectArray"; - default: - return "UNKNOWN"; - } -} - -static string -jni_function_name(const string& method_name, const vector<java_type_t>& signature) -{ - string result("StatsLog_" + method_name); - for (vector<java_type_t>::const_iterator arg = signature.begin(); - arg != signature.end(); arg++) { - switch (*arg) { - case JAVA_TYPE_BOOLEAN: - result += "_boolean"; - break; - case JAVA_TYPE_INT: - case JAVA_TYPE_ENUM: - result += "_int"; - break; - case JAVA_TYPE_LONG: - result += "_long"; - break; - case JAVA_TYPE_FLOAT: - result += "_float"; - break; - case JAVA_TYPE_DOUBLE: - result += "_double"; - break; - case JAVA_TYPE_STRING: - result += "_String"; - break; - case JAVA_TYPE_ATTRIBUTION_CHAIN: - result += "_AttributionChain"; - break; - case JAVA_TYPE_KEY_VALUE_PAIR: - result += "_KeyValuePairs"; - break; - case JAVA_TYPE_BYTE_ARRAY: - result += "_bytes"; - break; - default: - result += "_UNKNOWN"; - break; - } - } - return result; -} - -static const char* -java_type_signature(java_type_t type) -{ - switch (type) { - case JAVA_TYPE_BOOLEAN: - return "Z"; - case JAVA_TYPE_INT: - case JAVA_TYPE_ENUM: - return "I"; - case JAVA_TYPE_LONG: - return "J"; - case JAVA_TYPE_FLOAT: - return "F"; - case JAVA_TYPE_DOUBLE: - return "D"; - case JAVA_TYPE_STRING: - return "Ljava/lang/String;"; - case JAVA_TYPE_BYTE_ARRAY: - return "[B"; - default: - return "UNKNOWN"; - } -} - -static string -jni_function_signature(const vector<java_type_t>& signature, const AtomDecl &attributionDecl) -{ - string result("(I"); - for (vector<java_type_t>::const_iterator arg = signature.begin(); - arg != signature.end(); arg++) { - if (*arg == JAVA_TYPE_ATTRIBUTION_CHAIN) { - for (auto chainField : attributionDecl.fields) { - result += "["; - result += java_type_signature(chainField.javaType); - } - } else if (*arg == JAVA_TYPE_KEY_VALUE_PAIR) { - result += "Landroid/util/SparseArray;"; - } else { - result += java_type_signature(*arg); - } - } - result += ")I"; - return result; -} - -static void write_key_value_map_jni(FILE* out) { - fprintf(out, " std::map<int, int32_t> int32_t_map;\n"); - fprintf(out, " std::map<int, int64_t> int64_t_map;\n"); - fprintf(out, " std::map<int, float> float_map;\n"); - fprintf(out, " std::map<int, char const*> string_map;\n\n"); - - fprintf(out, " jclass jmap_class = env->FindClass(\"android/util/SparseArray\");\n"); - - fprintf(out, " jmethodID jget_size_method = env->GetMethodID(jmap_class, \"size\", \"()I\");\n"); - fprintf(out, " jmethodID jget_key_method = env->GetMethodID(jmap_class, \"keyAt\", \"(I)I\");\n"); - fprintf(out, " jmethodID jget_value_method = env->GetMethodID(jmap_class, \"valueAt\", \"(I)Ljava/lang/Object;\");\n\n"); - - - fprintf(out, " std::vector<std::unique_ptr<ScopedUtfChars>> scoped_ufs;\n\n"); - - fprintf(out, " jclass jint_class = env->FindClass(\"java/lang/Integer\");\n"); - fprintf(out, " jclass jlong_class = env->FindClass(\"java/lang/Long\");\n"); - fprintf(out, " jclass jfloat_class = env->FindClass(\"java/lang/Float\");\n"); - fprintf(out, " jclass jstring_class = env->FindClass(\"java/lang/String\");\n"); - fprintf(out, " jmethodID jget_int_method = env->GetMethodID(jint_class, \"intValue\", \"()I\");\n"); - fprintf(out, " jmethodID jget_long_method = env->GetMethodID(jlong_class, \"longValue\", \"()J\");\n"); - fprintf(out, " jmethodID jget_float_method = env->GetMethodID(jfloat_class, \"floatValue\", \"()F\");\n\n"); - - fprintf(out, " jint jsize = env->CallIntMethod(value_map, jget_size_method);\n"); - fprintf(out, " for(int i = 0; i < jsize; i++) {\n"); - fprintf(out, " jint key = env->CallIntMethod(value_map, jget_key_method, i);\n"); - fprintf(out, " jobject jvalue_obj = env->CallObjectMethod(value_map, jget_value_method, i);\n"); - fprintf(out, " if (jvalue_obj == NULL) { continue; }\n"); - fprintf(out, " if (env->IsInstanceOf(jvalue_obj, jint_class)) {\n"); - fprintf(out, " int32_t_map[key] = env->CallIntMethod(jvalue_obj, jget_int_method);\n"); - fprintf(out, " } else if (env->IsInstanceOf(jvalue_obj, jlong_class)) {\n"); - fprintf(out, " int64_t_map[key] = env->CallLongMethod(jvalue_obj, jget_long_method);\n"); - fprintf(out, " } else if (env->IsInstanceOf(jvalue_obj, jfloat_class)) {\n"); - fprintf(out, " float_map[key] = env->CallFloatMethod(jvalue_obj, jget_float_method);\n"); - fprintf(out, " } else if (env->IsInstanceOf(jvalue_obj, jstring_class)) {\n"); - fprintf(out, " std::unique_ptr<ScopedUtfChars> utf(new ScopedUtfChars(env, (jstring)jvalue_obj));\n"); - fprintf(out, " if (utf->c_str() != NULL) { string_map[key] = utf->c_str(); }\n"); - fprintf(out, " scoped_ufs.push_back(std::move(utf));\n"); - fprintf(out, " }\n"); - fprintf(out, " }\n"); -} - -static int -write_stats_log_jni_method(FILE* out, const string& java_method_name, const string& cpp_method_name, - const map<vector<java_type_t>, set<string>>& signatures_to_modules, - const AtomDecl &attributionDecl) { - // Print write methods - for (auto signature_to_modules_it = signatures_to_modules.begin(); - signature_to_modules_it != signatures_to_modules.end(); signature_to_modules_it++) { - vector<java_type_t> signature = signature_to_modules_it->first; - int argIndex; - - fprintf(out, "static int\n"); - fprintf(out, "%s(JNIEnv* env, jobject clazz UNUSED, jint code", - jni_function_name(java_method_name, signature).c_str()); - argIndex = 1; - for (vector<java_type_t>::const_iterator arg = signature.begin(); - arg != signature.end(); arg++) { - if (*arg == JAVA_TYPE_ATTRIBUTION_CHAIN) { - for (auto chainField : attributionDecl.fields) { - fprintf(out, ", %s %s", jni_array_type_name(chainField.javaType), - chainField.name.c_str()); - } - } else if (*arg == JAVA_TYPE_KEY_VALUE_PAIR) { - fprintf(out, ", jobject value_map"); - } else { - fprintf(out, ", %s arg%d", jni_type_name(*arg), argIndex); - } - argIndex++; - } - fprintf(out, ")\n"); - - fprintf(out, "{\n"); - - // Prepare strings - argIndex = 1; - bool hadStringOrChain = false; - bool isKeyValuePairAtom = false; - for (vector<java_type_t>::const_iterator arg = signature.begin(); - arg != signature.end(); arg++) { - if (*arg == JAVA_TYPE_STRING) { - hadStringOrChain = true; - fprintf(out, " const char* str%d;\n", argIndex); - fprintf(out, " if (arg%d != NULL) {\n", argIndex); - fprintf(out, " str%d = env->GetStringUTFChars(arg%d, NULL);\n", - argIndex, argIndex); - fprintf(out, " } else {\n"); - fprintf(out, " str%d = NULL;\n", argIndex); - fprintf(out, " }\n"); - } else if (*arg == JAVA_TYPE_BYTE_ARRAY) { - hadStringOrChain = true; - fprintf(out, " jbyte* jbyte_array%d;\n", argIndex); - fprintf(out, " const char* str%d;\n", argIndex); - fprintf(out, " int str%d_length = 0;\n", argIndex); - fprintf(out, - " if (arg%d != NULL && env->GetArrayLength(arg%d) > " - "0) {\n", - argIndex, argIndex); - fprintf(out, - " jbyte_array%d = " - "env->GetByteArrayElements(arg%d, NULL);\n", - argIndex, argIndex); - fprintf(out, - " str%d_length = env->GetArrayLength(arg%d);\n", - argIndex, argIndex); - fprintf(out, - " str%d = " - "reinterpret_cast<char*>(env->GetByteArrayElements(arg%" - "d, NULL));\n", - argIndex, argIndex); - fprintf(out, " } else {\n"); - fprintf(out, " jbyte_array%d = NULL;\n", argIndex); - fprintf(out, " str%d = NULL;\n", argIndex); - fprintf(out, " }\n"); - - fprintf(out, - " android::util::BytesField bytesField%d(str%d, " - "str%d_length);", - argIndex, argIndex, argIndex); - - } else if (*arg == JAVA_TYPE_ATTRIBUTION_CHAIN) { - hadStringOrChain = true; - for (auto chainField : attributionDecl.fields) { - fprintf(out, " size_t %s_length = env->GetArrayLength(%s);\n", - chainField.name.c_str(), chainField.name.c_str()); - if (chainField.name != attributionDecl.fields.front().name) { - fprintf(out, " if (%s_length != %s_length) {\n", - chainField.name.c_str(), - attributionDecl.fields.front().name.c_str()); - fprintf(out, " return -EINVAL;\n"); - fprintf(out, " }\n"); - } - if (chainField.javaType == JAVA_TYPE_INT) { - fprintf(out, " jint* %s_array = env->GetIntArrayElements(%s, NULL);\n", - chainField.name.c_str(), chainField.name.c_str()); - } else if (chainField.javaType == JAVA_TYPE_STRING) { - fprintf(out, " std::vector<%s> %s_vec;\n", - cpp_type_name(chainField.javaType), chainField.name.c_str()); - fprintf(out, " std::vector<ScopedUtfChars*> scoped_%s_vec;\n", - chainField.name.c_str()); - fprintf(out, " for (size_t i = 0; i < %s_length; ++i) {\n", - chainField.name.c_str()); - fprintf(out, " jstring jstr = " - "(jstring)env->GetObjectArrayElement(%s, i);\n", - chainField.name.c_str()); - fprintf(out, " if (jstr == NULL) {\n"); - fprintf(out, " %s_vec.push_back(NULL);\n", - chainField.name.c_str()); - fprintf(out, " } else {\n"); - fprintf(out, " ScopedUtfChars* scoped_%s = " - "new ScopedUtfChars(env, jstr);\n", - chainField.name.c_str()); - fprintf(out, " %s_vec.push_back(scoped_%s->c_str());\n", - chainField.name.c_str(), chainField.name.c_str()); - fprintf(out, " scoped_%s_vec.push_back(scoped_%s);\n", - chainField.name.c_str(), chainField.name.c_str()); - fprintf(out, " }\n"); - fprintf(out, " }\n"); - } - fprintf(out, "\n"); - } - } else if (*arg == JAVA_TYPE_KEY_VALUE_PAIR) { - isKeyValuePairAtom = true; - } - argIndex++; - } - // Emit this to quiet the unused parameter warning if there were no strings or attribution - // chains. - if (!hadStringOrChain && !isKeyValuePairAtom) { - fprintf(out, " (void)env;\n"); - } - if (isKeyValuePairAtom) { - write_key_value_map_jni(out); - } - - // stats_write call - argIndex = 1; - fprintf(out, "\n int ret = android::util::%s(code", - cpp_method_name.c_str()); - for (vector<java_type_t>::const_iterator arg = signature.begin(); - arg != signature.end(); arg++) { - if (*arg == JAVA_TYPE_ATTRIBUTION_CHAIN) { - for (auto chainField : attributionDecl.fields) { - if (chainField.javaType == JAVA_TYPE_INT) { - fprintf(out, ", (const %s*)%s_array, %s_length", - cpp_type_name(chainField.javaType), - chainField.name.c_str(), chainField.name.c_str()); - } else if (chainField.javaType == JAVA_TYPE_STRING) { - fprintf(out, ", %s_vec", chainField.name.c_str()); - } - } - } else if (*arg == JAVA_TYPE_KEY_VALUE_PAIR) { - fprintf(out, ", int32_t_map, int64_t_map, string_map, float_map"); - } else if (*arg == JAVA_TYPE_BYTE_ARRAY) { - fprintf(out, ", bytesField%d", argIndex); - } else { - const char* argName = - (*arg == JAVA_TYPE_STRING) ? "str" : "arg"; - fprintf(out, ", (%s)%s%d", cpp_type_name(*arg), argName, argIndex); - } - argIndex++; - } - fprintf(out, ");\n"); - fprintf(out, "\n"); - - // Clean up strings - argIndex = 1; - for (vector<java_type_t>::const_iterator arg = signature.begin(); - arg != signature.end(); arg++) { - if (*arg == JAVA_TYPE_STRING) { - fprintf(out, " if (str%d != NULL) {\n", argIndex); - fprintf(out, " env->ReleaseStringUTFChars(arg%d, str%d);\n", - argIndex, argIndex); - fprintf(out, " }\n"); - } else if (*arg == JAVA_TYPE_BYTE_ARRAY) { - fprintf(out, " if (str%d != NULL) { \n", argIndex); - fprintf(out, - " env->ReleaseByteArrayElements(arg%d, " - "jbyte_array%d, 0);\n", - argIndex, argIndex); - fprintf(out, " }\n"); - } else if (*arg == JAVA_TYPE_ATTRIBUTION_CHAIN) { - for (auto chainField : attributionDecl.fields) { - if (chainField.javaType == JAVA_TYPE_INT) { - fprintf(out, " env->ReleaseIntArrayElements(%s, %s_array, 0);\n", - chainField.name.c_str(), chainField.name.c_str()); - } else if (chainField.javaType == JAVA_TYPE_STRING) { - fprintf(out, " for (size_t i = 0; i < scoped_%s_vec.size(); ++i) {\n", - chainField.name.c_str()); - fprintf(out, " delete scoped_%s_vec[i];\n", chainField.name.c_str()); - fprintf(out, " }\n"); - } - } - } - argIndex++; - } - - fprintf(out, " return ret;\n"); - - fprintf(out, "}\n"); - fprintf(out, "\n"); - } - - - return 0; -} - -void write_jni_registration(FILE* out, const string& java_method_name, - const map<vector<java_type_t>, set<string>>& signatures_to_modules, - const AtomDecl &attributionDecl) { - for (auto signature_to_modules_it = signatures_to_modules.begin(); - signature_to_modules_it != signatures_to_modules.end(); signature_to_modules_it++) { - vector<java_type_t> signature = signature_to_modules_it->first; - fprintf(out, " { \"%s\", \"%s\", (void*)%s },\n", - java_method_name.c_str(), - jni_function_signature(signature, attributionDecl).c_str(), - jni_function_name(java_method_name, signature).c_str()); - } -} -#endif // JNI helpers. - -static int -#if defined(STATS_SCHEMA_LEGACY) -write_stats_log_jni(FILE* out, const Atoms& atoms, const AtomDecl &attributionDecl) -#else -// Write empty JNI file that doesn't contain any JNI methods. -// TODO(b/145100015): remove this function and all JNI autogen code once StatsEvent migration is -// complete. -write_stats_log_jni(FILE* out) -#endif -{ - // Print prelude - fprintf(out, "// This file is autogenerated\n"); - fprintf(out, "\n"); - -#if defined(STATS_SCHEMA_LEGACY) - fprintf(out, "#include <statslog.h>\n"); - fprintf(out, "\n"); - fprintf(out, "#include <nativehelper/JNIHelp.h>\n"); - fprintf(out, "#include <nativehelper/ScopedUtfChars.h>\n"); - fprintf(out, "#include <utils/Vector.h>\n"); -#endif - fprintf(out, "#include \"core_jni_helpers.h\"\n"); - fprintf(out, "#include \"jni.h\"\n"); - fprintf(out, "\n"); -#if defined(STATS_SCHEMA_LEGACY) - fprintf(out, "#define UNUSED __attribute__((__unused__))\n"); - fprintf(out, "\n"); -#endif - - fprintf(out, "namespace android {\n"); - fprintf(out, "\n"); - -#if defined(STATS_SCHEMA_LEGACY) - write_stats_log_jni_method(out, "write", "stats_write", atoms.signatures_to_modules, attributionDecl); - write_stats_log_jni_method(out, "write_non_chained", "stats_write_non_chained", - atoms.non_chained_signatures_to_modules, attributionDecl); -#endif - - // Print registration function table - fprintf(out, "/*\n"); - fprintf(out, " * JNI registration.\n"); - fprintf(out, " */\n"); - fprintf(out, "static const JNINativeMethod gRegisterMethods[] = {\n"); -#if defined(STATS_SCHEMA_LEGACY) - write_jni_registration(out, "write", atoms.signatures_to_modules, attributionDecl); - write_jni_registration(out, "write_non_chained", atoms.non_chained_signatures_to_modules, - attributionDecl); -#endif - fprintf(out, "};\n"); - fprintf(out, "\n"); - - // Print registration function - fprintf(out, "int register_android_util_StatsLogInternal(JNIEnv* env) {\n"); - fprintf(out, " return RegisterMethodsOrDie(\n"); - fprintf(out, " env,\n"); - fprintf(out, " \"android/util/StatsLogInternal\",\n"); - fprintf(out, " gRegisterMethods, NELEM(gRegisterMethods));\n"); - fprintf(out, "}\n"); - - fprintf(out, "\n"); - fprintf(out, "} // namespace android\n"); - return 0; -} - static void print_usage() { @@ -498,7 +38,6 @@ print_usage() fprintf(stderr, " --atomsInfoHeader FILENAME the cpp file to output for statsd metadata\n"); fprintf(stderr, " --help this message\n"); fprintf(stderr, " --java FILENAME the java file to output\n"); - fprintf(stderr, " --jni FILENAME the jni file to output\n"); fprintf(stderr, " --module NAME optional, module name to generate outputs for\n"); fprintf(stderr, " --namespace COMMA,SEP,NAMESPACE required for cpp/header with module\n"); fprintf(stderr, " comma separated namespace of the files\n"); @@ -526,16 +65,15 @@ run(int argc, char const*const* argv) string cppFilename; string headerFilename; string javaFilename; - string jniFilename; string atomsInfoCppFilename; string atomsInfoHeaderFilename; + string javaPackage; + string javaClass; string moduleName = DEFAULT_MODULE_NAME; string cppNamespace = DEFAULT_CPP_NAMESPACE; string cppHeaderImport = DEFAULT_CPP_HEADER_IMPORT; string atomsInfoCppHeaderImport = DEFAULT_ATOMS_INFO_CPP_HEADER_IMPORT; - string javaPackage = DEFAULT_JAVA_PACKAGE; - string javaClass = DEFAULT_JAVA_CLASS; bool supportQ = false; bool supportWorkSource = false; bool compileQ = false; @@ -566,13 +104,6 @@ run(int argc, char const*const* argv) return 1; } javaFilename = argv[index]; - } else if (0 == strcmp("--jni", argv[index])) { - index++; - if (index >= argc) { - print_usage(); - return 1; - } - jniFilename = argv[index]; } else if (0 == strcmp("--module", argv[index])) { index++; if (index >= argc) { @@ -643,7 +174,6 @@ run(int argc, char const*const* argv) if (cppFilename.size() == 0 && headerFilename.size() == 0 && javaFilename.size() == 0 - && jniFilename.size() == 0 && atomsInfoHeaderFilename.size() == 0 && atomsInfoCppFilename.size() == 0) { print_usage(); @@ -738,27 +268,27 @@ run(int argc, char const*const* argv) // Write the .java file if (javaFilename.size() != 0) { - FILE* out = fopen(javaFilename.c_str(), "w"); - if (out == NULL) { - fprintf(stderr, "Unable to open file for write: %s\n", javaFilename.c_str()); + if (javaClass.size() == 0) { + fprintf(stderr, "Must supply --javaClass if supplying a Java filename"); return 1; } -#if defined(STATS_SCHEMA_LEGACY) - if (moduleName == DEFAULT_MODULE_NAME) { - errorCount = android::stats_log_api_gen::write_stats_log_java_q( - out, atoms, attributionDecl, supportWorkSource); - } else { - errorCount = android::stats_log_api_gen::write_stats_log_java_q_for_module( - out, atoms, attributionDecl, moduleName, javaClass, javaPackage, - supportWorkSource); + if (javaPackage.size() == 0) { + fprintf(stderr, "Must supply --javaPackage if supplying a Java filename"); + return 1; + } + if (moduleName.size() == 0) { + fprintf(stderr, "Must supply --module if supplying a Java filename"); + return 1; } -#else - if (moduleName == DEFAULT_MODULE_NAME) { - javaClass = "StatsLogInternal"; - javaPackage = "android.util"; + + FILE* out = fopen(javaFilename.c_str(), "w"); + if (out == NULL) { + fprintf(stderr, "Unable to open file for write: %s\n", javaFilename.c_str()); + return 1; } + if (compileQ) { errorCount = android::stats_log_api_gen::write_stats_log_java_q_for_module( out, atoms, attributionDecl, moduleName, javaClass, javaPackage, @@ -768,25 +298,6 @@ run(int argc, char const*const* argv) out, atoms, attributionDecl, moduleName, javaClass, javaPackage, supportQ, supportWorkSource); } -#endif - - fclose(out); - } - - // Write the jni file - if (jniFilename.size() != 0) { - FILE* out = fopen(jniFilename.c_str(), "w"); - if (out == NULL) { - fprintf(stderr, "Unable to open file for write: %s\n", jniFilename.c_str()); - return 1; - } - -#if defined(STATS_SCHEMA_LEGACY) - errorCount = android::stats_log_api_gen::write_stats_log_jni( - out, atoms, attributionDecl); -#else - errorCount = android::stats_log_api_gen::write_stats_log_jni(out); -#endif fclose(out); } diff --git a/tools/stats_log_api_gen/native_writer.cpp b/tools/stats_log_api_gen/native_writer.cpp index 285514df5ff3..da207d665e20 100644 --- a/tools/stats_log_api_gen/native_writer.cpp +++ b/tools/stats_log_api_gen/native_writer.cpp @@ -15,14 +15,11 @@ */ #include "native_writer.h" -#include "native_writer_q.h" #include "utils.h" namespace android { namespace stats_log_api_gen { -#if !defined(STATS_SCHEMA_LEGACY) - static int write_native_stats_write_methods(FILE* out, const Atoms& atoms, const AtomDecl& attributionDecl, const string& moduleName, const bool supportQ) { fprintf(out, "\n"); @@ -175,7 +172,6 @@ static void write_native_stats_write_non_chained_methods(FILE* out, const Atoms& } } -#endif static void write_native_method_header( FILE* out, @@ -191,12 +187,10 @@ static void write_native_method_header( } vector<java_type_t> signature = signature_to_modules_it->first; -#if !defined(STATS_SCHEMA_LEGACY) // Key value pairs not supported in native. if (find(signature.begin(), signature.end(), JAVA_TYPE_KEY_VALUE_PAIR) != signature.end()) { continue; } -#endif write_native_method_signature(out, methodName, signature, attributionDecl, ";"); } } @@ -209,33 +203,17 @@ int write_stats_log_cpp(FILE *out, const Atoms &atoms, const AtomDecl &attributi fprintf(out, "\n"); fprintf(out, "#include <%s>\n", importHeader.c_str()); -#if defined(STATS_SCHEMA_LEGACY) - (void)supportQ; // Workaround for unused parameter error. - write_native_cpp_includes_q(out); -#else if (supportQ) { fprintf(out, "#include <StatsEventCompat.h>\n"); } else { fprintf(out, "#include <stats_event.h>\n"); } -#endif fprintf(out, "\n"); write_namespace(out, cppNamespace); -#if defined(STATS_SCHEMA_LEGACY) - write_native_stats_log_cpp_globals_q(out); - write_native_get_timestamp_ns_q(out); - write_native_try_stats_write_methods_q(out, atoms, attributionDecl, moduleName); - write_native_stats_write_methods_q(out, "int stats_write", atoms, attributionDecl, moduleName, - "try_stats_write"); - write_native_try_stats_write_non_chained_methods_q(out, atoms, attributionDecl, moduleName); - write_native_stats_write_non_chained_methods_q(out, "int stats_write_non_chained", atoms, - attributionDecl, moduleName, "try_stats_write_non_chained"); -#else write_native_stats_write_methods(out, atoms, attributionDecl, moduleName, supportQ); write_native_stats_write_non_chained_methods(out, atoms, attributionDecl, moduleName); -#endif // Print footer fprintf(out, "\n"); diff --git a/tools/stats_log_api_gen/native_writer_q.cpp b/tools/stats_log_api_gen/native_writer_q.cpp deleted file mode 100644 index 299873dad975..000000000000 --- a/tools/stats_log_api_gen/native_writer_q.cpp +++ /dev/null @@ -1,276 +0,0 @@ -/* - * Copyright (C) 2019, The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "native_writer_q.h" -#include "utils.h" - -namespace android { -namespace stats_log_api_gen { - -static void write_native_stats_write_body_q(FILE* out, const vector<java_type_t>& signature, - const AtomDecl& attributionDecl, const string& indent, const string& tryMethodName) { - fprintf(out, "%sint ret = 0;\n", indent.c_str()); - - fprintf(out, "%sfor(int retry = 0; retry < 2; ++retry) {\n", indent.c_str()); - fprintf(out, "%s ret = ", indent.c_str()); - write_native_method_call(out, tryMethodName, signature, attributionDecl); - fprintf(out, "%s if (ret >= 0) { break; }\n", indent.c_str()); - - fprintf(out, "%s {\n", indent.c_str()); - fprintf(out, "%s std::lock_guard<std::mutex> lock(mLogdRetryMutex);\n", indent.c_str()); - fprintf(out, "%s if ((get_elapsed_realtime_ns() - lastRetryTimestampNs) <= " - "kMinRetryIntervalNs) break;\n", indent.c_str()); - fprintf(out, "%s lastRetryTimestampNs = get_elapsed_realtime_ns();\n", - indent.c_str()); - fprintf(out, "%s }\n", indent.c_str()); - fprintf(out, "%s std::this_thread::sleep_for(std::chrono::milliseconds(10));\n", - indent.c_str()); - fprintf(out, "%s}\n", indent.c_str()); - fprintf(out, "%sif (ret < 0) {\n", indent.c_str()); - fprintf(out, "%s note_log_drop(ret, code);\n", indent.c_str()); - fprintf(out, "%s}\n", indent.c_str()); - fprintf(out, "%sreturn ret;\n", indent.c_str()); -} - -void write_native_cpp_includes_q(FILE* out) { - fprintf(out, "#include <mutex>\n"); - fprintf(out, "#include <chrono>\n"); - fprintf(out, "#include <thread>\n"); - fprintf(out, "#ifdef __ANDROID__\n"); - fprintf(out, "#include <cutils/properties.h>\n"); - fprintf(out, "#endif\n"); - fprintf(out, "#include <stats_event_list.h>\n"); - fprintf(out, "#include <log/log.h>\n"); - fprintf(out, "#include <time.h>\n"); -} - -void write_native_get_timestamp_ns_q(FILE* out) { - fprintf(out, "\n"); - fprintf(out, "static int64_t get_elapsed_realtime_ns() {\n"); - fprintf(out, " struct timespec t;\n"); - fprintf(out, " t.tv_sec = t.tv_nsec = 0;\n"); - fprintf(out, " clock_gettime(CLOCK_BOOTTIME, &t);\n"); - fprintf(out, " return (int64_t)t.tv_sec * 1000000000LL + t.tv_nsec;\n"); - fprintf(out, "}\n"); -} - -void write_native_stats_log_cpp_globals_q(FILE* out) { - fprintf(out, "// the single event tag id for all stats logs\n"); - fprintf(out, "const static int kStatsEventTag = 1937006964;\n"); - fprintf(out, "#ifdef __ANDROID__\n"); - fprintf(out, - "const static bool kStatsdEnabled = property_get_bool(\"ro.statsd.enable\", true);\n"); - fprintf(out, "#else\n"); - fprintf(out, "const static bool kStatsdEnabled = false;\n"); - fprintf(out, "#endif\n"); - - fprintf(out, "int64_t lastRetryTimestampNs = -1;\n"); - fprintf(out, "const int64_t kMinRetryIntervalNs = NS_PER_SEC * 60 * 20; // 20 minutes\n"); - fprintf(out, "static std::mutex mLogdRetryMutex;\n"); -} - -void write_native_try_stats_write_methods_q(FILE* out, const Atoms& atoms, - const AtomDecl& attributionDecl, const string& moduleName) { - fprintf(out, "\n"); - for (auto signature_to_modules_it = atoms.signatures_to_modules.begin(); - signature_to_modules_it != atoms.signatures_to_modules.end(); signature_to_modules_it++) { - if (!signature_needed_for_module(signature_to_modules_it->second, moduleName)) { - continue; - } - vector<java_type_t> signature = signature_to_modules_it->first; - - write_native_method_signature(out, "static int try_stats_write", signature, - attributionDecl, " {"); - - int argIndex = 1; - fprintf(out, " if (kStatsdEnabled) {\n"); - fprintf(out, " stats_event_list event(kStatsEventTag);\n"); - fprintf(out, " event << get_elapsed_realtime_ns();\n\n"); - fprintf(out, " event << code;\n\n"); - for (vector<java_type_t>::const_iterator arg = signature.begin(); - arg != signature.end(); arg++) { - if (*arg == JAVA_TYPE_ATTRIBUTION_CHAIN) { - for (const auto &chainField : attributionDecl.fields) { - if (chainField.javaType == JAVA_TYPE_STRING) { - fprintf(out, " if (%s_length != %s.size()) {\n", - attributionDecl.fields.front().name.c_str(), chainField.name.c_str()); - fprintf(out, " return -EINVAL;\n"); - fprintf(out, " }\n"); - } - } - fprintf(out, "\n event.begin();\n"); - fprintf(out, " for (size_t i = 0; i < %s_length; ++i) {\n", - attributionDecl.fields.front().name.c_str()); - fprintf(out, " event.begin();\n"); - for (const auto &chainField : attributionDecl.fields) { - if (chainField.javaType == JAVA_TYPE_STRING) { - fprintf(out, " if (%s[i] != NULL) {\n", chainField.name.c_str()); - fprintf(out, " event << %s[i];\n", chainField.name.c_str()); - fprintf(out, " } else {\n"); - fprintf(out, " event << \"\";\n"); - fprintf(out, " }\n"); - } else { - fprintf(out, " event << %s[i];\n", chainField.name.c_str()); - } - } - fprintf(out, " event.end();\n"); - fprintf(out, " }\n"); - fprintf(out, " event.end();\n\n"); - } else if (*arg == JAVA_TYPE_KEY_VALUE_PAIR) { - fprintf(out, " event.begin();\n\n"); - fprintf(out, " for (const auto& it : arg%d_1) {\n", argIndex); - fprintf(out, " event.begin();\n"); - fprintf(out, " event << it.first;\n"); - fprintf(out, " event << it.second;\n"); - fprintf(out, " event.end();\n"); - fprintf(out, " }\n"); - - fprintf(out, " for (const auto& it : arg%d_2) {\n", argIndex); - fprintf(out, " event.begin();\n"); - fprintf(out, " event << it.first;\n"); - fprintf(out, " event << it.second;\n"); - fprintf(out, " event.end();\n"); - fprintf(out, " }\n"); - - fprintf(out, " for (const auto& it : arg%d_3) {\n", argIndex); - fprintf(out, " event.begin();\n"); - fprintf(out, " event << it.first;\n"); - fprintf(out, " event << it.second;\n"); - fprintf(out, " event.end();\n"); - fprintf(out, " }\n"); - - fprintf(out, " for (const auto& it : arg%d_4) {\n", argIndex); - fprintf(out, " event.begin();\n"); - fprintf(out, " event << it.first;\n"); - fprintf(out, " event << it.second;\n"); - fprintf(out, " event.end();\n"); - fprintf(out, " }\n"); - - fprintf(out, " event.end();\n\n"); - } else if (*arg == JAVA_TYPE_BYTE_ARRAY) { - fprintf(out, - " event.AppendCharArray(arg%d.arg, " - "arg%d.arg_length);\n", - argIndex, argIndex); - } else { - if (*arg == JAVA_TYPE_STRING) { - fprintf(out, " if (arg%d == NULL) {\n", argIndex); - fprintf(out, " arg%d = \"\";\n", argIndex); - fprintf(out, " }\n"); - } - fprintf(out, " event << arg%d;\n", argIndex); - } - argIndex++; - } - - fprintf(out, " return event.write(LOG_ID_STATS);\n"); - fprintf(out, " } else {\n"); - fprintf(out, " return 1;\n"); - fprintf(out, " }\n"); - fprintf(out, "}\n"); - fprintf(out, "\n"); - } - -} - -void write_native_stats_write_methods_q(FILE* out, const string& methodName, const Atoms& atoms, - const AtomDecl& attributionDecl, const string& moduleName, const string& tryMethodName) { - for (auto signature_to_modules_it = atoms.signatures_to_modules.begin(); - signature_to_modules_it != atoms.signatures_to_modules.end(); - signature_to_modules_it++) { - if (!signature_needed_for_module(signature_to_modules_it->second, moduleName)) { - continue; - } - vector<java_type_t> signature = signature_to_modules_it->first; - - write_native_method_signature(out, methodName, signature, attributionDecl, " {"); - - write_native_stats_write_body_q(out, signature, attributionDecl, " ", tryMethodName); - fprintf(out, "}\n\n"); - } -} - -void write_native_stats_write_non_chained_methods_q(FILE* out, const string& methodName, - const Atoms& atoms, const AtomDecl& attributionDecl, const string& moduleName, - const string& tryMethodName) { - for (auto signature_it = atoms.non_chained_signatures_to_modules.begin(); - signature_it != atoms.non_chained_signatures_to_modules.end(); signature_it++) { - if (!signature_needed_for_module(signature_it->second, moduleName)) { - continue; - } - vector<java_type_t> signature = signature_it->first; - - write_native_method_signature(out, methodName, signature, attributionDecl, " {"); - - write_native_stats_write_body_q(out, signature, attributionDecl, " ", tryMethodName); - fprintf(out, "}\n\n"); - } -} - -void write_native_try_stats_write_non_chained_methods_q(FILE* out, const Atoms& atoms, - const AtomDecl& attributionDecl, const string& moduleName) { - for (auto signature_it = atoms.non_chained_signatures_to_modules.begin(); - signature_it != atoms.non_chained_signatures_to_modules.end(); signature_it++) { - if (!signature_needed_for_module(signature_it->second, moduleName)) { - continue; - } - vector<java_type_t> signature = signature_it->first; - - write_native_method_signature(out, "static int try_stats_write_non_chained", signature, - attributionDecl, " {"); - - int argIndex = 1; - fprintf(out, " if (kStatsdEnabled) {\n"); - fprintf(out, " stats_event_list event(kStatsEventTag);\n"); - fprintf(out, " event << get_elapsed_realtime_ns();\n\n"); - fprintf(out, " event << code;\n\n"); - for (vector<java_type_t>::const_iterator arg = signature.begin(); - arg != signature.end(); arg++) { - if (argIndex == 1) { - fprintf(out, " event.begin();\n\n"); - fprintf(out, " event.begin();\n"); - } - if (*arg == JAVA_TYPE_STRING) { - fprintf(out, " if (arg%d == NULL) {\n", argIndex); - fprintf(out, " arg%d = \"\";\n", argIndex); - fprintf(out, " }\n"); - } - if (*arg == JAVA_TYPE_BYTE_ARRAY) { - fprintf(out, - " event.AppendCharArray(arg%d.arg, " - "arg%d.arg_length);\n", - argIndex, argIndex); - } else { - fprintf(out, " event << arg%d;\n", argIndex); - } - if (argIndex == 2) { - fprintf(out, " event.end();\n\n"); - fprintf(out, " event.end();\n\n"); - } - argIndex++; - } - - fprintf(out, " return event.write(LOG_ID_STATS);\n"); - fprintf(out, " } else {\n"); - fprintf(out, " return 1;\n"); - fprintf(out, " }\n"); - fprintf(out, "}\n"); - fprintf(out, "\n"); - } -} - -} // namespace stats_log_api_gen -} // namespace android diff --git a/tools/stats_log_api_gen/native_writer_q.h b/tools/stats_log_api_gen/native_writer_q.h deleted file mode 100644 index a2ab1ae5d5e2..000000000000 --- a/tools/stats_log_api_gen/native_writer_q.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (C) 2019, The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include "Collation.h" - -#include <stdio.h> -#include <string.h> - -namespace android { -namespace stats_log_api_gen { - -using namespace std; - -void write_native_cpp_includes_q(FILE* out); - -void write_native_stats_log_cpp_globals_q(FILE* out); - -void write_native_try_stats_write_methods_q(FILE* out, const Atoms& atoms, - const AtomDecl& attributionDecl, const string& moduleName); - -void write_native_stats_write_methods_q(FILE* out, const string& methodName, const Atoms& atoms, - const AtomDecl& attributionDecl, const string& moduleName, const string& tryMethodName); - -void write_native_try_stats_write_non_chained_methods_q(FILE* out, const Atoms& atoms, - const AtomDecl& attributionDecl, const string& moduleName); - -void write_native_stats_write_non_chained_methods_q(FILE* out, const string& methodName, - const Atoms& atoms, const AtomDecl& attributionDecl, const string& moduleName, - const string& tryMethodName); - -void write_native_get_timestamp_ns_q(FILE* out); - -} // namespace stats_log_api_gen -} // namespace android diff --git a/tools/stats_log_api_gen/utils.cpp b/tools/stats_log_api_gen/utils.cpp index 8c4abe43a49b..cd6914b4fc06 100644 --- a/tools/stats_log_api_gen/utils.cpp +++ b/tools/stats_log_api_gen/utils.cpp @@ -286,9 +286,6 @@ void write_java_atom_codes(FILE* out, const Atoms& atoms, const string& moduleNa if (non_chained_decl != atom_code_to_non_chained_decl_map.end()) { write_java_usage(out, "write_non_chained", constant, *non_chained_decl->second); } - if (moduleName == DEFAULT_MODULE_NAME) { - fprintf(out, " * @hide\n"); - } fprintf(out, " */\n"); fprintf(out, " public static final int %s = %d;\n", constant.c_str(), atom->code); } @@ -310,9 +307,6 @@ void write_java_enum_values(FILE* out, const Atoms& atoms, const string& moduleN field->name.c_str()); for (map<int, string>::const_iterator value = field->enumValues.begin(); value != field->enumValues.end(); value++) { - if (moduleName == DEFAULT_MODULE_NAME) { - fprintf(out, " /** @hide */\n"); - } fprintf(out, " public static final int %s__%s__%s = %d;\n", make_constant_name(atom->message).c_str(), make_constant_name(field->name).c_str(), @@ -357,9 +351,6 @@ int write_java_non_chained_methods( } // Print method signature. - if (DEFAULT_MODULE_NAME == moduleName) { - fprintf(out, " /** @hide */\n"); - } fprintf(out, " public static void write_non_chained(int code"); vector<java_type_t> signature = signature_to_modules_it->first; int argIndex = 1; @@ -434,9 +425,6 @@ int write_java_work_source_methods( fprintf(out, "\n"); // Method header (signature) - if (DEFAULT_MODULE_NAME == moduleName) { - fprintf(out, " /** @hide */\n"); - } fprintf(out, " public static void write(int code"); int argIndex = 1; for (vector<java_type_t>::const_iterator arg = signature.begin(); diff --git a/tools/stats_log_api_gen/utils.h b/tools/stats_log_api_gen/utils.h index cd602e53359a..715d42bc160a 100644 --- a/tools/stats_log_api_gen/utils.h +++ b/tools/stats_log_api_gen/utils.h @@ -34,8 +34,6 @@ const string DEFAULT_MODULE_NAME = "DEFAULT"; const string DEFAULT_CPP_NAMESPACE = "android,util"; const string DEFAULT_CPP_HEADER_IMPORT = "statslog.h"; const string DEFAULT_ATOMS_INFO_CPP_HEADER_IMPORT = "atoms_info.h"; -const string DEFAULT_JAVA_PACKAGE = "android.util"; -const string DEFAULT_JAVA_CLASS = "StatsLogInternal"; const int JAVA_MODULE_REQUIRES_FLOAT = 0x01; const int JAVA_MODULE_REQUIRES_ATTRIBUTION = 0x02; |