mirror of
https://gitee.com/openharmony/resourceschedule_background_task_mgr
synced 2024-11-23 06:50:07 +00:00
长时任务回调信息添加tokenId
Signed-off-by: 胡伟 <huwei169@huawei.com>
This commit is contained in:
parent
a607c7afc3
commit
c32cfd0810
@ -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<uint32_t> &typeIds = {}, int32_t abilityId = -1)
|
||||
const std::vector<uint32_t> &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<uint32_t> typeIds_ {};
|
||||
int32_t abilityId_ {-1};
|
||||
uint64_t tokenId_ {0};
|
||||
};
|
||||
} // namespace BackgroundTaskMgr
|
||||
} // namespace OHOS
|
||||
|
@ -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<uint32_t>(typeIds_.size()));
|
||||
abilityId_ = static_cast<int32_t>(parcel.ReadInt32());
|
||||
tokenId_ = parcel.ReadUint64();
|
||||
return true;
|
||||
}
|
||||
} // namespace BackgroundTaskMgr
|
||||
|
@ -1285,7 +1285,7 @@ void BgContinuousTaskMgr::OnContinuousTaskChanged(const std::shared_ptr<Continuo
|
||||
= std::make_shared<ContinuousTaskCallbackInfo>(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<uint32_t>(continuousTaskCallbackInfo->GetTypeIds().size()));
|
||||
|
Loading…
Reference in New Issue
Block a user