From ef53ec863ddf1de8b3d7e1d2310525e46c9ed7a7 Mon Sep 17 00:00:00 2001 From: liqiang Date: Mon, 7 Feb 2022 17:12:00 +0800 Subject: [PATCH] IssueNo:https://gitee.com/openharmony/notification_ans_standard/issues/I4SPVK Description: support multi-user for getwantagent api Sig: SIG_ApplicationFramework Feature or Bugfix:Feature Binary Source:No Signed-off-by: liqiang Change-Id: I38ce78683e98bce71fa5f92fdef4e1d2bdb40829 --- frameworks/wantagent/src/want_agent_helper.cpp | 3 ++- interfaces/innerkits/wantagent/include/want_agent_helper.h | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/frameworks/wantagent/src/want_agent_helper.cpp b/frameworks/wantagent/src/want_agent_helper.cpp index 58f13b142..a37de29fe 100644 --- a/frameworks/wantagent/src/want_agent_helper.cpp +++ b/frameworks/wantagent/src/want_agent_helper.cpp @@ -124,7 +124,7 @@ std::shared_ptr WantAgentHelper::GetWantAgent( return agent; } -std::shared_ptr WantAgentHelper::GetWantAgent(const WantAgentInfo ¶msInfo) +std::shared_ptr WantAgentHelper::GetWantAgent(const WantAgentInfo ¶msInfo, int32_t userId) { std::vector> wants = paramsInfo.GetWants(); if (wants.empty()) { @@ -155,6 +155,7 @@ std::shared_ptr WantAgentHelper::GetWantAgent(const WantAgentInfo &pa wantSenderInfo.bundleName = want->GetOperation().GetBundleName(); wantSenderInfo.flags = FlagsTransformer(paramsInfo.GetFlags()); wantSenderInfo.type = (int32_t)paramsInfo.GetOperationType(); + wantSenderInfo.userId = userId; sptr target = AbilityManagerClient::GetInstance()->GetWantSender(wantSenderInfo, nullptr); if (target == nullptr) { diff --git a/interfaces/innerkits/wantagent/include/want_agent_helper.h b/interfaces/innerkits/wantagent/include/want_agent_helper.h index 52ea8d983..a059e60b8 100644 --- a/interfaces/innerkits/wantagent/include/want_agent_helper.h +++ b/interfaces/innerkits/wantagent/include/want_agent_helper.h @@ -41,6 +41,7 @@ static const int FLAG_NO_CREATE = 1 << 29; static const int FLAG_CANCEL_CURRENT = 1 << 28; static const int FLAG_UPDATE_CURRENT = 1 << 27; static const int FLAG_IMMUTABLE = 1 << 26; +static const int INVLID_WANT_AGENT_USER_ID = -1; class WantAgentHelper final : public std::enable_shared_from_this { public: @@ -65,9 +66,11 @@ public: * * @param paramsInfo Indicates the WantAgentInfo object that contains parameters of the * WantAgent object to create. + * @param userId Indicates the user id for this wantagent info, default is INVLID_WANT_AGENT_USER_ID(-1). * @return Returns the created WantAgent object. */ - static std::shared_ptr GetWantAgent(const WantAgentInfo ¶msInfo); + static std::shared_ptr GetWantAgent(const WantAgentInfo ¶msInfo, + int32_t userId = INVLID_WANT_AGENT_USER_ID); /** * Obtains an WantAgent object operation type. -- Gitee