From ed2b36f913ea43828a00b9fae348c96e226124b9 Mon Sep 17 00:00:00 2001 From: zhushuanghong Date: Fri, 8 Aug 2025 17:09:40 +0800 Subject: [PATCH] =?UTF-8?q?FUZZ=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhushuanghong --- services/native/include/work_conn_manager.h | 6 +++--- services/native/src/work_conn_manager.cpp | 6 +++--- .../workschedulerstartwork_fuzzer.cpp | 4 ++++ 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/services/native/include/work_conn_manager.h b/services/native/include/work_conn_manager.h index 7cb1a51..80e6874 100644 --- a/services/native/include/work_conn_manager.h +++ b/services/native/include/work_conn_manager.h @@ -53,9 +53,9 @@ public: void WriteStartWorkEvent(std::shared_ptr workStatus); private: - void RemoveConnInfo(std::string &workId); - void AddConnInfo(std::string &workId, sptr &connection); - sptr GetConnInfo(std::string &workId); + void RemoveConnInfo(const std::string &workId); + void AddConnInfo(const std::string &workId, sptr &connection); + sptr GetConnInfo(const std::string &workId); bool DisConnect(sptr connect); sptr GetSystemAbilityManager(int32_t errCode); diff --git a/services/native/src/work_conn_manager.cpp b/services/native/src/work_conn_manager.cpp index b9e806e..3c45807 100644 --- a/services/native/src/work_conn_manager.cpp +++ b/services/native/src/work_conn_manager.cpp @@ -42,19 +42,19 @@ namespace OHOS { namespace WorkScheduler { const std::string PARAM_APP_CLONE_INDEX_KEY = "ohos.extra.param.key.appCloneIndex"; -void WorkConnManager::AddConnInfo(string &workId, sptr &connection) +void WorkConnManager::AddConnInfo(const string &workId, sptr &connection) { std::lock_guard lock(connMapMutex_); connMap_.emplace(workId, connection); } -void WorkConnManager::RemoveConnInfo(string &workId) +void WorkConnManager::RemoveConnInfo(const string &workId) { std::lock_guard lock(connMapMutex_); connMap_.erase(workId); } -sptr WorkConnManager::GetConnInfo(string &workId) +sptr WorkConnManager::GetConnInfo(const string &workId) { std::lock_guard lock(connMapMutex_); if (connMap_.count(workId) > 0) { diff --git a/test/fuzztest/workschedulerstartwork_fuzzer/workschedulerstartwork_fuzzer.cpp b/test/fuzztest/workschedulerstartwork_fuzzer/workschedulerstartwork_fuzzer.cpp index ffd9833..95a7ba1 100644 --- a/test/fuzztest/workschedulerstartwork_fuzzer/workschedulerstartwork_fuzzer.cpp +++ b/test/fuzztest/workschedulerstartwork_fuzzer/workschedulerstartwork_fuzzer.cpp @@ -457,6 +457,10 @@ namespace WorkScheduler { workSchedulerService_->standbyStateObserver_ = new (std::nothrow) WorkStandbyStateChangeCallback(workSchedulerService_->workQueueManager_); } + if (workSchedulerService_->groupObserver_ == nullptr) { + workSchedulerService_->groupObserver_ = + new (std::nothrow) WorkBundleGroupChangeCallback(workSchedulerService_->workQueueManager_); + } OnProcEfficiencyResourcesChange(); OnWorkStandbyStateChange(); OnWorkBundleGroupChange(); -- Gitee