Proper namespacing

The IDE will get confused when #include is in a namespace
This commit is contained in:
topjohnwu 2022-06-15 02:38:56 -07:00
parent db78c20161
commit 9469e79e3c
3 changed files with 10 additions and 1 deletions

View File

@ -271,6 +271,7 @@ def gen_jni_hook():
with open('jni_hooks.hpp', 'w') as f:
f.write('// Generated by gen_jni_hooks.py\n')
f.write('\nnamespace {\n')
zygote = 'com/android/internal/os/Zygote'
@ -285,4 +286,4 @@ with open('jni_hooks.hpp', 'w') as f:
f.write(gen_jni_hook())
f.write('\n')
f.write('\n\n} // namespace\n')

View File

@ -79,6 +79,8 @@ HookContext *g_ctx;
const JNINativeInterface *old_functions;
JNINativeInterface *new_functions;
} // namespace
#define HOOK_JNI(method) \
if (methods[i].name == #method##sv) { \
int j = 0; \
@ -103,6 +105,8 @@ if (methods[i].name == #method##sv) {
#undef HOOK_JNI
namespace {
jclass gClassRef;
jmethodID class_getName;
string get_class_name(JNIEnv *env, jclass clazz) {

View File

@ -1,5 +1,7 @@
// Generated by gen_jni_hooks.py
namespace {
void *nativeForkAndSpecialize_orig = nullptr;
jint nativeForkAndSpecialize_l(JNIEnv *env, jclass clazz, jint uid, jint gid, jintArray gids, jint runtime_flags, jobjectArray rlimits, jint mount_external, jstring se_info, jstring nice_name, jintArray fds_to_close, jstring instruction_set, jstring app_data_dir) {
AppSpecializeArgs_v3 args(uid, gid, gids, runtime_flags, rlimits, mount_external, se_info, nice_name, instruction_set, app_data_dir);
@ -318,3 +320,5 @@ unique_ptr<JNINativeMethod[]> hookAndSaveJNIMethods(const char *className, const
}
return newMethods;
}
} // namespace