From 9aa17c555dde5d36178546be3f6cc2760a5e9dbb Mon Sep 17 00:00:00 2001 From: songbao1 Date: Sun, 27 Apr 2025 11:04:09 +0800 Subject: [PATCH 1/2] =?UTF-8?q?pushcheck=E7=9A=84stub=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: songbao1 --- frameworks/ans/src/push_callback_stub.cpp | 24 ++++++++--------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/frameworks/ans/src/push_callback_stub.cpp b/frameworks/ans/src/push_callback_stub.cpp index 7b317d7bf..61d686941 100644 --- a/frameworks/ans/src/push_callback_stub.cpp +++ b/frameworks/ans/src/push_callback_stub.cpp @@ -83,28 +83,20 @@ int PushCallBackStub::OnRemoteRequest(uint32_t code, MessageParcel &data, Messag auto notificationData = data.ReadString(); int32_t checkResult = ERR_ANS_TASK_ERR; - std::shared_ptr handler = std::make_shared(EventRunner::GetMainEventRunner()); - wptr weak = this; std::shared_ptr pushCallBackParam = std::make_shared(); - std::unique_lock uniqueLock(pushCallBackParam->callBackMutex); - if (handler) { - handler->PostTask([weak, notificationData, pushCallBackParam]() { - auto pushCallBackStub = weak.promote(); - if (pushCallBackStub == nullptr) { - ANS_LOGE("pushCallBackStub is nullptr!"); - return; - } - pushCallBackStub->OnCheckNotification(notificationData, pushCallBackParam); - }); - } + checkResult = this->OnCheckNotification(notificationData, pushCallBackParam); + checkResult = ConvertPushCheckCodeToErrCode(checkResult); + ANS_LOGI("Push check result:%{public}d,eventControl:%{public}d", + checkResult, pushCallBackParam->eventControl.c_str()); - pushCallBackParam->callBackCondition.wait(uniqueLock, [=]() {return pushCallBackParam->ready; }); - checkResult = ConvertPushCheckCodeToErrCode(pushCallBackParam->result); - ANS_LOGD("Push check result:%{public}d", checkResult); if (!reply.WriteInt32(checkResult)) { ANS_LOGE("Failed to write reply "); return ERR_INVALID_REPLY; } + if (!reply.WriteString(pushCallBackParam->eventControl)) { + ANS_LOGE("Failed to write reply "); + return ERR_INVALID_REPLY; + } return NO_ERROR; } -- Gitee From 0f7d8e16892dcd03d5a4702b476203478ff8e843 Mon Sep 17 00:00:00 2001 From: luojingsong Date: Tue, 29 Apr 2025 02:27:59 +0000 Subject: [PATCH 2/2] update frameworks/ans/src/push_callback_stub.cpp. Signed-off-by: luojingsong --- frameworks/ans/src/push_callback_stub.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frameworks/ans/src/push_callback_stub.cpp b/frameworks/ans/src/push_callback_stub.cpp index 61d686941..abee0fc3e 100644 --- a/frameworks/ans/src/push_callback_stub.cpp +++ b/frameworks/ans/src/push_callback_stub.cpp @@ -86,7 +86,7 @@ int PushCallBackStub::OnRemoteRequest(uint32_t code, MessageParcel &data, Messag std::shared_ptr pushCallBackParam = std::make_shared(); checkResult = this->OnCheckNotification(notificationData, pushCallBackParam); checkResult = ConvertPushCheckCodeToErrCode(checkResult); - ANS_LOGI("Push check result:%{public}d,eventControl:%{public}d", + ANS_LOGI("Push check result:%{public}d,eventControl:%{public}s", checkResult, pushCallBackParam->eventControl.c_str()); if (!reply.WriteInt32(checkResult)) { -- Gitee