1 Star 0 Fork 501

luojingsong/notification_distributed_notification_service_2

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
0001-pushcheck.patch 3.30 KB
一键复制 编辑 原始数据 按行查看 历史
luojingsong 提交于 2025-04-27 10:53 +08:00 . 111
From 2bedc77e8900cbcb4ec7f02fbf597e6d80ad4559 Mon Sep 17 00:00:00 2001
From: l30060944 <l30060944@notesmail.huawei.com/>
Date: Sun, 27 Apr 2025 10:35:49 +0800
Subject: [PATCH] pushcheck TicketNo: DTS0000000000000 Description: pushcheck
Team:OTHERS Feature or Bugfix: Bugfix Binary Source: sync from gitee
PrivateCode(Yes/No):No
Change-Id: I3666a7248b03a458e1cbe6825bc24da20f3bfdbf
---
frameworks/ans/src/push_callback_stub.cpp | 30 +++++++++--------------
1 file changed, 12 insertions(+), 18 deletions(-)
diff --git a/frameworks/ans/src/push_callback_stub.cpp b/frameworks/ans/src/push_callback_stub.cpp
index 7b317d7b..350219c1 100644
--- a/frameworks/ans/src/push_callback_stub.cpp
+++ b/frameworks/ans/src/push_callback_stub.cpp
@@ -73,7 +73,7 @@ ErrCode PushCallBackStub::ConvertPushCheckCodeToErrCode(int32_t pushCheckCode)
int PushCallBackStub::OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option)
{
- ANS_LOGD("called.");
+ ANS_LOGE("called.");
if (data.ReadInterfaceToken() != GetDescriptor()) {
ANS_LOGE("local descriptor is not equal to remote");
return ERR_INVALID_STATE;
@@ -82,29 +82,23 @@ int PushCallBackStub::OnRemoteRequest(uint32_t code, MessageParcel &data, Messag
case static_cast<uint32_t>(NotificationInterfaceCode::ON_CHECK_NOTIFICATION): {
auto notificationData = data.ReadString();
int32_t checkResult = ERR_ANS_TASK_ERR;
-
- std::shared_ptr<EventHandler> handler = std::make_shared<EventHandler>(EventRunner::GetMainEventRunner());
- wptr<PushCallBackStub> weak = this;
+ ANS_LOGE("called1.");
std::shared_ptr<PushCallBackParam> pushCallBackParam = std::make_shared<PushCallBackParam>();
- std::unique_lock<std::mutex> 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);
- });
- }
+ ANS_LOGE("called2.");
- pushCallBackParam->callBackCondition.wait(uniqueLock, [=]() {return pushCallBackParam->ready; });
- checkResult = ConvertPushCheckCodeToErrCode(pushCallBackParam->result);
- ANS_LOGD("Push check result:%{public}d", checkResult);
+ checkResult = this->OnCheckNotification(notificationData, pushCallBackParam);
+ checkResult = ConvertPushCheckCodeToErrCode(checkResult);
+ ANS_LOGI("Push check result:%{public}d", checkResult);
+ ANS_LOGI("Push check result:%{public}s", pushCallBackParam->eventControl.c_str());
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;
}
--
2.34.1
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/songbao1/notification_distributed_notification_service_2.git
git@gitee.com:songbao1/notification_distributed_notification_service_2.git
songbao1
notification_distributed_notification_service_2
notification_distributed_notification_service_2
master

搜索帮助