Commit 9469e79e authored by topjohnwu's avatar topjohnwu

Proper namespacing

The IDE will get confused when #include is in a namespace
parent db78c201
...@@ -271,6 +271,7 @@ def gen_jni_hook(): ...@@ -271,6 +271,7 @@ def gen_jni_hook():
with open('jni_hooks.hpp', 'w') as f: with open('jni_hooks.hpp', 'w') as f:
f.write('// Generated by gen_jni_hooks.py\n') f.write('// Generated by gen_jni_hooks.py\n')
f.write('\nnamespace {\n')
zygote = 'com/android/internal/os/Zygote' zygote = 'com/android/internal/os/Zygote'
...@@ -285,4 +286,4 @@ with open('jni_hooks.hpp', 'w') as f: ...@@ -285,4 +286,4 @@ with open('jni_hooks.hpp', 'w') as f:
f.write(gen_jni_hook()) f.write(gen_jni_hook())
f.write('\n') f.write('\n\n} // namespace\n')
...@@ -79,6 +79,8 @@ HookContext *g_ctx; ...@@ -79,6 +79,8 @@ HookContext *g_ctx;
const JNINativeInterface *old_functions; const JNINativeInterface *old_functions;
JNINativeInterface *new_functions; JNINativeInterface *new_functions;
} // namespace
#define HOOK_JNI(method) \ #define HOOK_JNI(method) \
if (methods[i].name == #method##sv) { \ if (methods[i].name == #method##sv) { \
int j = 0; \ int j = 0; \
...@@ -103,6 +105,8 @@ if (methods[i].name == #method##sv) { ...@@ -103,6 +105,8 @@ if (methods[i].name == #method##sv) {
#undef HOOK_JNI #undef HOOK_JNI
namespace {
jclass gClassRef; jclass gClassRef;
jmethodID class_getName; jmethodID class_getName;
string get_class_name(JNIEnv *env, jclass clazz) { string get_class_name(JNIEnv *env, jclass clazz) {
......
// Generated by gen_jni_hooks.py // Generated by gen_jni_hooks.py
namespace {
void *nativeForkAndSpecialize_orig = nullptr; 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) { 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); 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 ...@@ -318,3 +320,5 @@ unique_ptr<JNINativeMethod[]> hookAndSaveJNIMethods(const char *className, const
} }
return newMethods; return newMethods;
} }
} // namespace
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment