diff --git a/bundle.json b/bundle.json index 56af83c360e4363ef94f882cb48c1a8da7d37fc8..e7cf3cc1956dd041cb9ec7ab9d22f8960af0c37d 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 5a26099a49d7ae10eb313a7d8f28f7f34879390a..9af81d1664f3221942203da22d17100421f97980 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 3f728c63a0e6a9aa932bd2c70b999413c21bd698..7c5bdfd117a1ea74c7828c8b7abfc20ba82164cf 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 a29135e13552d3ca18b2846f03a04e8ad2770726..8e3142f89c1c1ae29959e891dfd0b0a44454ee8b 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 8c508d842ec04dab29d83d6ddf5f27456875394e..8d2315bf5a1619103456204559962158caf3ede2 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 0000000000000000000000000000000000000000..1c7be9a363e77dd70c6a25552d55cd494654e56e --- /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 0000000000000000000000000000000000000000..e85ef153649f1f865840d5dee171c949fc26c7dc --- /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 374bd1889ad5bb17c766ccc3d208e1fba0ae5412..9873d75939d45147dedef270d589abeea4d23a66 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 6c283dd3950540c23d5f4e7386dca84b9d6d3e6f..6de1b8fa0cc5bdd0d0a0a314208f652702f10a2f 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 5cbdf15e32354e7151681186cf17d15a1bd79205..70b1ba1ae87cdeaf4cd364809e93c9632d5614ef 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 1a378b3cda27b213cf82440648b693dc468c5c2a..781d7e0474e874c7d0d5991b0ce4af6ce6440f03 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 0000000000000000000000000000000000000000..2baf5a6f6f5a7666ee5b78b4a25fc6c5de4b03e3 --- /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 0000000000000000000000000000000000000000..790e10d956f1011a30ac6bfb60d7c708b3fbaf72 --- /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 7f75e708cacf2cf86ad84f52e6a0b72b34ede953..e41434b47f60da0a45e60862579c2a6bfe9157ed 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 ffdf6551ed47dd82f2c6e34e5b17acc8e756f938..37d3febe82099065b86a01c40036be4f6cc8f412 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 0000000000000000000000000000000000000000..602c21a060b10e84df56e9929348e58ec88d764c --- /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 0000000000000000000000000000000000000000..fdab9c54b901dc616a9886d3d0a5b94a1b24e496 --- /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 1b118ccf4c701dcef8b48ca083c159973027cfe3..ce6a720104a46785035b6fef683fcc6752296fe1 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 38f1561b9c7db7db2e75071711bbfda3641b68b3..cabf90d544d78db3dd0e3610c86b1e1e6de42b4e 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 0000000000000000000000000000000000000000..b01ffb5254e0ef9de69f7c995bb1475f98067266 --- /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 0000000000000000000000000000000000000000..2191dd9f61baa8b51bd41c154d3104dc7047689d --- /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 diff --git a/test/apitest/inner_api/shutdown/BUILD.gn b/test/apitest/inner_api/shutdown/BUILD.gn index 874a6a6aa6d20d170f0feda13028780957258cbf..3e38350aaf02e8fe50d49acb2912087f24f81fb6 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 55902fc3b7018816377e64e4aa8a67658701098c..b3c3d6d0584ef6f4a5752a10a863309d8e400b85 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 a2f43028eb2be534f3cca6a303940b04b3062844..305bc4b7c0a3807a2115b3354e3711c14b0397ac 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 d2e9592668ce0d66711a3296fc8ddde089376049..33bb3f91b182677ab4ecf6cde1368b338bbbdc71 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 0930fbf77e87f7538155973924fc39fb173d8956..6d4accd178e6735d07f8a2a3ad6a6fa9d8b1b8ba 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 0a0aa4313553f22017f96ea9b06af12654afc96b..d0a34bf83aa852659959d309b009eac9548b0928 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 bd603fef8b0f750c8b42cca4397cc07fc3cd5a8f..356d3849292a0209baf843164e9ff7a9f4ae5aec 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 1e9e285801145756bef480a6056cc0297d2edad6..8b6494d81089b51c56b5df7f75a189bf1ff4cbf4 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 61057ee3f09292c60cef4a1b07f9664f1027d870..4fac83ac437cfa39dc3069d531aeb7d861f5b415 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 89c4597495f685f705019e7785ef3830cd174518..72de069ae27da5c1452c3a4a8aa7b2b94ae9b15e 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 6f36e4b742a7bc9409a2b1f6e9e961fb8ac36ea9..aa722dbdb5d72170713b9b408c62d09148f69ac3 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 0edfac90572e4c038470691e95bc90f9f14714c2..ab9c7a47e02fc49da76aa9f87e9d18a4c3a88a83 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 f1a7e2088cbd8be3df3a40ad1564f39234a096f1..072ae92d0a5e42da972433c0f5dd8a48af41428c 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 5c531e82f101dd512c45648b379b7c518833a053..d081202776f76f65215aff07824025fd59b956d3 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 9bb12af3f78ef5871dbf3e31ae4bc04a5190da92..9b63e4d595a2e4b0d529e24911b1ae3e3db7aaa6 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 e0bc0aec4083ba6654a1ad0be5ed4d61e09fb877..0f8ba4d37cf4712c316a2fc08f455758a5edab58 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 1b73f0b7b50ab738b7259a3619ab92d0efaf65be..1a69d18ceca6959efb6cff12b0782d3f43b60885 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 67f63a44e73eb2b481a972c7ccaa8a4e8969234c..abb1605ba02ca88e79b3a6c269ea17c50f3127c8 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 4b8315cddcf4ecf600835442aa3cc94a93fd141c..c1e4e3ee239968020bf198d68a4bcec0bb67e220 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 aa0854d8edbc11435604392ac1860f36b323857f..d9d8c114f2db354f6d96893325b934acd4854b08 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 e90fb0b100159597d42b84d9f1ec28cd78bcd064..5ec58e9589c135807383d7cb4a0d7b9897cc7423 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 d9b23f89a53d84aaa1b9e18ef7ba0962dce8a065..ad7159bc4190b30fe436382cd08ae4f9e45ca1f9 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 8fee4eaf7c6abb9864a5abca76c7150808ff4620..c9506b724e9c1c5e9c34f23d23d7d86914a28604 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 d329905d65967a5f0fe07a71ad8ce8383e45d4a1..72786c91116dc1b4fa9d8de3a07c0ee23824393d 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 c88e240671d8a1574fab439d2041b25afa5ccc34..ee6c1501c25f796d35eb27e4ab14be4eff595f81 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 2be27e9a242a2c6b0a61831ab70b47ca6e2dbcbd..26619511086b70a5eaab4d68a80b7404149c5a79 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 70ccb8eb393d96f68d6ebd8173036de95fb90f19..dd752225adb5d69041b62679fd4b82e59537e930 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 32d741ae971bab0f7c473b0b2dcf93a691dc43bf..5a3ca8d9319737afc7f8e0e7ae68403f8a9a13b2 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 8d49e9248cbf94d2408d8d39bb4b588eb94e370c..0799d272f72e1ae44f2f9ce53fc9644e7a43fba2 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 8993e97619a2b823f81922879663041eac8d74b6..f989325974d0bbe6e040e95c18096929baa39977 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 564985c3474efcd123378335850da76924ee8020..a186fbad59b80c66212f385b9fb30139f8722e5b 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 cc5b61b6eba2f3c6a8a92ab79204a78291108537..ac7e8e533af859388c526d3c6c8a239fccec4106 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 e7f52f972fa46a1ef3ec602a6e727cf311c5c072..8975755e9e87381580d04aa682f3c95deb2f4a4f 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 a7ff865e14a5a96c1b47003f345a89aa38a2554b..3b80deac67d6af8637c20c506d3f11069b5a46fb 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 6ba9e783cc958e6f4e92005cffb26dafe4783c90..27cf69437fbc2ff2746cdf3a15ffa00482ecd8b1 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 6f186decf92fc41553a262cb5746968ca652efcd..e6a8c75e5909eb89ef4f6749a6642b523a340758 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 644a650f7acfd1717699b39a3bfeb9522ce35cfe..2c3030c7757694c3c989661fef5fa5e73f807a1e 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 963d52bbd4d068c3feddc64ac694d1869a4ffc6f..46eb74f9b70746494b8519fda0a142a5fd6a68ab 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 15b113f4f6824972e1fec2124bb3e6f0a34f5515..ac656423c46b01e897e98e4dd1d7eac18a0fa59c 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 40c80aa6ea8087df9d987d00fad24b20f984f422..a59ae669c0dc74f1668709585cf22ac491b2a065 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",