AndroidR: pre support

This commit is contained in:
swift_gan 2020-04-27 14:07:14 +08:00 committed by ganyao114
parent 30b18e0d51
commit a61ad081e7
6 changed files with 19 additions and 1 deletions

View File

@ -21,6 +21,7 @@
#define ANDROID_O_MR1 27
#define ANDROID_P 28
#define ANDROID_Q 29
#define ANDROID_R 30
static inline int32_t GetAndroidApiLevel() {
char prop_value[PROP_VALUE_MAX];

View File

@ -44,6 +44,15 @@ namespace art {
}
}
CREATE_HOOK_STUB_ENTRIES(bool, ShouldUseInterpreterEntrypoint, void *art_method, const void* quick_code) {
// TODO check hooked
bool hooked = false;
if (hooked && quick_code != nullptr) {
return false;
}
return ShouldUseInterpreterEntrypointBackup(art_method, quick_code);
}
public:
ClassLinker(void *thiz) : HookedObject(thiz) {}
@ -59,6 +68,10 @@ namespace art {
HOOK_FUNC(FixupStaticTrampolines,
"_ZN3art11ClassLinker22FixupStaticTrampolinesENS_6ObjPtrINS_6mirror5ClassEEE");
if (GetAndroidApiLevel() >= ANDROID_R) {
HOOK_FUNC(ShouldUseInterpreterEntrypoint,
"_ZN3art11ClassLinker30ShouldUseInterpreterEntrypointEPNS_9ArtMethodEPKv");
}
}
ALWAYS_INLINE void SetEntryPointsToInterpreter(void *art_method) const {

View File

@ -28,7 +28,7 @@ dependencies {
compileOnly files("${hiddenApiStubJarFilePath}")
implementation project(':edxp-common')
implementation project(':xposed-bridge')
implementation 'com.swift.sandhook:hooklib:4.1.7'
implementation 'com.swift.sandhook:hooklib:4.2.1'
compileOnly project(':dexmaker')
}

View File

@ -281,6 +281,7 @@ public class HookStubManager {
((XC_MethodHook) snapshot[beforeIdx]).callBeforeHookedMethod(param);
} catch (Throwable t) {
// reset result (ignoring what the unexpectedly exiting callback did)
XposedBridge.log(t);
param.setResult(null);
param.returnEarly = false;
continue;
@ -304,6 +305,7 @@ public class HookStubManager {
param.setResult(SandHook.callOriginMethod(originMethod, entity.backup, thiz, param.args));
}
} catch (Throwable e) {
XposedBridge.log(e);
param.setThrowable(e);
}
}
@ -317,6 +319,7 @@ public class HookStubManager {
try {
((XC_MethodHook) snapshot[afterIdx]).callAfterHookedMethod(param);
} catch (Throwable t) {
XposedBridge.log(t);
if (lastThrowable == null)
param.setResult(lastResult);
else
@ -375,6 +378,7 @@ public class HookStubManager {
try {
param.setResult(SandHook.callOriginMethod(true, origin, backup, thiz, param.args));
} catch (Throwable e) {
XposedBridge.log(e);
param.setThrowable(e);
}
}