Skip to content

Commit

Permalink
refine
Browse files Browse the repository at this point in the history
  • Loading branch information
bofeng-song committed Dec 16, 2024
1 parent 028763f commit 19371e8
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions native/cocos/platform/android/adpf_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ bool ADPFManager::initializePowerManager() {
#endif

JNIEnv *env = cc::JniHelper::getEnv();
auto *javaGameActivity = cc::JniHelper::getContext();
auto *applicationContext = cc::JniHelper::getContext();

// Retrieve class information
jclass context = env->FindClass("android/content/Context");
Expand All @@ -117,7 +117,7 @@ bool ADPFManager::initializePowerManager() {
// Get the method 'getSystemService' and call it
jmethodID mid_getss = env->GetMethodID(
context, "getSystemService", "(Ljava/lang/String;)Ljava/lang/Object;");
jobject obj_power_service = env->CallObjectMethod(javaGameActivity, mid_getss, str_svc);
jobject obj_power_service = env->CallObjectMethod(applicationContext, mid_getss, str_svc);

// Add global reference to the power service object.
obj_power_service_ = env->NewGlobalRef(obj_power_service);
Expand Down Expand Up @@ -189,7 +189,7 @@ bool ADPFManager::initializePerformanceHintManager() {
return true;
#else
JNIEnv *env = cc::JniHelper::getEnv();
auto *javaGameActivity = cc::JniHelper::getContext();
auto *applicationContext = cc::JniHelper::getContext();

// Retrieve class information
jclass context = env->FindClass("android/content/Context");
Expand All @@ -203,7 +203,7 @@ bool ADPFManager::initializePerformanceHintManager() {
jmethodID mid_getss = env->GetMethodID(
context, "getSystemService", "(Ljava/lang/String;)Ljava/lang/Object;");
jobject obj_perfhint_service = env->CallObjectMethod(
javaGameActivity, mid_getss, str_svc);
applicationContext, mid_getss, str_svc);

// Add global reference to the power service object.
obj_perfhint_service_ = env->NewGlobalRef(obj_perfhint_service);
Expand Down

0 comments on commit 19371e8

Please sign in to comment.