mirror of
https://github.com/openharmony/notification_ces_standard.git
synced 2026-08-24 22:31:33 -04:00
fix: fix failed to publish
Signed-off-by: zengsiyu <zengsiyu3@huawei.com> Change-Id: I6a4441b23e12cfca9ef7ebeeaaf439a351960c07
This commit is contained in:
@@ -54,9 +54,20 @@ bool CommonEventProxy::PublishCommonEvent(const CommonEventData &event, const Co
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!data.WriteRemoteObject(commonEventListener)) {
|
||||
EVENT_LOGE("Failed to write parcelable commonEventListener");
|
||||
return false;
|
||||
if (commonEventListener) {
|
||||
if (!data.WriteBool(true)) {
|
||||
EVENT_LOGE("Failed to write parcelable hasLastSubscrbier");
|
||||
return false;
|
||||
}
|
||||
if (!data.WriteRemoteObject(commonEventListener)) {
|
||||
EVENT_LOGE("Failed to write parcelable commonEventListener");
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (!data.WriteBool(false)) {
|
||||
EVENT_LOGE("Failed to write parcelable hasLastSubscrbier");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!data.WriteInt32(userId)) {
|
||||
@@ -96,9 +107,20 @@ bool CommonEventProxy::PublishCommonEvent(const CommonEventData &event, const Co
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!data.WriteRemoteObject(commonEventListener)) {
|
||||
EVENT_LOGE("Failed to write parcelable commonEventListener");
|
||||
return false;
|
||||
if (commonEventListener) {
|
||||
if (!data.WriteBool(true)) {
|
||||
EVENT_LOGE("Failed to write parcelable hasLastSubscriber");
|
||||
return false;
|
||||
}
|
||||
if (!data.WriteRemoteObject(commonEventListener)) {
|
||||
EVENT_LOGE("Failed to write parcelable commonEventListener");
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (!data.WriteBool(false)) {
|
||||
EVENT_LOGE("Failed to write parcelable hasLastSubscriber");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!data.WriteInt32(uid)) {
|
||||
|
||||
@@ -37,7 +37,11 @@ int CommonEventStub::OnRemoteRequest(uint32_t code, MessageParcel &data, Message
|
||||
case static_cast<uint32_t>(ICommonEvent::Message::CES_PUBLISH_COMMON_EVENT): {
|
||||
std::unique_ptr<CommonEventData> event(data.ReadParcelable<CommonEventData>());
|
||||
std::unique_ptr<CommonEventPublishInfo> publishinfo(data.ReadParcelable<CommonEventPublishInfo>());
|
||||
sptr<IRemoteObject> commonEventListener = data.ReadRemoteObject();
|
||||
sptr<IRemoteObject> commonEventListener = nullptr;
|
||||
bool hasLastSubscriber = data.ReadBool();
|
||||
if (hasLastSubscriber) {
|
||||
sptr<IRemoteObject> commonEventListener = data.ReadRemoteObject();
|
||||
}
|
||||
int32_t userId = data.ReadInt32();
|
||||
if (!event) {
|
||||
EVENT_LOGE("Failed to ReadParcelable<CommonEventData>");
|
||||
@@ -58,7 +62,11 @@ int CommonEventStub::OnRemoteRequest(uint32_t code, MessageParcel &data, Message
|
||||
case static_cast<uint32_t>(ICommonEvent::Message::CES_PUBLISH_COMMON_EVENT2): {
|
||||
std::unique_ptr<CommonEventData> event(data.ReadParcelable<CommonEventData>());
|
||||
std::unique_ptr<CommonEventPublishInfo> publishinfo(data.ReadParcelable<CommonEventPublishInfo>());
|
||||
sptr<IRemoteObject> commonEventListener = data.ReadRemoteObject();
|
||||
sptr<IRemoteObject> commonEventListener = nullptr;
|
||||
bool hasLastSubscriber = data.ReadBool();
|
||||
if (hasLastSubscriber) {
|
||||
sptr<IRemoteObject> commonEventListener = data.ReadRemoteObject();
|
||||
}
|
||||
int uid = data.ReadInt32();
|
||||
int32_t userId = data.ReadInt32();
|
||||
if (!event) {
|
||||
|
||||
Reference in New Issue
Block a user