Skip to content

Commit fa86886

Browse files
committed
Restore getCallingUid Hook
Signed-off-by: tiann <[email protected]>
1 parent 229df1d commit fa86886

File tree

2 files changed

+1
-9
lines changed

2 files changed

+1
-9
lines changed

VirtualApp/lib/src/main/jni/Foundation/VMPatch.cpp

+1-4
Original file line numberDiff line numberDiff line change
@@ -441,10 +441,7 @@ void hookAndroidVM(JArrayClass<jobject> javaMethods,
441441
}
442442
}
443443
measureNativeOffset(isArt);
444-
// Crash on Q if hook directly by modify entrypoint of function.
445-
// Just skip this step on Q and get never crash
446-
if(apiLevel <= 28)
447-
replaceGetCallingUid(isArt);
444+
replaceGetCallingUid(isArt);
448445

449446
replaceOpenDexFileMethod(javaMethods.getElement(OPEN_DEX).get(), isArt,
450447
apiLevel);

VirtualApp/lib/src/main/jni/fb/jni/Environment.cpp

-5
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,6 @@ void Environment::detachCurrentThread() {
9090

9191
/* static */
9292
JNIEnv* Environment::ensureCurrentThreadIsAttached() {
93-
auto scope = currentScope();
94-
if (scope && scope->env_) {
95-
return scope->env_;
96-
}
9793

9894
JNIEnv* env;
9995
// We should be able to just get the JNIEnv* by just calling
@@ -104,7 +100,6 @@ JNIEnv* Environment::ensureCurrentThreadIsAttached() {
104100
FBASSERT(result == JNI_OK || result == JNI_EDETACHED);
105101
if (result == JNI_EDETACHED) {
106102
// The thread should not be detached while a ThreadScope is in the stack.
107-
FBASSERT(!scope);
108103
env = attachCurrentThread();
109104
}
110105
FBASSERT(env);

0 commit comments

Comments
 (0)