From da37b08521e4db7f69ab54665294e27a3cfa9353 Mon Sep 17 00:00:00 2001 From: redlotus127 Date: Wed, 10 Sep 2025 09:13:47 +0000 Subject: [PATCH 1/4] patch 1 Signed-off-by: redlotus127 --- plugins/ext/include/standby_messsage.h | 1 + services/core/include/standby_service_impl.h | 1 + services/core/src/standby_service_impl.cpp | 30 ++++++++++++++++++++ 3 files changed, 32 insertions(+) diff --git a/plugins/ext/include/standby_messsage.h b/plugins/ext/include/standby_messsage.h index e921a72..ff80a63 100644 --- a/plugins/ext/include/standby_messsage.h +++ b/plugins/ext/include/standby_messsage.h @@ -54,6 +54,7 @@ struct StandbyMessageType { GATT_CONNECT_STATE, BROKER_GATT_CONNECT, THERMAL_SCENARIO_REPORT, + COTINUOUS_TASK_CHANGE, }; }; diff --git a/services/core/include/standby_service_impl.h b/services/core/include/standby_service_impl.h index ca154b4..458464f 100644 --- a/services/core/include/standby_service_impl.h +++ b/services/core/include/standby_service_impl.h @@ -215,6 +215,7 @@ private: void HandleActionChanged([[maybe_unused]]uint32_t resType, const std::string &module, uint32_t action); void DumpOnActionChanged(const std::vector &argsInStr, std::string &result); + void HandleContinuousTaskChanged(const int64_t value, const std::string &sceneInfo); private: std::atomic isServiceReady_ {false}; diff --git a/services/core/src/standby_service_impl.cpp b/services/core/src/standby_service_impl.cpp index 102473c..1aa0e5b 100644 --- a/services/core/src/standby_service_impl.cpp +++ b/services/core/src/standby_service_impl.cpp @@ -1433,6 +1433,36 @@ void StandbyServiceImpl::HandleThermalScenarioReport(const int64_t value, const DispatchEvent(standbyMessage); } +void HandleContinuousTaskChanged(const int64_t value, const std::string &sceneInfo) +{ + nlohmann::json payload = nlohmann::json::parse(sceneInfo, nullptr, false); + if (payload.is_discarded()) { + STANDBYSERVICE_LOGE("parse json failed"); + return; + } + if (!payload.contains("pid") || !payload.contains("uid")) { + STANDBYSERVICE_LOGE("param does not exist"); + return; + } + if (!payload.at("pid").is_string() || !payload.at("uid").is_string()) { + STANDBYSERVICE_LOGE("param is invalid"); + return; + } + pid_t pid = atoi(payload.at("pid").get().c_str()); + int32_t uid = atoi(payload.at("uid").get().c_str()); + appMgrClient_ = std::make_unique(); + if (appMgrClient_ == nullptr) { + STANDBYSERVICE_LOGE("failed get appmgr client"); + } + std::string bundleName; + bundleName = appMgrClient_->GetBunldeNameByPid(pid, bundleName, uid); + StandbyMessage standbyMessage {StandbyMessageType::COTINUOUS_TASK_CHANGE}; + standbyMessage.want_ = AAFwk::Want {}; + standbyMessage.want_->SetParam("bundleName", bundleName); + standbyMessage.want_->SetParam("value", static_cast(value)); + DispatchEvent(standbyMessage); +} + ErrCode StandbyServiceImpl::HandleCommonEvent(const uint32_t resType, const int64_t value, const std::string &sceneInfo) { STANDBYSERVICE_LOGD("HandleCommonEvent resType = %{public}u, value = %{public}lld, sceneInfo = %{public}s", -- Gitee From 1e6a0103c859c8be850bf1738a74b839fd70ff54 Mon Sep 17 00:00:00 2001 From: redlotus127 Date: Wed, 10 Sep 2025 09:23:51 +0000 Subject: [PATCH 2/4] patch 2 Signed-off-by: redlotus127 --- services/core/src/standby_service_impl.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/services/core/src/standby_service_impl.cpp b/services/core/src/standby_service_impl.cpp index 1aa0e5b..4dbe803 100644 --- a/services/core/src/standby_service_impl.cpp +++ b/services/core/src/standby_service_impl.cpp @@ -1509,6 +1509,9 @@ ErrCode StandbyServiceImpl::HandleCommonEvent(const uint32_t resType, const int6 case ResourceSchedule::ResType::RES_TYPE_THERMAL_SCENARIO_REPORT: HandleThermalScenarioReport(value, sceneInfo); break; + case ResourceSchedule::ResType::RES_TYPE_CONTINUOUS_TASK: + HandleContinuousTaskChanged(value, sceneInfo); + break; default: AppEventHandler(resType, value, sceneInfo); break; -- Gitee From efb0406ed3dbdd16d8729fdea917e11fe03fde9c Mon Sep 17 00:00:00 2001 From: redlotus127 Date: Wed, 10 Sep 2025 09:36:47 +0000 Subject: [PATCH 3/4] patch 3 Signed-off-by: redlotus127 --- plugins/ext/include/standby_messsage.h | 2 +- services/core/src/standby_service_impl.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/ext/include/standby_messsage.h b/plugins/ext/include/standby_messsage.h index ff80a63..c5f7f76 100644 --- a/plugins/ext/include/standby_messsage.h +++ b/plugins/ext/include/standby_messsage.h @@ -54,7 +54,7 @@ struct StandbyMessageType { GATT_CONNECT_STATE, BROKER_GATT_CONNECT, THERMAL_SCENARIO_REPORT, - COTINUOUS_TASK_CHANGE, + CONTINUOUS_TASK_CHANGE, }; }; diff --git a/services/core/src/standby_service_impl.cpp b/services/core/src/standby_service_impl.cpp index 4dbe803..215d5ab 100644 --- a/services/core/src/standby_service_impl.cpp +++ b/services/core/src/standby_service_impl.cpp @@ -1455,8 +1455,8 @@ void HandleContinuousTaskChanged(const int64_t value, const std::string &sceneIn STANDBYSERVICE_LOGE("failed get appmgr client"); } std::string bundleName; - bundleName = appMgrClient_->GetBunldeNameByPid(pid, bundleName, uid); - StandbyMessage standbyMessage {StandbyMessageType::COTINUOUS_TASK_CHANGE}; + appMgrClient_->GetBundleNameByPid(pid, bundleName, uid); + StandbyMessage standbyMessage {StandbyMessageType::CONTINUOUS_TASK_CHANGE}; standbyMessage.want_ = AAFwk::Want {}; standbyMessage.want_->SetParam("bundleName", bundleName); standbyMessage.want_->SetParam("value", static_cast(value)); -- Gitee From 5a4a874dfcd38ca51109d7163b5255ee67f55c1b Mon Sep 17 00:00:00 2001 From: redlotus127 Date: Thu, 11 Sep 2025 08:11:27 +0000 Subject: [PATCH 4/4] patch 4 Signed-off-by: redlotus127 --- services/core/src/standby_service_impl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/core/src/standby_service_impl.cpp b/services/core/src/standby_service_impl.cpp index 215d5ab..f2757a8 100644 --- a/services/core/src/standby_service_impl.cpp +++ b/services/core/src/standby_service_impl.cpp @@ -1433,7 +1433,7 @@ void StandbyServiceImpl::HandleThermalScenarioReport(const int64_t value, const DispatchEvent(standbyMessage); } -void HandleContinuousTaskChanged(const int64_t value, const std::string &sceneInfo) +void StandbyServiceImpl::HandleContinuousTaskChanged(const int64_t value, const std::string &sceneInfo) { nlohmann::json payload = nlohmann::json::parse(sceneInfo, nullptr, false); if (payload.is_discarded()) { -- Gitee