From 19371e8359f8ff2762d7acc16f95225a0616cb2e Mon Sep 17 00:00:00 2001 From: bofeng Date: Mon, 16 Dec 2024 16:31:38 +0800 Subject: [PATCH] refine --- native/cocos/platform/android/adpf_manager.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/native/cocos/platform/android/adpf_manager.cpp b/native/cocos/platform/android/adpf_manager.cpp index 9dad2384412..32c5a97cad7 100644 --- a/native/cocos/platform/android/adpf_manager.cpp +++ b/native/cocos/platform/android/adpf_manager.cpp @@ -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"); @@ -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); @@ -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"); @@ -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);