Temporary disable native flag for compatibility with R

This commit is contained in:
LoveSy 2020-12-08 04:20:49 +08:00 committed by 双草酸酯
parent e36c3ed314
commit 1cc8751c8c
1 changed files with 6 additions and 2 deletions

View File

@ -120,13 +120,17 @@ bool setNativeFlag(void *method, bool isNative) {
LOGI("setNativeFlag: access flags is 0x%x", access_flags); LOGI("setNativeFlag: access flags is 0x%x", access_flags);
int old_access_flags = access_flags; int old_access_flags = access_flags;
if (isNative) { if (isNative) {
access_flags |= kAccNative; // TODO: Temporally disable native for compatible with Android R,
// but we should keep this and MarkInitializedClassVisiblyInitialized
if (SDKVersion < __ANDROID_API_R__)
access_flags |= kAccNative;
if (SDKVersion >= __ANDROID_API_Q__) { if (SDKVersion >= __ANDROID_API_Q__) {
// On API 29 whether to use the fast path or not is cached in the ART method structure // On API 29 whether to use the fast path or not is cached in the ART method structure
access_flags &= ~kAccFastInterpreterToInterpreterInvoke; access_flags &= ~kAccFastInterpreterToInterpreterInvoke;
} }
} else { } else {
access_flags &= ~kAccNative; if (SDKVersion < __ANDROID_API_R__)
access_flags &= ~kAccNative;
} }
if (access_flags != old_access_flags) { if (access_flags != old_access_flags) {
setFlags(method, access_flags); setFlags(method, access_flags);