diff --git a/frameworks/wantagent/src/want_agent_helper.cpp b/frameworks/wantagent/src/want_agent_helper.cpp index 58f13b14279588886a168ce0f95c26096d925734..a37de29fedee8116f20366d40c9c5654567f65c6 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 52ea8d9834df9aa417a20d5880035047c69f349c..a059e60b8df8489db0aa30ab9e0fe7f0e861c132 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.