From c0ca1e225dede7441c3922235c5ef45ff2bb958b Mon Sep 17 00:00:00 2001 From: wangyantian Date: Mon, 21 Apr 2025 21:51:09 +0800 Subject: [PATCH 1/2] feat: add ulsr callback Signed-off-by: wangyantian --- bundle.json | 1 + frameworks/native/power_mgr_client.cpp | 16 ++++ .../inner_api/native/include/ipower_mgr.h | 3 + .../native/include/power_mgr_client.h | 2 + .../include/power_mgr_ipc_interface_code.h | 2 + .../native/include/ulsr/isync_ulsr_callback.h | 35 +++++++ .../sync_ulsr_callback_ipc_interface_code.h | 27 ++++++ powermgr.gni | 5 + services/BUILD.gn | 5 + services/native/include/power_mgr_service.h | 8 ++ services/native/src/power_mgr_service.cpp | 52 ++++++++++- services/native/src/ulsr/ulsr_controller.cpp | 91 +++++++++++++++++++ services/native/src/ulsr/ulsr_controller.h | 55 +++++++++++ services/zidl/include/power_mgr_proxy.h | 2 + services/zidl/include/power_mgr_stub.h | 2 + .../zidl/include/sync_ulsr_callback_proxy.h | 42 +++++++++ .../zidl/include/sync_ulsr_callback_stub.h | 42 +++++++++ services/zidl/src/power_mgr_proxy.cpp | 50 ++++++++++ services/zidl/src/power_mgr_stub.cpp | 20 ++++ .../zidl/src/sync_ulsr_callback_proxy.cpp | 70 ++++++++++++++ services/zidl/src/sync_ulsr_callback_stub.cpp | 60 ++++++++++++ 21 files changed, 588 insertions(+), 2 deletions(-) create mode 100644 interfaces/inner_api/native/include/ulsr/isync_ulsr_callback.h create mode 100644 interfaces/inner_api/native/include/ulsr/sync_ulsr_callback_ipc_interface_code.h create mode 100644 services/native/src/ulsr/ulsr_controller.cpp create mode 100644 services/native/src/ulsr/ulsr_controller.h create mode 100644 services/zidl/include/sync_ulsr_callback_proxy.h create mode 100644 services/zidl/include/sync_ulsr_callback_stub.h create mode 100644 services/zidl/src/sync_ulsr_callback_proxy.cpp create mode 100644 services/zidl/src/sync_ulsr_callback_stub.cpp diff --git a/bundle.json b/bundle.json index 56af83c3..e7cf3cc1 100644 --- a/bundle.json +++ b/bundle.json @@ -31,6 +31,7 @@ "power_manager_feature_wakeup_action", "power_manager_feature_power_dialog", "power_manager_feature_enable_s4", + "power_manager_feature_enable_ulsr", "power_manager_feature_audio_lock_unproxy", "power_manager_feature_doubleclick", "power_manager_feature_pickup", diff --git a/frameworks/native/power_mgr_client.cpp b/frameworks/native/power_mgr_client.cpp index 5a26099a..9af81d16 100644 --- a/frameworks/native/power_mgr_client.cpp +++ b/frameworks/native/power_mgr_client.cpp @@ -410,6 +410,22 @@ bool PowerMgrClient::UnRegisterSyncHibernateCallback(const sptr& callback) +{ + sptr proxy = GetPowerMgrProxy(); + RETURN_IF_WITH_RET((callback == nullptr) || (proxy == nullptr), false); + bool ret = proxy->RegisterSyncUlsrCallback(callback); + return ret; +} + +bool PowerMgrClient::UnRegisterSyncUlsrCallback(const sptr& callback) +{ + sptr proxy = GetPowerMgrProxy(); + RETURN_IF_WITH_RET((callback == nullptr) || (proxy == nullptr), false); + bool ret = proxy->UnRegisterSyncUlsrCallback(callback); + return ret; +} + bool PowerMgrClient::RegisterPowerModeCallback(const sptr& callback) { sptr proxy = GetPowerMgrProxy(); diff --git a/interfaces/inner_api/native/include/ipower_mgr.h b/interfaces/inner_api/native/include/ipower_mgr.h index 3f728c63..7c5bdfd1 100644 --- a/interfaces/inner_api/native/include/ipower_mgr.h +++ b/interfaces/inner_api/native/include/ipower_mgr.h @@ -33,6 +33,7 @@ #include "shutdown/ishutdown_client.h" #include "suspend/isync_sleep_callback.h" #include "hibernate/isync_hibernate_callback.h" +#include "ulsr/isync_ulsr_callback.h" namespace OHOS { namespace PowerMgr { @@ -79,6 +80,8 @@ public: virtual bool RegisterSyncHibernateCallback(const sptr& callback) = 0; virtual bool UnRegisterSyncHibernateCallback(const sptr& callback) = 0; + virtual bool RegisterSyncUlsrCallback(const sptr& callback) = 0; + virtual bool UnRegisterSyncUlsrCallback(const sptr& callback) = 0; // Used for callback registration upon power mode. virtual bool RegisterPowerModeCallback(const sptr& callback) = 0; diff --git a/interfaces/inner_api/native/include/power_mgr_client.h b/interfaces/inner_api/native/include/power_mgr_client.h index a29135e1..8e3142f8 100644 --- a/interfaces/inner_api/native/include/power_mgr_client.h +++ b/interfaces/inner_api/native/include/power_mgr_client.h @@ -180,6 +180,8 @@ public: bool UnRegisterPowerStateCallback(const sptr& callback); bool RegisterSyncHibernateCallback(const sptr& callback); bool UnRegisterSyncHibernateCallback(const sptr& callback); + bool RegisterSyncUlsrCallback(const sptr& callback); + bool UnRegisterSyncUlsrCallback(const sptr& callback); bool RegisterSyncSleepCallback(const sptr& callback, SleepPriority priority); bool UnRegisterSyncSleepCallback(const sptr& callback); bool RegisterPowerModeCallback(const sptr& callback); diff --git a/interfaces/inner_api/native/include/power_mgr_ipc_interface_code.h b/interfaces/inner_api/native/include/power_mgr_ipc_interface_code.h index 8c508d84..8d2315bf 100644 --- a/interfaces/inner_api/native/include/power_mgr_ipc_interface_code.h +++ b/interfaces/inner_api/native/include/power_mgr_ipc_interface_code.h @@ -64,6 +64,8 @@ enum class PowerMgrInterfaceCode { SET_SUSPEND_TAG, REG_SYNC_HIBERNATE_CALLBACK, UNREG_SYNC_HIBERNATE_CALLBACK, + REG_SYNC_ULSR_CALLBACK, + UNREG_SYNC_ULSR_CALLBACK, UPDATE_WORK_SOURCE, IS_RUNNINGLOCK_ENABLED }; diff --git a/interfaces/inner_api/native/include/ulsr/isync_ulsr_callback.h b/interfaces/inner_api/native/include/ulsr/isync_ulsr_callback.h new file mode 100644 index 00000000..1c7be9a3 --- /dev/null +++ b/interfaces/inner_api/native/include/ulsr/isync_ulsr_callback.h @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef POWERMGR_POWER_MANAGER_ISYNC_ULSR_CALLBACK_H +#define POWERMGR_POWER_MANAGER_ISYNC_ULSR_CALLBACK_H + +#include +#include +#include +#include + +namespace OHOS { +namespace PowerMgr { +class ISyncUlsrCallback : public IRemoteBroker { +public: + virtual void OnSyncUlsr() = 0; + virtual void OnSyncWakeup() = 0; + DECLARE_INTERFACE_DESCRIPTOR(u"ohos.powermgr.ISyncUlsrCallback"); +}; +} // namespace PowerMgr +} // namespace OHOS + +#endif // POWERMGR_POWER_MANAGER_ISYNC_ULSR_CALLBACK_H diff --git a/interfaces/inner_api/native/include/ulsr/sync_ulsr_callback_ipc_interface_code.h b/interfaces/inner_api/native/include/ulsr/sync_ulsr_callback_ipc_interface_code.h new file mode 100644 index 00000000..e85ef153 --- /dev/null +++ b/interfaces/inner_api/native/include/ulsr/sync_ulsr_callback_ipc_interface_code.h @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef POWERMGR_SYNC_ULSR_CALLBACK_INTERFACE_CODE_H +#define POWERMGR_SYNC_ULSR_CALLBACK_INTERFACE_CODE_H +namespace OHOS { +namespace PowerMgr { +enum class SyncUlsrCallbackInterfaceCode { + CMD_ON_SYNC_ULSR = 0, + CMD_ON_SYNC_WAKEUP = 1, +}; +} // namespace PowerMgr +} // namespace OHOS + +#endif // POWERMGR_SYNC_ULSR_CALLBACK_INTERFACE_CODE_H diff --git a/powermgr.gni b/powermgr.gni index 374bd188..9873d759 100644 --- a/powermgr.gni +++ b/powermgr.gni @@ -25,6 +25,7 @@ declare_args() { power_manager_feature_wakeup_action = false power_manager_feature_power_dialog = true power_manager_feature_enable_s4 = false + power_manager_feature_enable_ulsr = true power_manager_feature_audio_lock_unproxy = false power_manager_feature_screen_on_timeout_check = false power_manager_feature_doubleclick = true @@ -46,6 +47,10 @@ if (power_manager_feature_enable_s4) { defines += [ "POWER_MANAGER_POWER_ENABLE_S4" ] } +if (power_manager_feature_enable_ulsr) { + defines += [ "POWER_MANAGER_POWER_ENABLE_ULSR" ] +} + if (power_manager_feature_audio_lock_unproxy) { defines += [ "POWER_MANAGER_AUDIO_LOCK_UNPROXY" ] } diff --git a/services/BUILD.gn b/services/BUILD.gn index 6c283dd3..6de1b8fa 100644 --- a/services/BUILD.gn +++ b/services/BUILD.gn @@ -29,6 +29,7 @@ config("powermgr_private_config") { "native/src/setting", "native/src/shutdown", "native/src/suspend", + "native/src/ulsr", "native/src/wakeup", "native/src/hibernate", "native/src/screenoffpre", @@ -214,6 +215,10 @@ ohos_shared_library("powermgrservice") { ] } + if (power_manager_feature_enable_ulsr) { + sources += [ "native/src/ulsr/ulsr_controller.cpp" ] + } + if (power_manager_feature_force_sleep_broadcast) { defines += [ "POWER_MANAGER_ENABLE_FORCE_SLEEP_BROADCAST" ] } diff --git a/services/native/include/power_mgr_service.h b/services/native/include/power_mgr_service.h index 5cbdf15e..70b1ba1a 100644 --- a/services/native/include/power_mgr_service.h +++ b/services/native/include/power_mgr_service.h @@ -37,6 +37,9 @@ #include "shutdown_dialog.h" #include "sp_singleton.h" #include "suspend_controller.h" +#ifdef POWER_MANAGER_POWER_ENABLE_ULSR +#include "ulsr_controller.h" +#endif #include "wakeup_controller.h" #ifdef POWER_MANAGER_WAKEUP_ACTION #include "wakeup_action_controller.h" @@ -114,6 +117,8 @@ public: virtual bool UnRegisterSyncSleepCallback(const sptr& callback) override; virtual bool RegisterSyncHibernateCallback(const sptr& callback) override; virtual bool UnRegisterSyncHibernateCallback(const sptr& callback) override; + virtual bool RegisterSyncUlsrCallback(const sptr& callback) override; + virtual bool UnRegisterSyncUlsrCallback(const sptr& callback) override; virtual bool RegisterPowerModeCallback(const sptr& callback) override; virtual bool UnRegisterPowerModeCallback(const sptr& callback) override; @@ -379,6 +384,9 @@ private: sptr ptoken_ {nullptr}; #ifdef POWER_MANAGER_POWER_ENABLE_S4 std::shared_ptr hibernateController_ {nullptr}; +#endif +#ifdef POWER_MANAGER_POWER_ENABLE_ULSR + std::shared_ptr ulsrController_ {nullptr}; #endif std::shared_ptr screenOffPreController_ {nullptr}; #ifdef POWER_MANAGER_WAKEUP_ACTION diff --git a/services/native/src/power_mgr_service.cpp b/services/native/src/power_mgr_service.cpp index 1a378b3c..781d7e04 100644 --- a/services/native/src/power_mgr_service.cpp +++ b/services/native/src/power_mgr_service.cpp @@ -150,6 +150,11 @@ bool PowerMgrService::Init() screenOffPreController_ = std::make_shared(powerStateMachine_); screenOffPreController_->Init(); } +#ifdef POWER_MANAGER_POWER_ENABLE_ULSR + if (!ulsrController_) { + ulsrController_ = std::make_shared(); + } +#endif POWER_HILOGI(COMP_SVC, "powermgr service init success"); return true; } @@ -997,8 +1002,13 @@ PowerErrors PowerMgrService::SetSuspendTag(const std::string& tag) if (!Permission::IsSystem()) { return PowerErrors::ERR_SYSTEM_API_DENIED; } - POWER_HILOGI(FEATURE_SUSPEND, "pid: %{public}d, uid: %{public}d, tag: %{public}s", pid, uid, tag.c_str()); - SystemSuspendController::GetInstance().SetSuspendTag(tag); + POWER_HILOGI(FEATURE_SUSPEND, + "[UL_POWER] Try to set suspend tag, pid: %{public}d, uid: %{public}d, tag: %{public}s", pid, uid, tag.c_str()); + if (!ulsrController_) { + POWER_HILOGE(FEATURE_SUSPEND, "[UL_POWER] Set suspend tag failed"); + return PowerErrors::ERR_FAILURE; + } + ulsrController_->SetSuspendTagLocked(tag); return PowerErrors::ERR_OK; } @@ -1577,6 +1587,44 @@ bool PowerMgrService::UnRegisterSyncHibernateCallback(const sptr& callback) +{ +#ifdef POWER_MANAGER_POWER_ENABLE_ULSR + std::lock_guard lock(suspendMutex_); + pid_t pid = IPCSkeleton::GetCallingPid(); + auto uid = IPCSkeleton::GetCallingUid(); + if (!Permission::IsSystem()) { + return false; + } + POWER_HILOGI(FEATURE_SUSPEND, "RegisterSyncUlsrCallback, pid: %{public}d, uid: %{public}d", pid, uid); + if (ulsrController_) { + return ulsrController_->AddSyncUlsrCallback(callback); + } +#else + POWER_HILOGI(FEATURE_SUSPEND, "RegisterSyncUlsrCallback interface not supported."); +#endif + return false; +} + +bool PowerMgrService::UnRegisterSyncUlsrCallback(const sptr& callback) +{ +#ifdef POWER_MANAGER_POWER_ENABLE_ULSR + std::lock_guard lock(suspendMutex_); + pid_t pid = IPCSkeleton::GetCallingPid(); + auto uid = IPCSkeleton::GetCallingUid(); + if (!Permission::IsSystem()) { + return false; + } + POWER_HILOGI(FEATURE_SUSPEND, "UnRegisterSyncUlsrCallback, pid: %{public}d, uid: %{public}d", pid, uid); + if (ulsrController_) { + return ulsrController_->RemoveSyncUlsrCallback(callback); + } +#else + POWER_HILOGI(FEATURE_SUSPEND, "UnRegisterSyncUlsrCallback interface not supported."); +#endif + return false; +} + bool PowerMgrService::RegisterPowerModeCallback(const sptr& callback) { std::lock_guard lock(modeMutex_); diff --git a/services/native/src/ulsr/ulsr_controller.cpp b/services/native/src/ulsr/ulsr_controller.cpp new file mode 100644 index 00000000..2baf5a6f --- /dev/null +++ b/services/native/src/ulsr/ulsr_controller.cpp @@ -0,0 +1,91 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include "power_log.h" +#include "power_xcollie.h" +#include "system_suspend_controller.h" +#include "ulsr_controller.h" + + +namespace OHOS { +namespace PowerMgr { +bool UlsrController::AddSyncUlsrCallback(const sptr& cb) +{ + std::lock_guard lock(mutex_); + pid_t pid = IPCSkeleton::GetCallingPid(); + auto uid = IPCSkeleton::GetCallingUid(); + auto ret = callbacks_.emplace(cb, std::make_pair(pid, uid)); + if (!ret.second) { + POWER_HILOGE(FEATURE_SUSPEND, "Add ISyncUlsrCallback cb failed"); + return false; + } + return true; +} + +bool UlsrController::RemoveSyncUlsrCallback(const sptr& cb) +{ + std::lock_guard lock(mutex_); + size_t eraseNum = callbacks_.erase(cb); + if (eraseNum == 0) { + POWER_HILOGE(FEATURE_SUSPEND, "Remove ISyncUlsrCallback cb failed"); + return false; + } + return true; +} + +void UlsrController::NotifyEnteringUlsr() +{ + std::lock_guard lock(mutex_); + if (ulsrState_) { + POWER_HILOGE(FEATURE_SUSPEND, "Already run OnSyncUlsr"); + return; + } + PowerXCollie powerXCollie("UlsrController::NotifyEnteringUlsr", true); + for (auto iter = callbacks_.cbegin(); iter != callbacks_.cend(); ++iter) { + if (iter->first != nullptr) { + auto pidUid = iter->second; + POWER_HILOGI(FEATURE_SUSPEND, "OnSyncUlsr P=%{public}dU=%{public}d", pidUid.first, pidUid.second); + iter->first->OnSyncUlsr(); + } + } + ulsrState_ = true; +} + +void UlsrController::NotifyExitingUlsr() +{ + std::lock_guard lock(mutex_); + if (!ulsrState_) { + POWER_HILOGE(FEATURE_SUSPEND, "OnSyncUlsr not run"); + return; + } + PowerXCollie powerXCollie("UlsrController::NotifyExitingUlsr", true); + for (auto iter = callbacks_.cbegin(); iter != callbacks_.cend(); ++iter) { + if (iter->first != nullptr) { + auto pidUid = iter->second; + POWER_HILOGI(FEATURE_SUSPEND, "OnSyncWakeup P=%{public}dU=%{public}d", pidUid.first, pidUid.second); + iter->first->OnSyncWakeup(); + } + } + ulsrState_ = false; +} + +void UlsrController::SetSuspendTagLocked(const std::string& tag) +{ + SystemSuspendController::GetInstance().SetSuspendTag(tag); +} + +} // namespace PowerMgr +} // namespace OHOS diff --git a/services/native/src/ulsr/ulsr_controller.h b/services/native/src/ulsr/ulsr_controller.h new file mode 100644 index 00000000..790e10d9 --- /dev/null +++ b/services/native/src/ulsr/ulsr_controller.h @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef POWERMGR_POWER_MANAGER_ULSR_CONTROLLER_H +#define POWERMGR_POWER_MANAGER_ULSR_CONTROLLER_H + +#include +#include +#include + +#include "ulsr/isync_ulsr_callback.h" + +namespace OHOS { +namespace PowerMgr { +class UlsrController { +public: + struct UlsrCallbackCompare { + bool operator()(const sptr& lhs, const sptr& rhs) const + { + return lhs->AsObject() < rhs->AsObject(); + } + }; + + using UlsrCallbackContainerType = + std::map, std::pair, UlsrCallbackCompare>; + UlsrController() = default; + virtual ~UlsrController() noexcept = default; + + bool AddSyncUlsrCallback(const sptr& cb); + bool RemoveSyncUlsrCallback(const sptr& cb); + void NotifyEnteringUlsr(); + void NotifyExitingUlsr(); + void SetSuspendTagLocked(const std::string& tag); + +private: + std::mutex mutex_; + bool ulsrState_ {false}; + UlsrCallbackContainerType callbacks_; +}; +} // namespace PowerMgr +} // namespace OHOS + +#endif // POWERMGR_POWER_MANAGER_ULSR_CONTROLLER_H \ No newline at end of file diff --git a/services/zidl/include/power_mgr_proxy.h b/services/zidl/include/power_mgr_proxy.h index 7f75e708..e41434b4 100644 --- a/services/zidl/include/power_mgr_proxy.h +++ b/services/zidl/include/power_mgr_proxy.h @@ -104,6 +104,8 @@ public: virtual bool RegisterSyncHibernateCallback(const sptr& callback) override; virtual bool UnRegisterSyncHibernateCallback(const sptr& callback) override; + virtual bool RegisterSyncUlsrCallback(const sptr& callback) override; + virtual bool UnRegisterSyncUlsrCallback(const sptr& callback) override; virtual bool RegisterSyncSleepCallback(const sptr& callback, SleepPriority priority) override; virtual bool UnRegisterSyncSleepCallback(const sptr& callback) override; virtual PowerErrors IsRunningLockEnabled(const RunningLockType type, bool& result) override; diff --git a/services/zidl/include/power_mgr_stub.h b/services/zidl/include/power_mgr_stub.h index ffdf6551..37d3febe 100644 --- a/services/zidl/include/power_mgr_stub.h +++ b/services/zidl/include/power_mgr_stub.h @@ -62,6 +62,8 @@ private: int32_t RegisterSyncHibernateCallbackStub(MessageParcel& data); int32_t UnRegisterSyncHibernateCallbackStub(MessageParcel& data); + int32_t RegisterSyncUlsrCallbackStub(MessageParcel& data); + int32_t UnRegisterSyncUlsrCallbackStub(MessageParcel& data); int32_t RegisterSyncSleepCallbackStub(MessageParcel& data); int32_t UnRegisterSyncSleepCallbackStub(MessageParcel& data); diff --git a/services/zidl/include/sync_ulsr_callback_proxy.h b/services/zidl/include/sync_ulsr_callback_proxy.h new file mode 100644 index 00000000..602c21a0 --- /dev/null +++ b/services/zidl/include/sync_ulsr_callback_proxy.h @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef POWERMGR_POWER_MANAGER_SYNC_ULSR_CALLBACK_PROXY_H +#define POWERMGR_POWER_MANAGER_SYNC_ULSR_CALLBACK_PROXY_H + +#include +#include +#include +#include +#include +#include "ulsr/isync_ulsr_callback.h" + +namespace OHOS { +namespace PowerMgr { +class SyncUlsrCallbackProxy : public IRemoteProxy { +public: + DISALLOW_COPY_AND_MOVE(PowerMgrProxy); + explicit SyncUlsrCallbackProxy(const sptr& impl) + : IRemoteProxy(impl) {} + virtual ~SyncUlsrCallbackProxy() noexcept = default; + virtual void OnSyncUlsr() override; + virtual void OnSyncWakeup() override; + +private: + static inline BrokerDelegator delegator_; +}; +} // namespace PowerMgr +} // namespace OHOS +#endif // POWERMGR_POWER_MANAGER_SYNC_ULSR_CALLBACK_PROXY_H diff --git a/services/zidl/include/sync_ulsr_callback_stub.h b/services/zidl/include/sync_ulsr_callback_stub.h new file mode 100644 index 00000000..fdab9c54 --- /dev/null +++ b/services/zidl/include/sync_ulsr_callback_stub.h @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef POWERMGR_POWER_MANAGER_SYNC_ULSR_CALLBACK_STUB_H +#define POWERMGR_POWER_MANAGER_SYNC_ULSR_CALLBACK_STUB_H + +#include +#include +#include "ulsr/isync_ulsr_callback.h" + +namespace OHOS { +namespace PowerMgr { +class SyncUlsrCallbackStub : public IRemoteStub { +public: + DISALLOW_COPY_AND_MOVE(SyncUlsrCallbackStub); + SyncUlsrCallbackStub() = default; + virtual ~SyncUlsrCallbackStub() noexcept = default; + + int OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override; + void OnSyncUlsr() override {} + void OnSyncWakeup() override {} + +private: + int32_t OnSyncUlsrStub(MessageParcel& data); + int32_t OnSyncWakeupStub(MessageParcel& data); +}; +} // namespace PowerMgr +} // namespace OHOS +#endif // POWERMGR_POWER_MANAGER_SYNC_ULSR_CALLBACK_STUB_H + diff --git a/services/zidl/src/power_mgr_proxy.cpp b/services/zidl/src/power_mgr_proxy.cpp index 1b118ccf..ce6a7201 100644 --- a/services/zidl/src/power_mgr_proxy.cpp +++ b/services/zidl/src/power_mgr_proxy.cpp @@ -969,6 +969,56 @@ bool PowerMgrProxy::UnRegisterSyncHibernateCallback(const sptr& callback) +{ + sptr remote = Remote(); + RETURN_IF_WITH_RET((remote == nullptr) || (callback == nullptr), false); + + MessageParcel data; + MessageParcel reply; + MessageOption option; + + if (!data.WriteInterfaceToken(PowerMgrProxy::GetDescriptor())) { + POWER_HILOGE(FEATURE_POWER_STATE, "Write descriptor failed"); + return false; + } + + RETURN_IF_WRITE_PARCEL_FAILED_WITH_RET(data, RemoteObject, callback->AsObject(), false); + + int ret = remote->SendRequest( + static_cast(PowerMgr::PowerMgrInterfaceCode::REG_SYNC_ULSR_CALLBACK), data, reply, option); + if (ret != ERR_OK) { + POWER_HILOGE(FEATURE_POWER_STATE, "%{public}s: SendRequest failed with ret=%{public}d", __func__, ret); + return false; + } + return true; +} + +bool PowerMgrProxy::UnRegisterSyncUlsrCallback(const sptr& callback) +{ + sptr remote = Remote(); + RETURN_IF_WITH_RET((remote == nullptr) || (callback == nullptr), false); + + MessageParcel data; + MessageParcel reply; + MessageOption option; + + if (!data.WriteInterfaceToken(PowerMgrProxy::GetDescriptor())) { + POWER_HILOGE(FEATURE_POWER_STATE, "Write descriptor failed"); + return false; + } + + RETURN_IF_WRITE_PARCEL_FAILED_WITH_RET(data, RemoteObject, callback->AsObject(), false); + + int ret = remote->SendRequest( + static_cast(PowerMgr::PowerMgrInterfaceCode::UNREG_SYNC_ULSR_CALLBACK), data, reply, option); + if (ret != ERR_OK) { + POWER_HILOGE(FEATURE_POWER_STATE, "%{public}s: SendRequest failed with ret=%{public}d", __func__, ret); + return false; + } + return true; +} + bool PowerMgrProxy::RegisterPowerModeCallback(const sptr& callback) { sptr remote = Remote(); diff --git a/services/zidl/src/power_mgr_stub.cpp b/services/zidl/src/power_mgr_stub.cpp index 38f1561b..cabf90d5 100644 --- a/services/zidl/src/power_mgr_stub.cpp +++ b/services/zidl/src/power_mgr_stub.cpp @@ -553,6 +553,26 @@ int32_t PowerMgrStub::UnRegisterSyncHibernateCallbackStub(MessageParcel& data) return ERR_OK; } +int32_t PowerMgrStub::RegisterSyncUlsrCallbackStub(MessageParcel& data) +{ + sptr obj = data.ReadRemoteObject(); + RETURN_IF_WITH_RET((obj == nullptr), E_READ_PARCEL_ERROR); + sptr callback = iface_cast(obj); + RETURN_IF_WITH_RET((callback == nullptr), E_READ_PARCEL_ERROR); + RegisterSyncUlsrCallback(callback); + return ERR_OK; +} + +int32_t PowerMgrStub::UnRegisterSyncUlsrCallbackStub(MessageParcel& data) +{ + sptr obj = data.ReadRemoteObject(); + RETURN_IF_WITH_RET((obj == nullptr), E_READ_PARCEL_ERROR); + sptr callback = iface_cast(obj); + RETURN_IF_WITH_RET((callback == nullptr), E_READ_PARCEL_ERROR); + UnRegisterSyncUlsrCallback(callback); + return ERR_OK; +} + int32_t PowerMgrStub::RegisterSyncSleepCallbackStub(MessageParcel& data) { uint32_t priority; diff --git a/services/zidl/src/sync_ulsr_callback_proxy.cpp b/services/zidl/src/sync_ulsr_callback_proxy.cpp new file mode 100644 index 00000000..b01ffb52 --- /dev/null +++ b/services/zidl/src/sync_ulsr_callback_proxy.cpp @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "sync_ulsr_callback_proxy.h" + +#include +#include "errors.h" +#include "message_option.h" +#include "power_common.h" +#include "ulsr/sync_ulsr_callback_ipc_interface_code.h" + +namespace OHOS { +namespace PowerMgr { +void SyncUlsrCallbackProxy::OnSyncUlsr() +{ + sptr remote = Remote(); + RETURN_IF(remote == nullptr); + + MessageParcel data; + MessageParcel reply; + MessageOption option; + + if (!data.WriteInterfaceToken(SyncUlsrCallbackProxy::GetDescriptor())) { + POWER_HILOGE(FEATURE_SUSPEND, "Write descriptor failed"); + return; + } + + int ret = remote->SendRequest( + static_cast(PowerMgr::SyncUlsrCallbackInterfaceCode::CMD_ON_SYNC_ULSR), + data, reply, option); + if (ret != ERR_OK) { + POWER_HILOGE(FEATURE_SUSPEND, "%{public}s: SendRequest failed with ret=%{public}d", __func__, ret); + } +} + +void SyncUlsrCallbackProxy::OnSyncWakeup() +{ + sptr remote = Remote(); + RETURN_IF(remote == nullptr); + + MessageParcel data; + MessageParcel reply; + MessageOption option; + + if (!data.WriteInterfaceToken(SyncUlsrCallbackProxy::GetDescriptor())) { + POWER_HILOGE(FEATURE_POWER_STATE, "Write descriptor failed"); + return; + } + + int ret = remote->SendRequest( + static_cast(PowerMgr::SyncUlsrCallbackInterfaceCode::CMD_ON_SYNC_WAKEUP), + data, reply, option); + if (ret != ERR_OK) { + POWER_HILOGE(FEATURE_SUSPEND, "%{public}s: SendRequest failed with ret=%{public}d", __func__, ret); + } +} +} // namespace PowerMgr +} // namespace OHOS diff --git a/services/zidl/src/sync_ulsr_callback_stub.cpp b/services/zidl/src/sync_ulsr_callback_stub.cpp new file mode 100644 index 00000000..2191dd9f --- /dev/null +++ b/services/zidl/src/sync_ulsr_callback_stub.cpp @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "sync_ulsr_callback_stub.h" + +#include + +#include "power_common.h" +#include "sync_ulsr_callback_proxy.h" +#include "ulsr/sync_ulsr_callback_ipc_interface_code.h" + + +namespace OHOS { +namespace PowerMgr { +int SyncUlsrCallbackStub::OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, + MessageOption &option) +{ + std::u16string descripter = SyncUlsrCallbackStub::GetDescriptor(); + std::u16string remoteDescripter = data.ReadInterfaceToken(); + if (descripter != remoteDescripter) { + POWER_HILOGE(COMP_SVC, "Descriptor is not match"); + return E_GET_POWER_SERVICE_FAILED; + } + + int ret = ERR_OK; + if (code == static_cast(PowerMgr::SyncUlsrCallbackInterfaceCode::CMD_ON_SYNC_ULSR)) { + ret = OnSyncUlsrStub(data); + } else if (code == static_cast(PowerMgr::SyncUlsrCallbackInterfaceCode::CMD_ON_SYNC_WAKEUP)) { + ret = OnSyncWakeupStub(data); + } else { + ret = IPCObjectStub::OnRemoteRequest(code, data, reply, option); + } + return ret; +} + +int32_t SyncUlsrCallbackStub::OnSyncUlsrStub(MessageParcel& data) +{ + OnSyncUlsr(); + return ERR_OK; +} + +int32_t SyncUlsrCallbackStub::OnSyncWakeupStub(MessageParcel& data) +{ + OnSyncWakeup(); + return ERR_OK; +} +} // namespace PowerMgr +} // namespace OHOS -- Gitee From 082360ba9ac7d2b76821c88be5e755088603a55e Mon Sep 17 00:00:00 2001 From: wangyantian Date: Tue, 22 Apr 2025 15:01:17 +0800 Subject: [PATCH 2/2] feat: add test Signed-off-by: wangyantian --- test/apitest/inner_api/shutdown/BUILD.gn | 1 + test/fuzztest/asyncshutdowncallback_fuzzer/BUILD.gn | 1 + test/fuzztest/createrunninglock_fuzzer/BUILD.gn | 1 + test/fuzztest/forcesuspenddevice_fuzzer/BUILD.gn | 1 + test/fuzztest/getsetdevicemode_fuzzer/BUILD.gn | 1 + test/fuzztest/getstate_fuzzer/BUILD.gn | 1 + test/fuzztest/hibernate_fuzzer/BUILD.gn | 1 + test/fuzztest/iscollaborationscreenon_fuzzer/BUILD.gn | 1 + test/fuzztest/isfoldscreenon_fuzzer/BUILD.gn | 1 + test/fuzztest/isrunninglocktypesupported_fuzzer/BUILD.gn | 1 + test/fuzztest/isscreenon_fuzzer/BUILD.gn | 1 + test/fuzztest/isstandby_fuzzer/BUILD.gn | 1 + test/fuzztest/lockscreenaftertimingout_fuzzer/BUILD.gn | 1 + test/fuzztest/lockunlockisused_fuzzer/BUILD.gn | 1 + test/fuzztest/overridescreenofftime_fuzzer/BUILD.gn | 1 + test/fuzztest/powermodecallback_fuzzer/BUILD.gn | 1 + test/fuzztest/powerstatecallback_fuzzer/BUILD.gn | 1 + test/fuzztest/proxyrunninglock_fuzzer/BUILD.gn | 1 + test/fuzztest/proxyrunninglocks_fuzzer/BUILD.gn | 1 + test/fuzztest/queryrunninglocklists_fuzzer/BUILD.gn | 1 + test/fuzztest/rebootdevice_fuzzer/BUILD.gn | 1 + test/fuzztest/refreshactivity_fuzzer/BUILD.gn | 1 + test/fuzztest/releaserunninglock_fuzzer/BUILD.gn | 1 + test/fuzztest/resetrunninglocks_fuzzer/BUILD.gn | 1 + test/fuzztest/runninglockcallback_fuzzer/BUILD.gn | 1 + test/fuzztest/screenstatecallback_fuzzer/BUILD.gn | 1 + test/fuzztest/setdisplaysuspend_fuzzer/BUILD.gn | 1 + test/fuzztest/setforcetimingout_fuzzer/BUILD.gn | 1 + test/fuzztest/setsuspendtag_fuzzer/BUILD.gn | 1 + test/fuzztest/shelldump_fuzzer/BUILD.gn | 1 + test/fuzztest/shutdowndevice_fuzzer/BUILD.gn | 1 + test/fuzztest/suspenddevice_fuzzer/BUILD.gn | 1 + test/fuzztest/synchibernatecallback_fuzzer/BUILD.gn | 1 + test/fuzztest/syncshutdowncallback_fuzzer/BUILD.gn | 1 + test/fuzztest/syncsleepcallback_fuzzer/BUILD.gn | 1 + test/fuzztest/takeovershutdowncallback_fuzzer/BUILD.gn | 1 + test/fuzztest/wakeupdevice_fuzzer/BUILD.gn | 1 + test/systemtest/BUILD.gn | 1 + test/unittest/BUILD.gn | 1 + test/unittest/src/servicetest/BUILD.gn | 1 + 40 files changed, 40 insertions(+) diff --git a/test/apitest/inner_api/shutdown/BUILD.gn b/test/apitest/inner_api/shutdown/BUILD.gn index 874a6a6a..3e38350a 100644 --- a/test/apitest/inner_api/shutdown/BUILD.gn +++ b/test/apitest/inner_api/shutdown/BUILD.gn @@ -31,6 +31,7 @@ config("module_private_config") { "${powermgr_service_path}/native/src/runninglock", "${powermgr_service_path}/native/src/shutdown", "${powermgr_service_path}/native/src/suspend", + "${powermgr_service_path}/native/src/ulsr", "${powermgr_service_path}/native/src/wakeup", "${powermgr_service_path}/native/src/screenoffpre", "${powermgr_test_path}/mock/action", diff --git a/test/fuzztest/asyncshutdowncallback_fuzzer/BUILD.gn b/test/fuzztest/asyncshutdowncallback_fuzzer/BUILD.gn index 55902fc3..b3c3d6d0 100644 --- a/test/fuzztest/asyncshutdowncallback_fuzzer/BUILD.gn +++ b/test/fuzztest/asyncshutdowncallback_fuzzer/BUILD.gn @@ -28,6 +28,7 @@ ohos_fuzztest("AsyncShutdownCallbackFuzzTest") { "${powermgr_service_path}/native/src/runninglock", "${powermgr_service_path}/native/src/shutdown", "${powermgr_service_path}/native/src/suspend", + "${powermgr_service_path}/native/src/ulsr", "${powermgr_service_path}/native/src/wakeup", "${powermgr_service_path}/native/src/screenoffpre", "../power_utils", diff --git a/test/fuzztest/createrunninglock_fuzzer/BUILD.gn b/test/fuzztest/createrunninglock_fuzzer/BUILD.gn index a2f43028..305bc4b7 100644 --- a/test/fuzztest/createrunninglock_fuzzer/BUILD.gn +++ b/test/fuzztest/createrunninglock_fuzzer/BUILD.gn @@ -28,6 +28,7 @@ ohos_fuzztest("CreateRunningLockFuzzTest") { "${powermgr_service_path}/native/src/runninglock", "${powermgr_service_path}/native/src/shutdown", "${powermgr_service_path}/native/src/suspend", + "${powermgr_service_path}/native/src/ulsr", "${powermgr_service_path}/native/src/wakeup", "${powermgr_service_path}/native/src/screenoffpre", "../power_utils", diff --git a/test/fuzztest/forcesuspenddevice_fuzzer/BUILD.gn b/test/fuzztest/forcesuspenddevice_fuzzer/BUILD.gn index d2e95926..33bb3f91 100644 --- a/test/fuzztest/forcesuspenddevice_fuzzer/BUILD.gn +++ b/test/fuzztest/forcesuspenddevice_fuzzer/BUILD.gn @@ -28,6 +28,7 @@ ohos_fuzztest("ForceSuspendDeviceFuzzTest") { "${powermgr_service_path}/native/src/runninglock", "${powermgr_service_path}/native/src/shutdown", "${powermgr_service_path}/native/src/suspend", + "${powermgr_service_path}/native/src/ulsr", "${powermgr_service_path}/native/src/wakeup", "${powermgr_service_path}/native/src/screenoffpre", "../power_utils", diff --git a/test/fuzztest/getsetdevicemode_fuzzer/BUILD.gn b/test/fuzztest/getsetdevicemode_fuzzer/BUILD.gn index 0930fbf7..6d4accd1 100644 --- a/test/fuzztest/getsetdevicemode_fuzzer/BUILD.gn +++ b/test/fuzztest/getsetdevicemode_fuzzer/BUILD.gn @@ -28,6 +28,7 @@ ohos_fuzztest("GetSetDeviceModeFuzzTest") { "${powermgr_service_path}/native/src/runninglock", "${powermgr_service_path}/native/src/shutdown", "${powermgr_service_path}/native/src/suspend", + "${powermgr_service_path}/native/src/ulsr", "${powermgr_service_path}/native/src/wakeup", "${powermgr_service_path}/native/src/screenoffpre", "../power_utils", diff --git a/test/fuzztest/getstate_fuzzer/BUILD.gn b/test/fuzztest/getstate_fuzzer/BUILD.gn index 0a0aa431..d0a34bf8 100644 --- a/test/fuzztest/getstate_fuzzer/BUILD.gn +++ b/test/fuzztest/getstate_fuzzer/BUILD.gn @@ -27,6 +27,7 @@ ohos_fuzztest("GetStateFuzzTest") { "${powermgr_service_path}/native/src/runninglock", "${powermgr_service_path}/native/src/shutdown", "${powermgr_service_path}/native/src/suspend", + "${powermgr_service_path}/native/src/ulsr", "${powermgr_service_path}/native/src/wakeup", "${powermgr_service_path}/native/src/screenoffpre", "../power_utils", diff --git a/test/fuzztest/hibernate_fuzzer/BUILD.gn b/test/fuzztest/hibernate_fuzzer/BUILD.gn index bd603fef..356d3849 100644 --- a/test/fuzztest/hibernate_fuzzer/BUILD.gn +++ b/test/fuzztest/hibernate_fuzzer/BUILD.gn @@ -27,6 +27,7 @@ ohos_fuzztest("HibernateFuzzTest") { "${powermgr_service_path}/native/src/runninglock", "${powermgr_service_path}/native/src/shutdown", "${powermgr_service_path}/native/src/suspend", + "${powermgr_service_path}/native/src/ulsr", "${powermgr_service_path}/native/src/wakeup", "${powermgr_service_path}/native/src/screenoffpre", "../power_utils", diff --git a/test/fuzztest/iscollaborationscreenon_fuzzer/BUILD.gn b/test/fuzztest/iscollaborationscreenon_fuzzer/BUILD.gn index 1e9e2858..8b6494d8 100644 --- a/test/fuzztest/iscollaborationscreenon_fuzzer/BUILD.gn +++ b/test/fuzztest/iscollaborationscreenon_fuzzer/BUILD.gn @@ -28,6 +28,7 @@ ohos_fuzztest("IsCollaborationScreenOnFuzzTest") { "${powermgr_service_path}/native/src/runninglock", "${powermgr_service_path}/native/src/shutdown", "${powermgr_service_path}/native/src/suspend", + "${powermgr_service_path}/native/src/ulsr", "${powermgr_service_path}/native/src/wakeup", "${powermgr_service_path}/native/src/screenoffpre", "../power_utils", diff --git a/test/fuzztest/isfoldscreenon_fuzzer/BUILD.gn b/test/fuzztest/isfoldscreenon_fuzzer/BUILD.gn index 61057ee3..4fac83ac 100644 --- a/test/fuzztest/isfoldscreenon_fuzzer/BUILD.gn +++ b/test/fuzztest/isfoldscreenon_fuzzer/BUILD.gn @@ -27,6 +27,7 @@ ohos_fuzztest("IsFoldScreenOnFuzzTest") { "${powermgr_service_path}/native/src/runninglock", "${powermgr_service_path}/native/src/shutdown", "${powermgr_service_path}/native/src/suspend", + "${powermgr_service_path}/native/src/ulsr", "${powermgr_service_path}/native/src/wakeup", "${powermgr_service_path}/native/src/screenoffpre", "../power_utils", diff --git a/test/fuzztest/isrunninglocktypesupported_fuzzer/BUILD.gn b/test/fuzztest/isrunninglocktypesupported_fuzzer/BUILD.gn index 89c45974..72de069a 100644 --- a/test/fuzztest/isrunninglocktypesupported_fuzzer/BUILD.gn +++ b/test/fuzztest/isrunninglocktypesupported_fuzzer/BUILD.gn @@ -28,6 +28,7 @@ ohos_fuzztest("IsRunningLockTypeSupportedFuzzTest") { "${powermgr_service_path}/native/src/runninglock", "${powermgr_service_path}/native/src/shutdown", "${powermgr_service_path}/native/src/suspend", + "${powermgr_service_path}/native/src/ulsr", "${powermgr_service_path}/native/src/wakeup", "${powermgr_service_path}/native/src/screenoffpre", "../power_utils", diff --git a/test/fuzztest/isscreenon_fuzzer/BUILD.gn b/test/fuzztest/isscreenon_fuzzer/BUILD.gn index 6f36e4b7..aa722dbd 100644 --- a/test/fuzztest/isscreenon_fuzzer/BUILD.gn +++ b/test/fuzztest/isscreenon_fuzzer/BUILD.gn @@ -27,6 +27,7 @@ ohos_fuzztest("IsScreenOnFuzzTest") { "${powermgr_service_path}/native/src/runninglock", "${powermgr_service_path}/native/src/shutdown", "${powermgr_service_path}/native/src/suspend", + "${powermgr_service_path}/native/src/ulsr", "${powermgr_service_path}/native/src/wakeup", "${powermgr_service_path}/native/src/screenoffpre", "../power_utils", diff --git a/test/fuzztest/isstandby_fuzzer/BUILD.gn b/test/fuzztest/isstandby_fuzzer/BUILD.gn index 0edfac90..ab9c7a47 100644 --- a/test/fuzztest/isstandby_fuzzer/BUILD.gn +++ b/test/fuzztest/isstandby_fuzzer/BUILD.gn @@ -27,6 +27,7 @@ ohos_fuzztest("IsStandbyFuzzTest") { "${powermgr_service_path}/native/src/runninglock", "${powermgr_service_path}/native/src/shutdown", "${powermgr_service_path}/native/src/suspend", + "${powermgr_service_path}/native/src/ulsr", "${powermgr_service_path}/native/src/wakeup", "${powermgr_service_path}/native/src/screenoffpre", "../power_utils", diff --git a/test/fuzztest/lockscreenaftertimingout_fuzzer/BUILD.gn b/test/fuzztest/lockscreenaftertimingout_fuzzer/BUILD.gn index f1a7e208..072ae92d 100644 --- a/test/fuzztest/lockscreenaftertimingout_fuzzer/BUILD.gn +++ b/test/fuzztest/lockscreenaftertimingout_fuzzer/BUILD.gn @@ -28,6 +28,7 @@ ohos_fuzztest("LockScreenAfterTimingOutFuzzTest") { "${powermgr_service_path}/native/src/runninglock", "${powermgr_service_path}/native/src/shutdown", "${powermgr_service_path}/native/src/suspend", + "${powermgr_service_path}/native/src/ulsr", "${powermgr_service_path}/native/src/wakeup", "${powermgr_service_path}/native/src/screenoffpre", "../power_utils", diff --git a/test/fuzztest/lockunlockisused_fuzzer/BUILD.gn b/test/fuzztest/lockunlockisused_fuzzer/BUILD.gn index 5c531e82..d0812027 100644 --- a/test/fuzztest/lockunlockisused_fuzzer/BUILD.gn +++ b/test/fuzztest/lockunlockisused_fuzzer/BUILD.gn @@ -28,6 +28,7 @@ ohos_fuzztest("LockUnLockIsUsedFuzzTest") { "${powermgr_service_path}/native/src/runninglock", "${powermgr_service_path}/native/src/shutdown", "${powermgr_service_path}/native/src/suspend", + "${powermgr_service_path}/native/src/ulsr", "${powermgr_service_path}/native/src/wakeup", "${powermgr_service_path}/native/src/screenoffpre", "../power_utils", diff --git a/test/fuzztest/overridescreenofftime_fuzzer/BUILD.gn b/test/fuzztest/overridescreenofftime_fuzzer/BUILD.gn index 9bb12af3..9b63e4d5 100644 --- a/test/fuzztest/overridescreenofftime_fuzzer/BUILD.gn +++ b/test/fuzztest/overridescreenofftime_fuzzer/BUILD.gn @@ -28,6 +28,7 @@ ohos_fuzztest("OverrideScreenOffTimeFuzzTest") { "${powermgr_service_path}/native/src/runninglock", "${powermgr_service_path}/native/src/shutdown", "${powermgr_service_path}/native/src/suspend", + "${powermgr_service_path}/native/src/ulsr", "${powermgr_service_path}/native/src/wakeup", "${powermgr_service_path}/native/src/screenoffpre", "../power_utils", diff --git a/test/fuzztest/powermodecallback_fuzzer/BUILD.gn b/test/fuzztest/powermodecallback_fuzzer/BUILD.gn index e0bc0aec..0f8ba4d3 100644 --- a/test/fuzztest/powermodecallback_fuzzer/BUILD.gn +++ b/test/fuzztest/powermodecallback_fuzzer/BUILD.gn @@ -28,6 +28,7 @@ ohos_fuzztest("PowerModeCallbackFuzzTest") { "${powermgr_service_path}/native/src/runninglock", "${powermgr_service_path}/native/src/shutdown", "${powermgr_service_path}/native/src/suspend", + "${powermgr_service_path}/native/src/ulsr", "${powermgr_service_path}/native/src/wakeup", "${powermgr_service_path}/native/src/screenoffpre", "../power_utils", diff --git a/test/fuzztest/powerstatecallback_fuzzer/BUILD.gn b/test/fuzztest/powerstatecallback_fuzzer/BUILD.gn index 1b73f0b7..1a69d18c 100644 --- a/test/fuzztest/powerstatecallback_fuzzer/BUILD.gn +++ b/test/fuzztest/powerstatecallback_fuzzer/BUILD.gn @@ -28,6 +28,7 @@ ohos_fuzztest("PowerStateCallbackFuzzTest") { "${powermgr_service_path}/native/src/runninglock", "${powermgr_service_path}/native/src/shutdown", "${powermgr_service_path}/native/src/suspend", + "${powermgr_service_path}/native/src/ulsr", "${powermgr_service_path}/native/src/wakeup", "${powermgr_service_path}/native/src/screenoffpre", "../power_utils", diff --git a/test/fuzztest/proxyrunninglock_fuzzer/BUILD.gn b/test/fuzztest/proxyrunninglock_fuzzer/BUILD.gn index 67f63a44..abb1605b 100644 --- a/test/fuzztest/proxyrunninglock_fuzzer/BUILD.gn +++ b/test/fuzztest/proxyrunninglock_fuzzer/BUILD.gn @@ -28,6 +28,7 @@ ohos_fuzztest("ProxyRunningLockFuzzTest") { "${powermgr_service_path}/native/src/runninglock", "${powermgr_service_path}/native/src/shutdown", "${powermgr_service_path}/native/src/suspend", + "${powermgr_service_path}/native/src/ulsr", "${powermgr_service_path}/native/src/wakeup", "${powermgr_service_path}/native/src/screenoffpre", "../power_utils", diff --git a/test/fuzztest/proxyrunninglocks_fuzzer/BUILD.gn b/test/fuzztest/proxyrunninglocks_fuzzer/BUILD.gn index 4b8315cd..c1e4e3ee 100644 --- a/test/fuzztest/proxyrunninglocks_fuzzer/BUILD.gn +++ b/test/fuzztest/proxyrunninglocks_fuzzer/BUILD.gn @@ -28,6 +28,7 @@ ohos_fuzztest("ProxyRunningLocksFuzzTest") { "${powermgr_service_path}/native/src/runninglock", "${powermgr_service_path}/native/src/shutdown", "${powermgr_service_path}/native/src/suspend", + "${powermgr_service_path}/native/src/ulsr", "${powermgr_service_path}/native/src/wakeup", "${powermgr_service_path}/native/src/screenoffpre", "../power_utils", diff --git a/test/fuzztest/queryrunninglocklists_fuzzer/BUILD.gn b/test/fuzztest/queryrunninglocklists_fuzzer/BUILD.gn index aa0854d8..d9d8c114 100644 --- a/test/fuzztest/queryrunninglocklists_fuzzer/BUILD.gn +++ b/test/fuzztest/queryrunninglocklists_fuzzer/BUILD.gn @@ -28,6 +28,7 @@ ohos_fuzztest("QueryRunningLockListsFuzzTest") { "${powermgr_service_path}/native/src/runninglock", "${powermgr_service_path}/native/src/shutdown", "${powermgr_service_path}/native/src/suspend", + "${powermgr_service_path}/native/src/ulsr", "${powermgr_service_path}/native/src/wakeup", "${powermgr_service_path}/native/src/screenoffpre", "../power_utils", diff --git a/test/fuzztest/rebootdevice_fuzzer/BUILD.gn b/test/fuzztest/rebootdevice_fuzzer/BUILD.gn index e90fb0b1..5ec58e95 100644 --- a/test/fuzztest/rebootdevice_fuzzer/BUILD.gn +++ b/test/fuzztest/rebootdevice_fuzzer/BUILD.gn @@ -27,6 +27,7 @@ ohos_fuzztest("RebootDeviceFuzzTest") { "${powermgr_service_path}/native/src/runninglock", "${powermgr_service_path}/native/src/shutdown", "${powermgr_service_path}/native/src/suspend", + "${powermgr_service_path}/native/src/ulsr", "${powermgr_service_path}/native/src/wakeup", "${powermgr_service_path}/native/src/screenoffpre", "../power_utils", diff --git a/test/fuzztest/refreshactivity_fuzzer/BUILD.gn b/test/fuzztest/refreshactivity_fuzzer/BUILD.gn index d9b23f89..ad7159bc 100644 --- a/test/fuzztest/refreshactivity_fuzzer/BUILD.gn +++ b/test/fuzztest/refreshactivity_fuzzer/BUILD.gn @@ -28,6 +28,7 @@ ohos_fuzztest("RefreshActivityFuzzTest") { "${powermgr_service_path}/native/src/runninglock", "${powermgr_service_path}/native/src/shutdown", "${powermgr_service_path}/native/src/suspend", + "${powermgr_service_path}/native/src/ulsr", "${powermgr_service_path}/native/src/wakeup", "${powermgr_service_path}/native/src/screenoffpre", "../power_utils", diff --git a/test/fuzztest/releaserunninglock_fuzzer/BUILD.gn b/test/fuzztest/releaserunninglock_fuzzer/BUILD.gn index 8fee4eaf..c9506b72 100644 --- a/test/fuzztest/releaserunninglock_fuzzer/BUILD.gn +++ b/test/fuzztest/releaserunninglock_fuzzer/BUILD.gn @@ -28,6 +28,7 @@ ohos_fuzztest("ReleaseRunningLockFuzzTest") { "${powermgr_service_path}/native/src/runninglock", "${powermgr_service_path}/native/src/shutdown", "${powermgr_service_path}/native/src/suspend", + "${powermgr_service_path}/native/src/ulsr", "${powermgr_service_path}/native/src/wakeup", "${powermgr_service_path}/native/src/screenoffpre", "../power_utils", diff --git a/test/fuzztest/resetrunninglocks_fuzzer/BUILD.gn b/test/fuzztest/resetrunninglocks_fuzzer/BUILD.gn index d329905d..72786c91 100644 --- a/test/fuzztest/resetrunninglocks_fuzzer/BUILD.gn +++ b/test/fuzztest/resetrunninglocks_fuzzer/BUILD.gn @@ -28,6 +28,7 @@ ohos_fuzztest("ResetRunningLocksFuzzTest") { "${powermgr_service_path}/native/src/runninglock", "${powermgr_service_path}/native/src/shutdown", "${powermgr_service_path}/native/src/suspend", + "${powermgr_service_path}/native/src/ulsr", "${powermgr_service_path}/native/src/wakeup", "${powermgr_service_path}/native/src/screenoffpre", "../power_utils", diff --git a/test/fuzztest/runninglockcallback_fuzzer/BUILD.gn b/test/fuzztest/runninglockcallback_fuzzer/BUILD.gn index c88e2406..ee6c1501 100644 --- a/test/fuzztest/runninglockcallback_fuzzer/BUILD.gn +++ b/test/fuzztest/runninglockcallback_fuzzer/BUILD.gn @@ -28,6 +28,7 @@ ohos_fuzztest("RunningLockCallbackFuzzTest") { "${powermgr_service_path}/native/src/runninglock", "${powermgr_service_path}/native/src/shutdown", "${powermgr_service_path}/native/src/suspend", + "${powermgr_service_path}/native/src/ulsr", "${powermgr_service_path}/native/src/wakeup", "${powermgr_service_path}/native/src/screenoffpre", "../power_utils", diff --git a/test/fuzztest/screenstatecallback_fuzzer/BUILD.gn b/test/fuzztest/screenstatecallback_fuzzer/BUILD.gn index 2be27e9a..26619511 100644 --- a/test/fuzztest/screenstatecallback_fuzzer/BUILD.gn +++ b/test/fuzztest/screenstatecallback_fuzzer/BUILD.gn @@ -28,6 +28,7 @@ ohos_fuzztest("ScreenStateCallbackFuzzTest") { "${powermgr_service_path}/native/src/runninglock", "${powermgr_service_path}/native/src/shutdown", "${powermgr_service_path}/native/src/suspend", + "${powermgr_service_path}/native/src/ulsr", "${powermgr_service_path}/native/src/wakeup", "${powermgr_service_path}/native/src/screenoffpre", "../power_utils", diff --git a/test/fuzztest/setdisplaysuspend_fuzzer/BUILD.gn b/test/fuzztest/setdisplaysuspend_fuzzer/BUILD.gn index 70ccb8eb..dd752225 100644 --- a/test/fuzztest/setdisplaysuspend_fuzzer/BUILD.gn +++ b/test/fuzztest/setdisplaysuspend_fuzzer/BUILD.gn @@ -28,6 +28,7 @@ ohos_fuzztest("SetDisplaySuspendFuzzTest") { "${powermgr_service_path}/native/src/runninglock", "${powermgr_service_path}/native/src/shutdown", "${powermgr_service_path}/native/src/suspend", + "${powermgr_service_path}/native/src/ulsr", "${powermgr_service_path}/native/src/wakeup", "${powermgr_service_path}/native/src/screenoffpre", "../power_utils", diff --git a/test/fuzztest/setforcetimingout_fuzzer/BUILD.gn b/test/fuzztest/setforcetimingout_fuzzer/BUILD.gn index 32d741ae..5a3ca8d9 100644 --- a/test/fuzztest/setforcetimingout_fuzzer/BUILD.gn +++ b/test/fuzztest/setforcetimingout_fuzzer/BUILD.gn @@ -28,6 +28,7 @@ ohos_fuzztest("SetForceTimingOutFuzzTest") { "${powermgr_service_path}/native/src/runninglock", "${powermgr_service_path}/native/src/shutdown", "${powermgr_service_path}/native/src/suspend", + "${powermgr_service_path}/native/src/ulsr", "${powermgr_service_path}/native/src/wakeup", "${powermgr_service_path}/native/src/screenoffpre", "../power_utils", diff --git a/test/fuzztest/setsuspendtag_fuzzer/BUILD.gn b/test/fuzztest/setsuspendtag_fuzzer/BUILD.gn index 8d49e924..0799d272 100644 --- a/test/fuzztest/setsuspendtag_fuzzer/BUILD.gn +++ b/test/fuzztest/setsuspendtag_fuzzer/BUILD.gn @@ -27,6 +27,7 @@ ohos_fuzztest("SetSuspendTagFuzzTest") { "${powermgr_service_path}/native/src/runninglock", "${powermgr_service_path}/native/src/shutdown", "${powermgr_service_path}/native/src/suspend", + "${powermgr_service_path}/native/src/ulsr", "${powermgr_service_path}/native/src/wakeup", "${powermgr_service_path}/native/src/screenoffpre", "../power_utils", diff --git a/test/fuzztest/shelldump_fuzzer/BUILD.gn b/test/fuzztest/shelldump_fuzzer/BUILD.gn index 8993e976..f9893259 100644 --- a/test/fuzztest/shelldump_fuzzer/BUILD.gn +++ b/test/fuzztest/shelldump_fuzzer/BUILD.gn @@ -27,6 +27,7 @@ ohos_fuzztest("ShellDumpFuzzTest") { "${powermgr_service_path}/native/src/runninglock", "${powermgr_service_path}/native/src/shutdown", "${powermgr_service_path}/native/src/suspend", + "${powermgr_service_path}/native/src/ulsr", "${powermgr_service_path}/native/src/wakeup", "${powermgr_service_path}/native/src/screenoffpre", "../power_utils", diff --git a/test/fuzztest/shutdowndevice_fuzzer/BUILD.gn b/test/fuzztest/shutdowndevice_fuzzer/BUILD.gn index 564985c3..a186fbad 100644 --- a/test/fuzztest/shutdowndevice_fuzzer/BUILD.gn +++ b/test/fuzztest/shutdowndevice_fuzzer/BUILD.gn @@ -27,6 +27,7 @@ ohos_fuzztest("ShutDownDeviceFuzzTest") { "${powermgr_service_path}/native/src/runninglock", "${powermgr_service_path}/native/src/shutdown", "${powermgr_service_path}/native/src/suspend", + "${powermgr_service_path}/native/src/ulsr", "${powermgr_service_path}/native/src/wakeup", "${powermgr_service_path}/native/src/screenoffpre", "../power_utils", diff --git a/test/fuzztest/suspenddevice_fuzzer/BUILD.gn b/test/fuzztest/suspenddevice_fuzzer/BUILD.gn index cc5b61b6..ac7e8e53 100644 --- a/test/fuzztest/suspenddevice_fuzzer/BUILD.gn +++ b/test/fuzztest/suspenddevice_fuzzer/BUILD.gn @@ -27,6 +27,7 @@ ohos_fuzztest("SuspendDeviceFuzzTest") { "${powermgr_service_path}/native/src/runninglock", "${powermgr_service_path}/native/src/shutdown", "${powermgr_service_path}/native/src/suspend", + "${powermgr_service_path}/native/src/ulsr", "${powermgr_service_path}/native/src/wakeup", "${powermgr_service_path}/native/src/screenoffpre", "../power_utils", diff --git a/test/fuzztest/synchibernatecallback_fuzzer/BUILD.gn b/test/fuzztest/synchibernatecallback_fuzzer/BUILD.gn index e7f52f97..8975755e 100644 --- a/test/fuzztest/synchibernatecallback_fuzzer/BUILD.gn +++ b/test/fuzztest/synchibernatecallback_fuzzer/BUILD.gn @@ -28,6 +28,7 @@ ohos_fuzztest("SyncHibernateCallbackFuzzTest") { "${powermgr_service_path}/native/src/runninglock", "${powermgr_service_path}/native/src/shutdown", "${powermgr_service_path}/native/src/suspend", + "${powermgr_service_path}/native/src/ulsr", "${powermgr_service_path}/native/src/wakeup", "${powermgr_service_path}/native/src/screenoffpre", "../power_utils", diff --git a/test/fuzztest/syncshutdowncallback_fuzzer/BUILD.gn b/test/fuzztest/syncshutdowncallback_fuzzer/BUILD.gn index a7ff865e..3b80deac 100644 --- a/test/fuzztest/syncshutdowncallback_fuzzer/BUILD.gn +++ b/test/fuzztest/syncshutdowncallback_fuzzer/BUILD.gn @@ -28,6 +28,7 @@ ohos_fuzztest("SyncShutdownCallbackFuzzTest") { "${powermgr_service_path}/native/src/runninglock", "${powermgr_service_path}/native/src/shutdown", "${powermgr_service_path}/native/src/suspend", + "${powermgr_service_path}/native/src/ulsr", "${powermgr_service_path}/native/src/wakeup", "${powermgr_service_path}/native/src/screenoffpre", "../power_utils", diff --git a/test/fuzztest/syncsleepcallback_fuzzer/BUILD.gn b/test/fuzztest/syncsleepcallback_fuzzer/BUILD.gn index 6ba9e783..27cf6943 100644 --- a/test/fuzztest/syncsleepcallback_fuzzer/BUILD.gn +++ b/test/fuzztest/syncsleepcallback_fuzzer/BUILD.gn @@ -28,6 +28,7 @@ ohos_fuzztest("SyncSleepCallbackFuzzTest") { "${powermgr_service_path}/native/src/runninglock", "${powermgr_service_path}/native/src/shutdown", "${powermgr_service_path}/native/src/suspend", + "${powermgr_service_path}/native/src/ulsr", "${powermgr_service_path}/native/src/wakeup", "${powermgr_service_path}/native/src/screenoffpre", "../power_utils", diff --git a/test/fuzztest/takeovershutdowncallback_fuzzer/BUILD.gn b/test/fuzztest/takeovershutdowncallback_fuzzer/BUILD.gn index 6f186dec..e6a8c75e 100644 --- a/test/fuzztest/takeovershutdowncallback_fuzzer/BUILD.gn +++ b/test/fuzztest/takeovershutdowncallback_fuzzer/BUILD.gn @@ -28,6 +28,7 @@ ohos_fuzztest("TakeOverShutdownCallbackFuzzTest") { "${powermgr_service_path}/native/src/runninglock", "${powermgr_service_path}/native/src/shutdown", "${powermgr_service_path}/native/src/suspend", + "${powermgr_service_path}/native/src/ulsr", "${powermgr_service_path}/native/src/wakeup", "${powermgr_service_path}/native/src/screenoffpre", "../power_utils", diff --git a/test/fuzztest/wakeupdevice_fuzzer/BUILD.gn b/test/fuzztest/wakeupdevice_fuzzer/BUILD.gn index 644a650f..2c3030c7 100644 --- a/test/fuzztest/wakeupdevice_fuzzer/BUILD.gn +++ b/test/fuzztest/wakeupdevice_fuzzer/BUILD.gn @@ -27,6 +27,7 @@ ohos_fuzztest("WakeupDeviceFuzzTest") { "${powermgr_service_path}/native/src/runninglock", "${powermgr_service_path}/native/src/shutdown", "${powermgr_service_path}/native/src/suspend", + "${powermgr_service_path}/native/src/ulsr", "${powermgr_service_path}/native/src/wakeup", "${powermgr_service_path}/native/src/screenoffpre", "../power_utils", diff --git a/test/systemtest/BUILD.gn b/test/systemtest/BUILD.gn index 963d52bb..46eb74f9 100644 --- a/test/systemtest/BUILD.gn +++ b/test/systemtest/BUILD.gn @@ -28,6 +28,7 @@ config("module_private_config") { "${powermgr_service_path}/native/src/runninglock", "${powermgr_service_path}/native/src/shutdown", "${powermgr_service_path}/native/src/suspend", + "${powermgr_service_path}/native/src/ulsr", "${powermgr_service_path}/native/src/wakeup", "${powermgr_service_path}/native/src/screenoffpre", ] diff --git a/test/unittest/BUILD.gn b/test/unittest/BUILD.gn index 15b113f4..ac656423 100644 --- a/test/unittest/BUILD.gn +++ b/test/unittest/BUILD.gn @@ -38,6 +38,7 @@ config("module_private_config") { "${powermgr_service_path}/native/src/runninglock", "${powermgr_service_path}/native/src/shutdown", "${powermgr_service_path}/native/src/suspend", + "${powermgr_service_path}/native/src/ulsr", "${powermgr_service_path}/native/src/wakeup", "${powermgr_service_path}/native/src/screenoffpre", "${powermgr_test_path}/mock/action", diff --git a/test/unittest/src/servicetest/BUILD.gn b/test/unittest/src/servicetest/BUILD.gn index 40c80aa6..a59ae669 100644 --- a/test/unittest/src/servicetest/BUILD.gn +++ b/test/unittest/src/servicetest/BUILD.gn @@ -28,6 +28,7 @@ config("module_private_config") { "${powermgr_service_path}/native/src/runninglock", "${powermgr_service_path}/native/src/shutdown", "${powermgr_service_path}/native/src/suspend", + "${powermgr_service_path}/native/src/ulsr", "${powermgr_service_path}/native/src/wakeup", "${powermgr_service_path}/native/src/screenoffpre", "${powermgr_root_path}/test/unittest/include", -- Gitee