From 05e8bfc0183beb7826607639576693a998e3c379 Mon Sep 17 00:00:00 2001 From: Zhao-PengFei35 Date: Wed, 28 Jun 2023 12:46:12 +0800 Subject: [PATCH] replace GetAllowList with GetExemptedApps Signed-off-by: Zhao-PengFei35 --- .../work_standby_state_change_callback.h | 10 +++++----- services/native/src/work_scheduler_service.cpp | 10 +++++----- .../src/work_standby_state_change_callback.cpp | 18 +++++++++--------- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/services/native/include/work_standby_state_change_callback.h b/services/native/include/work_standby_state_change_callback.h index c8e063d..c840dd4 100644 --- a/services/native/include/work_standby_state_change_callback.h +++ b/services/native/include/work_standby_state_change_callback.h @@ -30,22 +30,22 @@ public: * @brief callback when device_standby state change. * * @param napped current state is nap or not. - * @param sleeping current state is sleep or not. + * @param isIdle current state is sleep or not. */ - void OnDeviceIdleMode(bool napped, bool sleeping) override; + void OnDeviceIdleMode(bool napped, bool isIdle) override; /* * @brief callback when device_standby allowList change. * * @param uid of application who apply allowList. * @param name bundleName of application who apply allowList. - * @param allowType allowType mean strategy type, such as WORK_SCHEDULER. + * @param resourceType resourceType mean strategy type, such as WORK_SCHEDULER. * @param added true mean starting allow, false mean ending allow. */ - void OnAllowListChanged(int32_t uid, const std::string& name, uint32_t allowType, bool added) override; + void OnExemptedAppsChanged(int32_t uid, const std::string& name, uint32_t resourceType, bool added) override; private: std::shared_ptr workQueueManager_; - bool isSleep_ {false}; + bool isIdle_ {false}; }; } // namespace WorkScheduler } // namespace OHOS diff --git a/services/native/src/work_scheduler_service.cpp b/services/native/src/work_scheduler_service.cpp index cf52c03..c610233 100644 --- a/services/native/src/work_scheduler_service.cpp +++ b/services/native/src/work_scheduler_service.cpp @@ -767,11 +767,11 @@ bool WorkSchedulerService::CheckStandbyApplyInfo(std::string& bundleName) if (!standbyStateObserver_) { return true; } - std::vector allowInfoArray; - DevStandbyMgr::StandbyServiceClient::GetInstance().GetAllowList(DevStandbyMgr::AllowType::WORK_SCHEDULER, - allowInfoArray, DevStandbyMgr::ReasonCodeEnum::REASON_APP_API); - WS_HILOGD("allowInfoArray size is %{public}ld", allowInfoArray.size()); - for (const auto& item : allowInfoArray) { + std::vector exemptedAppInfoArray; + DevStandbyMgr::StandbyServiceClient::GetInstance().GetExemptedApps(DevStandbyMgr::ResourceType::WORK_SCHEDULER, + exemptedAppInfoArray, DevStandbyMgr::ReasonCodeEnum::REASON_APP_API); + WS_HILOGD("exemptedAppInfoArray size is %{public}ld", exemptedAppInfoArray.size()); + for (const auto& item : exemptedAppInfoArray) { if (item.GetName() == bundleName) { return true; } diff --git a/services/native/src/work_standby_state_change_callback.cpp b/services/native/src/work_standby_state_change_callback.cpp index 4cacd3a..cfbe743 100644 --- a/services/native/src/work_standby_state_change_callback.cpp +++ b/services/native/src/work_standby_state_change_callback.cpp @@ -25,29 +25,29 @@ WorkStandbyStateChangeCallback::WorkStandbyStateChangeCallback(std::shared_ptrOnConditionChanged(WorkCondition::Type::STANDBY, - std::make_shared(0, 0, sleeping, std::string())); - isSleep_ = sleeping; + std::make_shared(0, 0, isIdle, std::string())); + isIdle_ = isIdle; } -void WorkStandbyStateChangeCallback::OnAllowListChanged(int32_t uid, const std::string& name, - uint32_t allowType, bool added) +void WorkStandbyStateChangeCallback::OnExemptedAppsChanged(int32_t uid, const std::string& name, + uint32_t resourceType, bool added) { WS_HILOGD("%{public}s apply allow, added type is %{public}d", name.c_str(), added); - if (!isSleep_) { + if (!isIdle_) { WS_HILOGD("current device_standby state is not sleep"); return; } workQueueManager_->OnConditionChanged(WorkCondition::Type::STANDBY, - std::make_shared(0, 0, isSleep_, std::string())); + std::make_shared(0, 0, isIdle_, std::string())); } } // namespace WorkScheduler } // namespace OHOS -- Gitee