Skip to content
This repository has been archived by the owner on Jan 8, 2024. It is now read-only.

Commit

Permalink
Fix pendding hook condition
Browse files Browse the repository at this point in the history
  • Loading branch information
yujincheng08 committed Jan 28, 2021
1 parent e5379ea commit b27398f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 2 additions & 2 deletions core/src/main/cpp/main/include/art/runtime/class_linker.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,14 @@ public static int getClassStatus(Class clazz, boolean isUnsigned) {
* 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;
Expand Down

0 comments on commit b27398f

Please sign in to comment.