[core] Support for Android S
This commit is contained in:
parent
43e5257ea7
commit
95739bc185
|
|
@ -44,5 +44,6 @@ static void clearCacheArm32(char* begin, char *end)
|
||||||
#define ANDROID_P 28
|
#define ANDROID_P 28
|
||||||
#define ANDROID_Q 29
|
#define ANDROID_Q 29
|
||||||
#define ANDROID_R 30
|
#define ANDROID_R 30
|
||||||
|
#define ANDROID_S 31
|
||||||
|
|
||||||
#endif //SANDHOOK_ARCH_H
|
#endif //SANDHOOK_ARCH_H
|
||||||
|
|
@ -43,6 +43,16 @@ extern "C" void Java_lab_galaxy_yahfa_HookMain_init(JNIEnv *env, jclass clazz, j
|
||||||
jclass classExecutable;
|
jclass classExecutable;
|
||||||
LOGI("init to SDK %d", sdkVersion);
|
LOGI("init to SDK %d", sdkVersion);
|
||||||
switch (sdkVersion) {
|
switch (sdkVersion) {
|
||||||
|
case __ANDROID_API_S__:
|
||||||
|
classExecutable = env->FindClass("java/lang/reflect/Executable");
|
||||||
|
fieldArtMethod = env->GetFieldID(classExecutable, "artMethod", "J");
|
||||||
|
kAccCompileDontBother = 0x02000000;
|
||||||
|
OFFSET_ArtMehod_in_Object = 0;
|
||||||
|
OFFSET_access_flags_in_ArtMethod = 4;
|
||||||
|
OFFSET_entry_point_from_quick_compiled_code_in_ArtMethod =
|
||||||
|
roundUpToPtrSize(4 * 3 + 2 * 2) + pointer_size;
|
||||||
|
ArtMethodSize = roundUpToPtrSize(4 * 3 + 2 * 2) + pointer_size * 2;
|
||||||
|
break;
|
||||||
case __ANDROID_API_R__:
|
case __ANDROID_API_R__:
|
||||||
classExecutable = env->FindClass("java/lang/reflect/Executable");
|
classExecutable = env->FindClass("java/lang/reflect/Executable");
|
||||||
fieldArtMethod = env->GetFieldID(classExecutable, "artMethod", "J");
|
fieldArtMethod = env->GetFieldID(classExecutable, "artMethod", "J");
|
||||||
|
|
@ -194,7 +204,7 @@ void *getArtMethodYahfa(JNIEnv *env, jobject jmethod) {
|
||||||
return artMethod;
|
return artMethod;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SDKVersion == __ANDROID_API_R__) {
|
if (SDKVersion >= __ANDROID_API_R__) {
|
||||||
artMethod = (void *) env->GetLongField(jmethod, fieldArtMethod);
|
artMethod = (void *) env->GetLongField(jmethod, fieldArtMethod);
|
||||||
} else {
|
} else {
|
||||||
artMethod = (void *) env->FromReflectedMethod(jmethod);
|
artMethod = (void *) env->FromReflectedMethod(jmethod);
|
||||||
|
|
|
||||||
|
|
@ -130,6 +130,7 @@ namespace art {
|
||||||
LOGE("No valid offset for art::Runtime::class_linker_ found. Using Android R.");
|
LOGE("No valid offset for art::Runtime::class_linker_ found. Using Android R.");
|
||||||
[[fallthrough]];
|
[[fallthrough]];
|
||||||
case __ANDROID_API_R__:
|
case __ANDROID_API_R__:
|
||||||
|
case __ANDROID_API_S__:
|
||||||
if constexpr(lspd::is64) {
|
if constexpr(lspd::is64) {
|
||||||
OFFSET_classlinker = 472;
|
OFFSET_classlinker = 472;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -107,8 +107,8 @@ namespace lspd {
|
||||||
});
|
});
|
||||||
|
|
||||||
void InstallNativeAPI() {
|
void InstallNativeAPI() {
|
||||||
LOGD("InstallNativeAPI: %p", symbol_do_dlopen);
|
|
||||||
symbol_do_dlopen = DobbySymbolResolver(nullptr, "__dl__Z9do_dlopenPKciPK17android_dlextinfoPKv");
|
symbol_do_dlopen = DobbySymbolResolver(nullptr, "__dl__Z9do_dlopenPKciPK17android_dlextinfoPKv");
|
||||||
|
LOGD("InstallNativeAPI: %p", symbol_do_dlopen);
|
||||||
HookSymNoHandle(symbol_do_dlopen, do_dlopen);
|
HookSymNoHandle(symbol_do_dlopen, do_dlopen);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -53,8 +53,11 @@ public class SandHookImpl extends BaseImpl {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init() {
|
public void init() {
|
||||||
SandHook.init(ClassNeverCall.class, com.swift.sandhook.SandHook.class);
|
int sdkVersion = Build.VERSION.SDK_INT;
|
||||||
Yahfa.init(Build.VERSION.SDK_INT);
|
if (Build.VERSION.PREVIEW_SDK_INT != 0) {
|
||||||
|
sdkVersion += 1;
|
||||||
|
}
|
||||||
|
Yahfa.init(sdkVersion);
|
||||||
getRouter().injectConfig();
|
getRouter().injectConfig();
|
||||||
SandHookXposedBridge.init();
|
SandHookXposedBridge.init();
|
||||||
setInitialized();
|
setInitialized();
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,11 @@ public class YahfaImpl extends BaseImpl {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init() {
|
public void init() {
|
||||||
Yahfa.init(Build.VERSION.SDK_INT);
|
int sdkVersion = Build.VERSION.SDK_INT;
|
||||||
|
if (Build.VERSION.PREVIEW_SDK_INT != 0) {
|
||||||
|
sdkVersion += 1;
|
||||||
|
}
|
||||||
|
Yahfa.init(sdkVersion);
|
||||||
getRouter().injectConfig();
|
getRouter().injectConfig();
|
||||||
setInitialized();
|
setInitialized();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue