Skip to content

Commit

Permalink
Fix Android ADPF API compatibility issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
bofeng-song committed Dec 17, 2024
1 parent 405fca8 commit b8ba4bc
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions native/cocos/platform/android/adpf_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ bool ADPFManager::initializePerformanceHintManager() {
hint_session_ = APerformanceHint_createSession(hint_manager_, tids, 1, last_target_);
}
return true;
#else
#elif __ANDROID_API__ >= 31
JNIEnv *env = cc::JniHelper::getEnv();
auto *javaGameActivity = cc::JniHelper::getActivity();

Expand Down Expand Up @@ -264,6 +264,8 @@ bool ADPFManager::initializePerformanceHintManager() {
}

return true;
#else
return false;
#endif
}

Expand Down Expand Up @@ -335,7 +337,7 @@ void ADPFManager::registerThreadIdsToHintSession() {
APerformanceHint_closeSession(hint_session_);
}
hint_session_ = APerformanceHint_createSession(hint_manager_, data, size, last_target_);
#else
#elif __ANDROID_API__ >= 31
JNIEnv *env = cc::JniHelper::getEnv();
std::size_t size = thread_ids_.size();
jintArray array = env->NewIntArray(size);
Expand Down

0 comments on commit b8ba4bc

Please sign in to comment.