diff --git a/services/BUILD.gn b/services/BUILD.gn index 9d879ef02e1da22709c3baccf287e62099ac37ad..7fce827054f5657d0770ea611dda63ac7ccdc488 100644 --- a/services/BUILD.gn +++ b/services/BUILD.gn @@ -111,7 +111,7 @@ ohos_shared_library("powermgrservice") { "common_event_service:cesfwk_innerkits", "config_policy:configpolicy_util", "data_share:datashare_consumer", - "drivers_interface_power:libpower_proxy_1.3", + "drivers_interface_power:libpower_proxy_1.2", "eventhandler:libeventhandler", "ffrt:libffrt", "graphic_2d:librender_service_base", diff --git a/services/native/include/power_hdi_callback.h b/services/native/include/power_hdi_callback.h index dc4d1eff5c371f2f940cd1c23bbb1d25cc994c51..46a9b9373f68938a22f2da724b9bf470f15ab9e2 100644 --- a/services/native/include/power_hdi_callback.h +++ b/services/native/include/power_hdi_callback.h @@ -17,11 +17,11 @@ #define POWERMGR_POWER_MANAGER_POWER_HDI_CALLBACK_H #include -#include "v1_3/ipower_hdi_callback.h" +#include "v1_2/ipower_hdi_callback.h" namespace OHOS { namespace PowerMgr { -using namespace OHOS::HDI::Power::V1_3; +using namespace OHOS::HDI::Power::V1_2; class PowerHdiCallback : public IPowerHdiCallback { public: virtual ~PowerHdiCallback() {} @@ -30,7 +30,7 @@ public: int32_t OnWakeup() override; - int32_t OnWakeupWithTag(int32_t suspendTag) override; + int32_t OnWakeupWithTag(const std::string& tag) override; }; } // OHOS } // PowerMgr diff --git a/services/native/src/actions/default/BUILD.gn b/services/native/src/actions/default/BUILD.gn index e1ac7e2ea882807a08d55a76b5ba095f95b69da6..fe640265f9b31f3742af20e8d67f9a54200da938 100644 --- a/services/native/src/actions/default/BUILD.gn +++ b/services/native/src/actions/default/BUILD.gn @@ -62,7 +62,7 @@ ohos_source_set("${powermgr_actions_default_target}") { external_deps = [ "c_utils:utils", - "drivers_interface_power:libpower_proxy_1.3", + "drivers_interface_power:libpower_proxy_1.2", "ffrt:libffrt", "hdf_core:libhdf_utils", "hdf_core:libhdi", diff --git a/services/native/src/actions/default/system_suspend_controller.cpp b/services/native/src/actions/default/system_suspend_controller.cpp index 7c7d08cf1d504b910b9fec3b01d93f1fcf24ca51..3c978d26f32fa0b05117f06ea93110310af03a66 100644 --- a/services/native/src/actions/default/system_suspend_controller.cpp +++ b/services/native/src/actions/default/system_suspend_controller.cpp @@ -28,7 +28,7 @@ const std::string HDI_SERVICE_NAME = "power_interface_service"; constexpr uint32_t RETRY_TIME = 1000; constexpr int32_t ERR_FAILED = -1; } // namespace -using namespace OHOS::HDI::Power::V1_3; +using namespace OHOS::HDI::Power::V1_2; SystemSuspendController::SystemSuspendController() {} @@ -193,11 +193,11 @@ bool SystemSuspendController::Hibernate() return true; } -OHOS::HDI::Power::V1_3::RunningLockInfo SystemSuspendController::FillRunningLockInfo(const RunningLockParam& param) +OHOS::HDI::Power::V1_2::RunningLockInfo SystemSuspendController::FillRunningLockInfo(const RunningLockParam& param) { - OHOS::HDI::Power::V1_3::RunningLockInfo filledInfo {}; + OHOS::HDI::Power::V1_2::RunningLockInfo filledInfo {}; filledInfo.name = param.name; - filledInfo.type = static_cast(param.type); + filledInfo.type = static_cast(param.type); filledInfo.timeoutMs = param.timeoutMs; filledInfo.uid = param.uid; filledInfo.pid = param.pid; @@ -212,7 +212,7 @@ int32_t SystemSuspendController::AcquireRunningLock(const RunningLockParam& para POWER_HILOGE(COMP_SVC, "The hdf interface is null"); return status; } - OHOS::HDI::Power::V1_3::RunningLockInfo filledInfo = FillRunningLockInfo(param); + OHOS::HDI::Power::V1_2::RunningLockInfo filledInfo = FillRunningLockInfo(param); status = powerInterface->HoldRunningLockExt(filledInfo, param.lockid, param.bundleName); return status; @@ -226,7 +226,7 @@ int32_t SystemSuspendController::ReleaseRunningLock(const RunningLockParam& para POWER_HILOGE(COMP_SVC, "The hdf interface is null"); return status; } - OHOS::HDI::Power::V1_3::RunningLockInfo filledInfo = FillRunningLockInfo(param); + OHOS::HDI::Power::V1_2::RunningLockInfo filledInfo = FillRunningLockInfo(param); status = powerInterface->UnholdRunningLockExt(filledInfo, param.lockid, param.bundleName); return status; @@ -288,20 +288,20 @@ int32_t SystemSuspendController::PowerHdfCallback::OnWakeup() return 0; } -int32_t SystemSuspendController::PowerHdfCallback::OnWakeupWithTag(int32_t suspendTag) +int32_t SystemSuspendController::PowerHdfCallback::OnWakeupWithTag(const std::string& tag) { - if (onWakeup_ != nullptr) { - onWakeupWithTag_(suspendTag); + if (onWakeupWithTag_ != nullptr) { + onWakeupWithTag_(tag); } return 0; } -void SystemSuspendController::PowerHdfCallback::SetListener( - std::function& suspend, std::function& wakeup, std::function& onWakeupWithTag) +void SystemSuspendController::PowerHdfCallback::SetListener(std::function& suspend, + std::function& wakeup, std::function& wakeupWithTag) { onSuspend_ = suspend; onWakeup_ = wakeup; - onWakeupWithTag_ = onWakeupWithTag; + onWakeupWithTag_ = wakeupWithTag; } } // namespace PowerMgr } // namespace OHOS diff --git a/services/native/src/actions/default/system_suspend_controller.h b/services/native/src/actions/default/system_suspend_controller.h index ae9d4bd21af50274d0a85cb5bb30ed456fe6642f..55cc71a61d50e301a7c466051309bcedb9643c55 100644 --- a/services/native/src/actions/default/system_suspend_controller.h +++ b/services/native/src/actions/default/system_suspend_controller.h @@ -26,7 +26,7 @@ #include "suspend/irunning_lock_hub.h" #include "suspend/isuspend_controller.h" #include "power_hdi_callback.h" -#include "v1_3/ipower_interface.h" +#include "v1_2/ipower_interface.h" #include "ffrt_utils.h" namespace OHOS { @@ -53,23 +53,23 @@ private: DECLARE_DELAYED_REF_SINGLETON(SystemSuspendController); inline static constexpr const char* WAKEUP_HOLDER = "OHOSPowerMgr.WakeupHolder"; - class PowerHdfCallback : public OHOS::HDI::Power::V1_3::IPowerHdiCallback { + class PowerHdfCallback : public OHOS::HDI::Power::V1_2::IPowerHdiCallback { public: PowerHdfCallback() = default; ~PowerHdfCallback() = default; int32_t OnSuspend() override; int32_t OnWakeup() override; - int32_t OnWakeupWithTag(int32_t suspendTag) override; + int32_t OnWakeupWithTag(const std::string& tag) override; void SetListener(std::function& suspend, std::function& wakeup, - std::function& onWakeupWithTag); + std::function& wakeupWithTag); private: - std::function onSuspend_ {nullptr}; - std::function onWakeup_ {nullptr}; - std::function onWakeupWithTag_ {nullptr}; + std::function onSuspend_; + std::function onWakeup_; + std::function onWakeupWithTag_; }; - OHOS::HDI::Power::V1_3::RunningLockInfo FillRunningLockInfo(const RunningLockParam& param); - using IPowerInterface = OHOS::HDI::Power::V1_3::IPowerInterface; + OHOS::HDI::Power::V1_2::RunningLockInfo FillRunningLockInfo(const RunningLockParam& param); + using IPowerInterface = OHOS::HDI::Power::V1_2::IPowerInterface; sptr GetPowerInterface(); std::mutex mutex_; std::mutex interfaceMutex_; diff --git a/services/native/src/power_hdi_callback.cpp b/services/native/src/power_hdi_callback.cpp index 9ee64fe973697a118a6d34211d127e414952c10d..7136d4fd7e12036a1353c69ca3978213cb009229 100644 --- a/services/native/src/power_hdi_callback.cpp +++ b/services/native/src/power_hdi_callback.cpp @@ -17,7 +17,7 @@ #include "hdf_base.h" #include "power_hookmgr.h" -using namespace OHOS::HDI::Power::V1_3; +using namespace OHOS::HDI::Power::V1_2; namespace OHOS { namespace PowerMgr { @@ -31,8 +31,9 @@ int32_t PowerHdiCallback::OnWakeup() return HDF_SUCCESS; } -int32_t PowerHdiCallback::OnWakeupWithTag(int32_t suspendTag __attribute__((unused))) +int32_t PowerHdiCallback::OnWakeupWithTag(const std::string& tag) { + (void)tag; return HDF_SUCCESS; } } // OHOS