diff --git a/frameworks/ans/src/push_callback_stub.cpp b/frameworks/ans/src/push_callback_stub.cpp index 7b317d7bf25a2cd00d72a40854a0c4461d8f6a54..abee0fc3e1191caa409cbae5394709961958654e 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}s", + 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; }