Fix pendding hook condition

This commit is contained in:
LoveSy 2021-01-29 07:32:21 +08:00
parent e5379ea27e
commit b27398fbe0
2 changed files with 7 additions and 3 deletions

View File

@ -131,8 +131,8 @@ namespace art {
if (api_level >= __ANDROID_API_R__) {
// In android R, FixupStaticTrampolines won't be called unless it's marking it as
// invisiblyInitialized.
// So we miss some calls between initialized and invisiblyInitialized.
// visiblyInitialized.
// So we miss some calls between initialized and visiblyInitialized.
// Therefore we hook the new introduced MarkClassInitialized instead
// This only happens on non-x86 devices
lspd::HookSyms(handle, hook_func, MarkClassInitialized);

View File

@ -29,10 +29,14 @@ public class ClassUtils {
* 5.0-8.0: kInitialized = 10 int
* 8.1: kInitialized = 11 int
* 9.0+: kInitialized = 14 uint8_t
* 11.0+: kInitialized = 14 uint8_t
* kVisiblyInitialized = 15 uint8_t
*/
@ApiSensitive(Level.MIDDLE)
public static boolean isInitialized(Class clazz) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
return getClassStatus(clazz, true) >= 14;
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
return getClassStatus(clazz, true) == 14;
} else if (Build.VERSION.SDK_INT == Build.VERSION_CODES.O_MR1) {
return getClassStatus(clazz, false) == 11;