From c32cfd081006bf24fffddf9a5e1bf9ca26ed9ca9 Mon Sep 17 00:00:00 2001 From: h30045808 Date: Sun, 5 May 2024 11:14:33 +0800 Subject: [PATCH] =?UTF-8?q?=E9=95=BF=E6=97=B6=E4=BB=BB=E5=8A=A1=E5=9B=9E?= =?UTF-8?q?=E8=B0=83=E4=BF=A1=E6=81=AF=E6=B7=BB=E5=8A=A0tokenId=20Signed-o?= =?UTF-8?q?ff-by:=20=E8=83=A1=E4=BC=9F=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../innerkits/include/continuous_task_callback_info.h | 6 ++++-- interfaces/innerkits/src/continuous_task_callback_info.cpp | 5 +++++ services/continuous_task/src/bg_continuous_task_mgr.cpp | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/interfaces/innerkits/include/continuous_task_callback_info.h b/interfaces/innerkits/include/continuous_task_callback_info.h index b4068ee..11d879e 100644 --- a/interfaces/innerkits/include/continuous_task_callback_info.h +++ b/interfaces/innerkits/include/continuous_task_callback_info.h @@ -28,9 +28,10 @@ public: ContinuousTaskCallbackInfo(); ContinuousTaskCallbackInfo(uint32_t typeId, int32_t creatorUid, pid_t creatorPid, std::string abilityName, bool isFromWebview = false, bool isBatchApi = false, - const std::vector &typeIds = {}, int32_t abilityId = -1) + const std::vector &typeIds = {}, int32_t abilityId = -1, uint64_t tokenId = 0) : typeId_(typeId), creatorUid_(creatorUid), creatorPid_(creatorPid), abilityName_(abilityName), - isFromWebview_(isFromWebview), isBatchApi_(isBatchApi), typeIds_(typeIds), abilityId_(abilityId) {} + isFromWebview_(isFromWebview), isBatchApi_(isBatchApi), typeIds_(typeIds), abilityId_(abilityId), + tokenId_(tokenId) {} /** * @brief Get the id of type. @@ -110,6 +111,7 @@ private: bool isBatchApi_ {false}; std::vector typeIds_ {}; int32_t abilityId_ {-1}; + uint64_t tokenId_ {0}; }; } // namespace BackgroundTaskMgr } // namespace OHOS diff --git a/interfaces/innerkits/src/continuous_task_callback_info.cpp b/interfaces/innerkits/src/continuous_task_callback_info.cpp index 42e7884..6c1a899 100644 --- a/interfaces/innerkits/src/continuous_task_callback_info.cpp +++ b/interfaces/innerkits/src/continuous_task_callback_info.cpp @@ -103,6 +103,10 @@ bool ContinuousTaskCallbackInfo::Marshalling(Parcel &parcel) const BGTASK_LOGE("Failed to write abilityId_"); return false; } + if (!parcel.WriteUint64(tokenId_)) { + BGTASK_LOGE("Failed to write tokenId_"); + return false; + } return true; } @@ -145,6 +149,7 @@ bool ContinuousTaskCallbackInfo::ReadFromParcel(Parcel &parcel) } BGTASK_LOGD("read parce typeIds_ size %{public}u", static_cast(typeIds_.size())); abilityId_ = static_cast(parcel.ReadInt32()); + tokenId_ = parcel.ReadUint64(); return true; } } // namespace BackgroundTaskMgr diff --git a/services/continuous_task/src/bg_continuous_task_mgr.cpp b/services/continuous_task/src/bg_continuous_task_mgr.cpp index 0d60806..72e2009 100644 --- a/services/continuous_task/src/bg_continuous_task_mgr.cpp +++ b/services/continuous_task/src/bg_continuous_task_mgr.cpp @@ -1285,7 +1285,7 @@ void BgContinuousTaskMgr::OnContinuousTaskChanged(const std::shared_ptr(continuousTaskInfo->GetBgModeId(), continuousTaskInfo->GetUid(), continuousTaskInfo->GetPid(), continuousTaskInfo->GetAbilityName(), continuousTaskInfo->IsFromWebview(), continuousTaskInfo->isBatchApi_, continuousTaskInfo->bgModeIds_, - continuousTaskInfo->abilityId_); + continuousTaskInfo->abilityId_, continuousTaskInfo->fullTokenId_); BGTASK_LOGD("mdoe %{public}d isBatch %{public}d modes size %{public}u", continuousTaskCallbackInfo->GetTypeId(), continuousTaskCallbackInfo->IsBatchApi(), static_cast(continuousTaskCallbackInfo->GetTypeIds().size()));