diff --git a/frameworks/napi/power/power_napi.cpp b/frameworks/napi/power/power_napi.cpp index 738886c6f0d16faf48d475bd5ae873ae3ca0f600..cc2d75438992eff5a7cf354e7ae458a063d01e51 100644 --- a/frameworks/napi/power/power_napi.cpp +++ b/frameworks/napi/power/power_napi.cpp @@ -72,7 +72,9 @@ napi_value PowerNapi::Wakeup(napi_env env, napi_callback_info info) std::string detail = NapiUtils::GetStringFromNapi(env, argv[INDEX_0]); POWER_HILOGD(FEATURE_WAKEUP, "Wakeup type: APPLICATION, reason: %{public}s", detail.c_str()); - PowerErrors code = g_powerMgrClient.WakeupDevice(WakeupDeviceType::WAKEUP_DEVICE_APPLICATION, detail); + int32_t apiVersion = AppManagerUtils::GetApiTargetVersion(); + PowerErrors code = g_powerMgrClient.WakeupDevice( + WakeupDeviceType::WAKEUP_DEVICE_APPLICATION, detail, std::to_string(apiVersion)); if (code != PowerErrors::ERR_OK) { error.ThrowError(env, code); } @@ -99,10 +101,12 @@ napi_value PowerNapi::Suspend(napi_env env, napi_callback_info info) napi_get_value_bool(env, argv[0], &isForce); PowerErrors code; + int32_t apiVersion = AppManagerUtils::GetApiTargetVersion(); if (isForce) { - code = g_powerMgrClient.ForceSuspendDevice(); + code = g_powerMgrClient.ForceSuspendDevice(std::to_string(apiVersion)); } else { - code = g_powerMgrClient.SuspendDevice(); + code = g_powerMgrClient.SuspendDevice( + SuspendDeviceType::SUSPEND_DEVICE_REASON_APPLICATION, false, std::to_string(apiVersion)); } if (code != PowerErrors::ERR_OK) { POWER_HILOGE(FEATURE_WAKEUP, "Suspend Device fail, isForce:%{public}d", isForce);