From ecd96403967037bbdbbfe690d8fafd080ec1795c Mon Sep 17 00:00:00 2001 From: zhuhan Date: Tue, 6 Dec 2022 14:26:55 +0800 Subject: [PATCH] =?UTF-8?q?fixed=20dc18155=20from=20https://gitee.com/anlu?= =?UTF-8?q?ohan/notification=5Fdistributed=5Fnotification=5Fservice/pulls/?= =?UTF-8?q?846=20=E9=80=82=E9=85=8Dwantagent=20er=20code?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhuhan Change-Id: I282ed91ec92472545cc3fa0ceb8bb3538c34c71f --- frameworks/js/napi/src/publish.cpp | 4 ++-- .../ans_innerkits_module_publish_test.cpp | 4 ++-- .../src/notificationfuzztestmanager.cpp | 15 +++++++-------- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/frameworks/js/napi/src/publish.cpp b/frameworks/js/napi/src/publish.cpp index 00a4917ee..f19f339b9 100644 --- a/frameworks/js/napi/src/publish.cpp +++ b/frameworks/js/napi/src/publish.cpp @@ -282,8 +282,8 @@ napi_value ParseShowOptions(const napi_env &env, const napi_callback_info &info, wants, extraInfo); std::shared_ptr context = AbilityRuntime::Context::GetApplicationContext(); - std::shared_ptr wantAgent = - WantAgentHelper::GetWantAgent(context, wantAgentInfo); + std::shared_ptr wantAgent = nullptr; + WantAgentHelper::GetWantAgent(context, wantAgentInfo, wantAgent); params.request.SetWantAgent(wantAgent); } diff --git a/frameworks/test/moduletest/ans_innerkits_module_publish_test.cpp b/frameworks/test/moduletest/ans_innerkits_module_publish_test.cpp index 58531df1a..86480ca49 100644 --- a/frameworks/test/moduletest/ans_innerkits_module_publish_test.cpp +++ b/frameworks/test/moduletest/ans_innerkits_module_publish_test.cpp @@ -1563,8 +1563,8 @@ HWTEST_F(AnsInnerKitsModulePublishTest, ANS_Interface_MT_Publish_09000, Function std::shared_ptr context = std::make_shared(); - std::shared_ptr wantAgent = - AbilityRuntime::WantAgent::WantAgentHelper::GetWantAgent(context, paramsInfo); + std::shared_ptr wantAgent = nullptr; + AbilityRuntime::WantAgent::WantAgentHelper::GetWantAgent(context, paramsInfo, wantAgent); EXPECT_NE(wantAgent, nullptr); NotificationRequest req; diff --git a/test/resource/notificationfuzztest/src/notificationfuzztestmanager.cpp b/test/resource/notificationfuzztest/src/notificationfuzztestmanager.cpp index 09ac94234..adce696dc 100644 --- a/test/resource/notificationfuzztest/src/notificationfuzztestmanager.cpp +++ b/test/resource/notificationfuzztest/src/notificationfuzztestmanager.cpp @@ -487,7 +487,8 @@ void NotificationFuzzTestManager::RegisterWantAgentHelper() callFunctionMap_.emplace("WantAgentHelperGetWantAgentAppExecFwkparamsInfo", []() { std::shared_ptr context = OHOS::AbilityRuntime::Context::GetApplicationContext(); const OHOS::AbilityRuntime::WantAgent::WantAgentInfo paramsInfo = *GetParamWantAgentInfo(); - OHOS::AbilityRuntime::AbilityRuntime::WantAgent::WantAgentHelper::GetWantAgent(context, paramsInfo); + std::shared_ptr wantAgent = nullptr; + OHOS::AbilityRuntime::AbilityRuntime::WantAgent::WantAgentHelper::GetWantAgent(context, paramsInfo, wantAgent); }); callFunctionMap_.emplace("WantAgentHelperGetWantAgentparamsInfo", []() { @@ -517,21 +518,19 @@ void NotificationFuzzTestManager::RegisterWantAgentHelper() const std::shared_ptr agent = GetParamWantAgent(); const std::shared_ptr otherAgent = GetParamWantAgent(); - OHOS::AbilityRuntime::AbilityRuntime::WantAgent::WantAgentHelper::JudgeEquality(agent, otherAgent); - }); - callFunctionMap_.emplace("WantAgentHelperGetHashCode", []() { - const std::shared_ptr agent = GetParamWantAgent(); - OHOS::AbilityRuntime::AbilityRuntime::WantAgent::WantAgentHelper::GetHashCode(agent); + OHOS::AbilityRuntime::AbilityRuntime::WantAgent::WantAgentHelper::IsEquals(agent, otherAgent); }); callFunctionMap_.emplace("WantAgentHelperGetBundleName", []() { const std::shared_ptr agent = GetParamWantAgent(); - OHOS::AbilityRuntime::AbilityRuntime::WantAgent::WantAgentHelper::GetBundleName(agent); + std::string bundleName = ""; + OHOS::AbilityRuntime::AbilityRuntime::WantAgent::WantAgentHelper::GetBundleName(agent, bundleName); }); callFunctionMap_.emplace("WantAgentHelperGetUid", []() { const std::shared_ptr agent = GetParamWantAgent(); - OHOS::AbilityRuntime::AbilityRuntime::WantAgent::WantAgentHelper::GetUid(agent); + int32_t uid = -1; + OHOS::AbilityRuntime::AbilityRuntime::WantAgent::WantAgentHelper::GetUid(agent, uid); }); callFunctionMap_.emplace("WantAgentHelperGetWant", []() { -- Gitee