diff --git a/frameworks/extension/BUILD.gn b/frameworks/extension/BUILD.gn index 8aa040d99b2ee860df599f16e5cfeef32f4bc1dd..af4b19dac9113dd413920a2c5334126eafa3eb08 100644 --- a/frameworks/extension/BUILD.gn +++ b/frameworks/extension/BUILD.gn @@ -41,6 +41,7 @@ ohos_shared_library("workschedextension") { public_configs = [ ":worksched_public_config" ] deps = [ + "${worksched_frameworks_path}:workschedclient", "${worksched_utils_path}:workschedutils", "//foundation/aafwk/standard/frameworks/kits/ability/ability_runtime:ability_context_native", "//foundation/aafwk/standard/frameworks/kits/ability/native:abilitykit_native", diff --git a/frameworks/extension/include/iwork_scheduler.h b/frameworks/extension/include/iwork_scheduler.h index cd9278b9c2a238edef3720d79b68c7e9c265e9bd..7c56071ce3ec9b28663e4b4b7f6c00f9da739d54 100644 --- a/frameworks/extension/include/iwork_scheduler.h +++ b/frameworks/extension/include/iwork_scheduler.h @@ -18,14 +18,15 @@ #include #include +#include "work_info.h" namespace OHOS { namespace WorkScheduler { class IWorkScheduler : public IRemoteBroker { public: DECLARE_INTERFACE_DESCRIPTOR(u"OHOS.WorkScheduler.IWorkScheduler"); - virtual void OnWorkStart() = 0; - virtual void OnWorkStop() = 0; + virtual void OnWorkStart(WorkInfo& workInfo) = 0; + virtual void OnWorkStop(WorkInfo& workInfo) = 0; }; } // namespace WorkScheduler } // namespace OHOS diff --git a/frameworks/extension/include/js_work_scheduler_extension.h b/frameworks/extension/include/js_work_scheduler_extension.h index 42cc6f8fd8f68fa7379f7cd6751c33f4fd6373d7..5de282a1a79d5bf3c7e09dc89a8ad0089f28d01c 100644 --- a/frameworks/extension/include/js_work_scheduler_extension.h +++ b/frameworks/extension/include/js_work_scheduler_extension.h @@ -19,6 +19,7 @@ #include "work_scheduler_extension.h" #include "js_runtime.h" +#include "work_info.h" #include "work_sched_hilog.h" namespace OHOS { @@ -43,9 +44,9 @@ public: void OnStop() override; - void OnWorkStart() override; + void OnWorkStart(WorkInfo& workInfo) override; - void OnWorkStop() override; + void OnWorkStop(WorkInfo& workInfo) override; private: void GetSrcPath(std::string &srcPath); AbilityRuntime::JsRuntime &jsRuntime_; diff --git a/frameworks/extension/include/work_scheduler_extension.h b/frameworks/extension/include/work_scheduler_extension.h index d5f325d056493fa3e6777121add8f4b5dbd4b29c..c5f20354298905553aab43db2d6c0f6835f253e7 100644 --- a/frameworks/extension/include/work_scheduler_extension.h +++ b/frameworks/extension/include/work_scheduler_extension.h @@ -22,6 +22,7 @@ #include "ability_handler.h" #include "runtime.h" #include "extension_base.h" +#include "work_info.h" #include "work_scheduler_extension_context.h" namespace OHOS { @@ -44,9 +45,9 @@ public: static WorkSchedulerExtension* Create(const std::unique_ptr& runtime); - virtual void OnWorkStart(); + virtual void OnWorkStart(WorkInfo& workInfo); - virtual void OnWorkStop(); + virtual void OnWorkStop(WorkInfo& workInfo); }; } // namespace WorkScheduler } // namespace OHOS diff --git a/frameworks/extension/src/js_work_scheduler_extension.cpp b/frameworks/extension/src/js_work_scheduler_extension.cpp index 9eb360b62d451c0850ac5fdf8a87292a8bd93e5c..dac4eb50979726d17d053f95f13404fc242154fe 100644 --- a/frameworks/extension/src/js_work_scheduler_extension.cpp +++ b/frameworks/extension/src/js_work_scheduler_extension.cpp @@ -15,6 +15,8 @@ #include "js_work_scheduler_extension.h" +#include + #include "runtime.h" #include "js_runtime.h" #include "js_runtime_utils.h" @@ -22,9 +24,10 @@ #include "js_work_scheduler_extension_context.h" #include "work_scheduler_stub_imp.h" - namespace OHOS { namespace WorkScheduler { +const int INVALID_VALUE = -1; + JsWorkSchedulerExtension* JsWorkSchedulerExtension::Create(const std::unique_ptr& runtime) { return new JsWorkSchedulerExtension(static_cast(*runtime)); @@ -111,17 +114,59 @@ void JsWorkSchedulerExtension::OnDisconnect(const AAFwk::Want& want) AbilityRuntime::Extension::OnDisconnect(want); } -void JsWorkSchedulerExtension::OnWorkStart() +void JsWorkSchedulerExtension::OnWorkStart(WorkInfo& workInfo) { - WorkSchedulerExtension::OnWorkStart(); + WorkSchedulerExtension::OnWorkStart(workInfo); WS_HILOGI("WorkSchedulerExtension %{public}s begin.", __func__); AbilityRuntime::HandleScope handleScope(jsRuntime_); NativeEngine& nativeEngine = jsRuntime_.GetNativeEngine(); - NativeValue* jCommonEventData = nativeEngine.CreateObject(); + NativeValue* jworkInfoData = nativeEngine.CreateObject(); + NativeObject* workInfoData = AbilityRuntime::ConvertNativeValueTo(jworkInfoData); + workInfoData->SetProperty("workId", nativeEngine.CreateNumber(workInfo.GetWorkId())); + + std::string bundleName = workInfo.GetBundleName(); + workInfoData->SetProperty("bundleName", nativeEngine.CreateString(bundleName.c_str(), bundleName.size())); + + std::string abilityName = workInfo.GetAbilityName(); + workInfoData->SetProperty("abilityName", nativeEngine.CreateString(abilityName.c_str(), abilityName.size())); + + workInfoData->SetProperty("isPersisted", nativeEngine.CreateBoolean(workInfo.IsPersisted())); + if (workInfo.GetNetworkType() != WorkCondition::Network::NETWORK_UNKNOWN) { + workInfoData->SetProperty("networkType", nativeEngine.CreateNumber(workInfo.GetNetworkType())); + } + WorkCondition::Charger charger = workInfo.GetChargerType(); + if (charger != WorkCondition::Charger::CHARGING_UNKNOWN) { + if (charger == WorkCondition::Charger::CHARGING_UNPLUGGED) { + workInfoData->SetProperty("isCharging", nativeEngine.CreateBoolean(false)); + } else { + workInfoData->SetProperty("isCharging", nativeEngine.CreateBoolean(true)); + workInfoData->SetProperty("chargerType", nativeEngine.CreateNumber(charger)); + } + } + if (workInfo.GetBatteryLevel() != INVALID_VALUE) { + workInfoData->SetProperty("batteryLevel", nativeEngine.CreateNumber(workInfo.GetBatteryLevel())); + } + if (workInfo.GetBatteryStatus() != WorkCondition::BatteryStatus::BATTERY_UNKNOWN) { + workInfoData->SetProperty("batteryStatus", nativeEngine.CreateNumber(workInfo.GetBatteryStatus())); + } + if (workInfo.GetStorageLevel() != WorkCondition::Storage::STORAGE_UNKNOWN) { + workInfoData->SetProperty("storageRequest", nativeEngine.CreateNumber(workInfo.GetStorageLevel())); + } - NativeValue* argv[] = {jCommonEventData}; + uint32_t timeInterval = workInfo.GetTimeInterval(); + if (timeInterval != INVALID_VALUE) { + if (workInfo.IsRepeat()) { + workInfoData->SetProperty("isRepeat", nativeEngine.CreateBoolean(true)); + workInfoData->SetProperty("repeatCycleTime", nativeEngine.CreateNumber(timeInterval)); + } else { + workInfoData->SetProperty("repeatCycleTime", nativeEngine.CreateNumber(timeInterval)); + workInfoData->SetProperty("repeatCount", nativeEngine.CreateNumber(workInfo.GetCycleCount())); + } + } + + NativeValue* argv[] = {jworkInfoData}; if (!jsObj_) { WS_HILOGI("WorkSchedulerExtension Not found StaticSubscriberExtension.js"); return; @@ -143,17 +188,59 @@ void JsWorkSchedulerExtension::OnWorkStart() WS_HILOGI("WorkSchedulerExtension %{public}s end.", __func__); } -void JsWorkSchedulerExtension::OnWorkStop() +void JsWorkSchedulerExtension::OnWorkStop(WorkInfo& workInfo) { - WorkSchedulerExtension::OnWorkStop(); + WorkSchedulerExtension::OnWorkStop(workInfo); WS_HILOGI("WorkSchedulerExtension %{public}s begin.", __func__); AbilityRuntime::HandleScope handleScope(jsRuntime_); NativeEngine& nativeEngine = jsRuntime_.GetNativeEngine(); - NativeValue* jCommonEventData = nativeEngine.CreateObject(); + NativeValue* jworkInfoData = nativeEngine.CreateObject(); + NativeObject* workInfoData = AbilityRuntime::ConvertNativeValueTo(jworkInfoData); + workInfoData->SetProperty("workId", nativeEngine.CreateNumber(workInfo.GetWorkId())); + + std::string bundleName = workInfo.GetBundleName(); + workInfoData->SetProperty("bundleName", nativeEngine.CreateString(bundleName.c_str(), bundleName.size())); + + std::string abilityName = workInfo.GetAbilityName(); + workInfoData->SetProperty("abilityName", nativeEngine.CreateString(abilityName.c_str(), abilityName.size())); + + workInfoData->SetProperty("isPersisted", nativeEngine.CreateBoolean(workInfo.IsPersisted())); + if (workInfo.GetNetworkType() != WorkCondition::Network::NETWORK_UNKNOWN) { + workInfoData->SetProperty("networkType", nativeEngine.CreateNumber(workInfo.GetNetworkType())); + } + WorkCondition::Charger charger = workInfo.GetChargerType(); + if (charger != WorkCondition::Charger::CHARGING_UNKNOWN) { + if (charger == WorkCondition::Charger::CHARGING_UNPLUGGED) { + workInfoData->SetProperty("isCharging", nativeEngine.CreateBoolean(false)); + } else { + workInfoData->SetProperty("isCharging", nativeEngine.CreateBoolean(true)); + workInfoData->SetProperty("chargerType", nativeEngine.CreateNumber(charger)); + } + } + if (workInfo.GetBatteryLevel() != INVALID_VALUE) { + workInfoData->SetProperty("batteryLevel", nativeEngine.CreateNumber(workInfo.GetBatteryLevel())); + } + if (workInfo.GetBatteryStatus() != WorkCondition::BatteryStatus::BATTERY_UNKNOWN) { + workInfoData->SetProperty("batteryStatus", nativeEngine.CreateNumber(workInfo.GetBatteryStatus())); + } + if (workInfo.GetStorageLevel() != WorkCondition::Storage::STORAGE_UNKNOWN) { + workInfoData->SetProperty("storageRequest", nativeEngine.CreateNumber(workInfo.GetStorageLevel())); + } + + uint32_t timeInterval = workInfo.GetTimeInterval(); + if (timeInterval != INVALID_VALUE) { + if (workInfo.IsRepeat()) { + workInfoData->SetProperty("isRepeat", nativeEngine.CreateBoolean(true)); + workInfoData->SetProperty("repeatCycleTime", nativeEngine.CreateNumber(timeInterval)); + } else { + workInfoData->SetProperty("repeatCycleTime", nativeEngine.CreateNumber(timeInterval)); + workInfoData->SetProperty("repeatCount", nativeEngine.CreateNumber(workInfo.GetCycleCount())); + } + } - NativeValue* argv[] = {jCommonEventData}; + NativeValue* argv[] = {jworkInfoData}; if (!jsObj_) { WS_HILOGI("WorkSchedulerExtension Not found js"); return; diff --git a/frameworks/extension/src/work_scheduler_extension.cpp b/frameworks/extension/src/work_scheduler_extension.cpp index c5f20b8c3fc8c2a9ba54875b583fcfd58d5d4f1b..9a547fa333e1840ca8f7f6450411c3b5f11043e1 100644 --- a/frameworks/extension/src/work_scheduler_extension.cpp +++ b/frameworks/extension/src/work_scheduler_extension.cpp @@ -55,10 +55,10 @@ std::shared_ptr WorkSchedulerExtension::CreateAnd return context; } -void WorkSchedulerExtension::OnWorkStart() { +void WorkSchedulerExtension::OnWorkStart(WorkInfo& workInfo) { } -void WorkSchedulerExtension::OnWorkStop() { +void WorkSchedulerExtension::OnWorkStop(WorkInfo& workInfo) { } } // namespace AbilityRuntime } // namespace OHOS \ No newline at end of file diff --git a/frameworks/include/work_info.h b/frameworks/include/work_info.h index 73d20a90335cf349691f330ffea76d86000e4f92..a9d22488e34b5e03732da95717a9e76d39f5527c 100644 --- a/frameworks/include/work_info.h +++ b/frameworks/include/work_info.h @@ -53,6 +53,7 @@ public: WorkCondition::Storage GetStorageLevel(); bool IsRepeat(); uint32_t GetTimeInterval(); + int32_t GetCycleCount(); std::shared_ptr>> GetConditionMap(); bool Marshalling(Parcel &parcel) const override; static WorkInfo *Unmarshalling(Parcel &parcel); diff --git a/frameworks/src/work_info.cpp b/frameworks/src/work_info.cpp index e279e3abe13b1d301a060179b245267c22fe70f1..af17c105e60525f47c586a9bc0732abf4d838b09 100644 --- a/frameworks/src/work_info.cpp +++ b/frameworks/src/work_info.cpp @@ -18,6 +18,8 @@ namespace OHOS { namespace WorkScheduler { +const int INVALID_VALUE = -1; + WorkInfo::WorkInfo() {} WorkInfo::~WorkInfo() {} @@ -136,7 +138,7 @@ int32_t WorkInfo::GetBatteryLevel() if (conditionMap_.count(WorkCondition::Type::BATTERY_LEVEL) > 0) { return conditionMap_.at(WorkCondition::Type::BATTERY_LEVEL)->intVal; } - return -1; + return INVALID_VALUE; } WorkCondition::BatteryStatus WorkInfo::GetBatteryStatus() @@ -172,7 +174,18 @@ uint32_t WorkInfo::GetTimeInterval() if (conditionMap_.count(WorkCondition::Type::TIMER) > 0) { return conditionMap_.at(WorkCondition::Type::TIMER)->uintVal; } - return -1; + return INVALID_VALUE; +} + +int32_t WorkInfo::GetCycleCount() +{ + if (conditionMap_.count(WorkCondition::Type::TIMER) > 0) { + if (IsRepeat()) { + return INVALID_VALUE; + } + return conditionMap_.at(WorkCondition::Type::TIMER)->intVal; + } + return INVALID_VALUE; } std::shared_ptr>> WorkInfo::GetConditionMap() diff --git a/interfaces/kits/js/napi/work_scheduler_extension/work_scheduler_extension.js b/interfaces/kits/js/napi/work_scheduler_extension/work_scheduler_extension.js index 7736cff2196c16187de1719a187503f7e2e85d2d..6cf7c0fb0e0c81acbd55beb4c98f6bd7ee7d76b1 100644 --- a/interfaces/kits/js/napi/work_scheduler_extension/work_scheduler_extension.js +++ b/interfaces/kits/js/napi/work_scheduler_extension/work_scheduler_extension.js @@ -14,10 +14,10 @@ */ class WorkSchedulerExtension { - onWorkStart() { + onWorkStart(workInfo) { console.log('MyWorkSchedulerExtension onWorkStart'); } - onWorkStop() { + onWorkStop(workInfo) { console.log('MyWorkSchedulerExtension onWorkStop'); } } diff --git a/services/native/include/work_scheduler_connection.h b/services/native/include/work_scheduler_connection.h index bd0f8e381273cbb2a29faa85a8391535938985bb..e56633714514dc97b04bba9c17708c8f2bbbf8df 100644 --- a/services/native/include/work_scheduler_connection.h +++ b/services/native/include/work_scheduler_connection.h @@ -17,12 +17,14 @@ #define FOUNDATION_EVENT_CESFWK_SERVICES_INCLUDE_STATIC_SUBSCRIBER_CONNECTION_H #include "ability_connect_callback_stub.h" +#include "work_info.h" #include "work_scheduler_proxy.h" namespace OHOS { namespace WorkScheduler { class WorkSchedulerConnection : public AAFwk::AbilityConnectionStub { public: + WorkSchedulerConnection(std::shared_ptr workInfo); void StopWork(); void OnAbilityConnectDone( const AppExecFwk::ElementName &element, const sptr &remoteObject, int resultCode) override; @@ -30,6 +32,7 @@ public: void OnAbilityDisconnectDone(const AppExecFwk::ElementName &element, int resultCode) override; private: sptr proxy_ = nullptr; + std::shared_ptr workInfo_; }; } // namespace } // namespace OHOS diff --git a/services/native/src/work_conn_manager.cpp b/services/native/src/work_conn_manager.cpp index 7597e792c32b4aa7013c3b659b2e484064a05839..ca851678d5bff96a0dddc83b94c2d37bdedea65a 100644 --- a/services/native/src/work_conn_manager.cpp +++ b/services/native/src/work_conn_manager.cpp @@ -72,7 +72,7 @@ bool WorkConnManager::StartWork(shared_ptr workStatus) WS_HILOGI("Begin to connect bundle:%{public}s, abilityName:%{public}s, userId:%{public}d", workStatus->bundleName_.c_str(), workStatus->abilityName_.c_str(), workStatus->userId_); - sptr connection(new (std::nothrow) WorkSchedulerConnection()); + sptr connection(new (std::nothrow) WorkSchedulerConnection(workStatus->workInfo_)); Want want; want.SetElementName(workStatus->bundleName_, workStatus->abilityName_); int ret = abilityMgr_->ConnectAbility(want, connection, nullptr, workStatus->userId_); diff --git a/services/native/src/work_policy_manager.cpp b/services/native/src/work_policy_manager.cpp index 49d674d03b1ea1d311d1e1f4a2d0c81ea854fedc..63482bbd41b70042357d610e1c51bd8e20baa424 100644 --- a/services/native/src/work_policy_manager.cpp +++ b/services/native/src/work_policy_manager.cpp @@ -307,6 +307,13 @@ void WorkPolicyManager::RealStartWork(std::shared_ptr topWork) bool ret = workConnManager_->StartWork(topWork); if (ret) { AddWatchdogForWork(topWork); + } else { + if (!topWork->IsRepeating()) { + topWork->MarkStatus(WorkStatus::Status::REMOVED); + RemoveFromUidQueue(topWork, topWork->uid_); + } else { + topWork->MarkStatus(WorkStatus::Status::WAIT_CONDITION); + } } } diff --git a/services/native/src/work_scheduler_connection.cpp b/services/native/src/work_scheduler_connection.cpp index dd8aaa87cbc04022a2c77d62006930f0aa795496..4c863773081a5517971d8945e957477bdd91b0a0 100644 --- a/services/native/src/work_scheduler_connection.cpp +++ b/services/native/src/work_scheduler_connection.cpp @@ -19,21 +19,26 @@ namespace OHOS { namespace WorkScheduler { +WorkSchedulerConnection::WorkSchedulerConnection(std::shared_ptr workInfo) +{ + this->workInfo_ = workInfo; +} + void WorkSchedulerConnection::StopWork() { if (proxy_ == nullptr) { WS_HILOGE("proxy is null"); return; } - proxy_->OnWorkStop(); + proxy_->OnWorkStop(*workInfo_); } void WorkSchedulerConnection::OnAbilityConnectDone( const AppExecFwk::ElementName &element, const sptr &remoteObject, int resultCode) { proxy_ = (new (std::nothrow) WorkSchedulerProxy(remoteObject)); - proxy_->OnWorkStart(); - WS_HILOGI("OnAbilityConnectDone"); + proxy_->OnWorkStart(*workInfo_); + WS_HILOGI("OnAbilityConnectDone.%{public}d", workInfo_->GetWorkId()); } void WorkSchedulerConnection::OnAbilityDisconnectDone(const AppExecFwk::ElementName &element, int resultCode) diff --git a/services/zidl/include/work_scheduler_proxy.h b/services/zidl/include/work_scheduler_proxy.h index 7000074750dd2c5c9f384079fa2ef0efa27cd73c..3691077570cd13c1614ebd5d23404ee6877a7a21 100644 --- a/services/zidl/include/work_scheduler_proxy.h +++ b/services/zidl/include/work_scheduler_proxy.h @@ -29,9 +29,9 @@ public: virtual ~WorkSchedulerProxy() {} - void OnWorkStart() override; + void OnWorkStart(WorkInfo& workInfo) override; - void OnWorkStop() override; + void OnWorkStop(WorkInfo& workInfo) override; private: static constexpr int COMMAND_ON_WORK_START = MIN_TRANSACTION_ID; diff --git a/services/zidl/include/work_scheduler_stub_imp.h b/services/zidl/include/work_scheduler_stub_imp.h index e226155d244db84eca3b086707b16ba45e04b840..bc18ad4516501d3ab0a9419135d31a10bf949cad 100644 --- a/services/zidl/include/work_scheduler_stub_imp.h +++ b/services/zidl/include/work_scheduler_stub_imp.h @@ -30,9 +30,9 @@ public: virtual ~WorkSchedulerStubImp() {} - void OnWorkStart() override; + void OnWorkStart(WorkInfo& workInfo) override; - void OnWorkStop() override; + void OnWorkStop(WorkInfo& workInfo) override; private: std::weak_ptr extension_; }; diff --git a/services/zidl/src/work_scheduler_proxy.cpp b/services/zidl/src/work_scheduler_proxy.cpp index e15fc46c679ad86753a5c71e8e72ae018e90e1e0..6b176a83331716a5817dd0f6ac80f87f049c2194 100644 --- a/services/zidl/src/work_scheduler_proxy.cpp +++ b/services/zidl/src/work_scheduler_proxy.cpp @@ -17,21 +17,21 @@ namespace OHOS { namespace WorkScheduler { -void WorkSchedulerProxy::OnWorkStart() +void WorkSchedulerProxy::OnWorkStart(WorkInfo& workInfo) { MessageParcel data; MessageParcel reply; MessageOption option(MessageOption::TF_SYNC); - + data.WriteParcelable(&workInfo); Remote()->SendRequest(COMMAND_ON_WORK_START, data, reply, option); } -void WorkSchedulerProxy::OnWorkStop() +void WorkSchedulerProxy::OnWorkStop(WorkInfo& workInfo) { MessageParcel data; MessageParcel reply; MessageOption option(MessageOption::TF_SYNC); - + data.WriteParcelable(&workInfo); Remote()->SendRequest(COMMAND_ON_WORK_STOP, data, reply, option); } } // namespace WorkScheduler diff --git a/services/zidl/src/work_scheduler_stub.cpp b/services/zidl/src/work_scheduler_stub.cpp index 54382335d83f2dfcddc904a721d954a6dab8c2ef..836565905720216396cca6d8c18e67727d83ae46 100644 --- a/services/zidl/src/work_scheduler_stub.cpp +++ b/services/zidl/src/work_scheduler_stub.cpp @@ -22,11 +22,13 @@ int WorkSchedulerStub::OnRemoteRequest(uint32_t code, MessageParcel& data, Messa { switch (code) { case COMMAND_ON_WORK_START: { - OnWorkStart(); + WorkInfo* workInfo = data.ReadParcelable(); + OnWorkStart(*workInfo); return ERR_NONE; } case COMMAND_ON_WORK_STOP: { - OnWorkStop(); + WorkInfo* workInfo = data.ReadParcelable(); + OnWorkStop(*workInfo); return ERR_NONE; } default: diff --git a/services/zidl/src/work_scheduler_stub_imp.cpp b/services/zidl/src/work_scheduler_stub_imp.cpp index 898fb42536e934b1e43d4fe4b31d8c02e95c5df6..7744b277e04a51f4c29157f7e2f1e4a0e5ddeda3 100644 --- a/services/zidl/src/work_scheduler_stub_imp.cpp +++ b/services/zidl/src/work_scheduler_stub_imp.cpp @@ -19,22 +19,22 @@ namespace OHOS { namespace WorkScheduler { -void WorkSchedulerStubImp::OnWorkStart() +void WorkSchedulerStubImp::OnWorkStart(WorkInfo& workInfo) { WS_HILOGI("WorkSchedulerExtension %{public}s begin.", __func__); auto extension = extension_.lock(); if (extension != nullptr) { - extension->OnWorkStart(); + extension->OnWorkStart(workInfo); WS_HILOGI("WorkSchedulerExtension %{public}s end successfully.", __func__); } } -void WorkSchedulerStubImp::OnWorkStop() +void WorkSchedulerStubImp::OnWorkStop(WorkInfo& workInfo) { WS_HILOGI("WorkSchedulerExtension %{public}s begin.", __func__); auto extension = extension_.lock(); if (extension != nullptr) { - extension->OnWorkStop(); + extension->OnWorkStop(workInfo); WS_HILOGI("WorkSchedulerExtension %{public}s end successfully.", __func__); } }