Should check visiblyInitialized for pending hooks in R

This commit is contained in:
LoveSy 2020-12-09 13:53:46 +08:00 committed by 双草酸酯
parent b2c03cc8ce
commit 783e2bf898
1 changed files with 6 additions and 2 deletions

View File

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