From a22073a7f459c313b9070e3bda8863214d99b194 Mon Sep 17 00:00:00 2001 From: fangJinliang1 Date: Sat, 1 Apr 2023 21:40:50 +0800 Subject: [PATCH] fixed e6689d5 from https://gitee.com/fangJinliang1/notification_ans_standard/pulls/963 delete onCanceled Signed-off-by: fangJinliang1 Change-Id: I16b4827cf1e5d6d521357412cf684d5af43ea049 --- .../ans/src/notification_subscriber.cpp | 6 ----- .../core/include/ans_subscriber_interface.h | 8 ------ .../core/include/ans_subscriber_proxy.h | 7 ----- frameworks/core/include/ans_subscriber_stub.h | 8 ------ frameworks/core/src/ans_subscriber_proxy.cpp | 27 ------------------- frameworks/core/src/ans_subscriber_stub.cpp | 17 ------------ frameworks/js/napi/include/subscribe.h | 7 ----- frameworks/js/napi/src/subscribe.cpp | 3 --- .../inner_api/notification_subscriber.h | 9 ------- .../src/notification_subscriber_manager.cpp | 1 - .../notification_service_test.cpp | 2 -- .../include/notificationgetparam.h | 8 ------ 12 files changed, 103 deletions(-) diff --git a/frameworks/ans/src/notification_subscriber.cpp b/frameworks/ans/src/notification_subscriber.cpp index b665d1acc..83134f857 100644 --- a/frameworks/ans/src/notification_subscriber.cpp +++ b/frameworks/ans/src/notification_subscriber.cpp @@ -73,12 +73,6 @@ void NotificationSubscriber::SubscriberImpl::OnConsumed( std::make_shared(*notification), std::make_shared(*notificationMap)); } -void NotificationSubscriber::SubscriberImpl::OnCanceled(const sptr ¬ification) -{ - HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); - subscriber_.OnCanceled(std::make_shared(*notification)); -} - void NotificationSubscriber::SubscriberImpl::OnCanceled( const sptr ¬ification, const sptr ¬ificationMap, int32_t deleteReason) { diff --git a/frameworks/core/include/ans_subscriber_interface.h b/frameworks/core/include/ans_subscriber_interface.h index 601829904..b39b11d7d 100644 --- a/frameworks/core/include/ans_subscriber_interface.h +++ b/frameworks/core/include/ans_subscriber_interface.h @@ -62,13 +62,6 @@ public: virtual void OnConsumed( const sptr ¬ification, const sptr ¬ificationMap) = 0; - /** - * @brief The callback function on a notification canceled. - * - * @param notification Indicates the canceled notification. - */ - virtual void OnCanceled(const sptr ¬ification) = 0; - /** * @brief The callback function on a notification canceled. * @@ -106,7 +99,6 @@ protected: ON_DISCONNECTED, ON_CONSUMED, ON_CONSUMED_MAP, - ON_CANCELED, ON_CANCELED_MAP, ON_UPDATED, ON_DND_DATE_CHANGED, diff --git a/frameworks/core/include/ans_subscriber_proxy.h b/frameworks/core/include/ans_subscriber_proxy.h index a7c88b47b..6f0a06481 100644 --- a/frameworks/core/include/ans_subscriber_proxy.h +++ b/frameworks/core/include/ans_subscriber_proxy.h @@ -54,13 +54,6 @@ public: void OnConsumed( const sptr ¬ification, const sptr ¬ificationMap) override; - /** - * @brief The callback function on a notification canceled. - * - * @param notification Indicates the canceled notification. - */ - void OnCanceled(const sptr ¬ification) override; - /** * @brief The callback function on a notification canceled. * diff --git a/frameworks/core/include/ans_subscriber_stub.h b/frameworks/core/include/ans_subscriber_stub.h index d0772a2bd..2e4589fba 100644 --- a/frameworks/core/include/ans_subscriber_stub.h +++ b/frameworks/core/include/ans_subscriber_stub.h @@ -64,13 +64,6 @@ public: void OnConsumed( const sptr ¬ification, const sptr ¬ificationMap) override; - /** - * @brief The callback function on a notification canceled. - * - * @param notification Indicates the canceled notification. - */ - void OnCanceled(const sptr ¬ification) override; - /** * @brief The callback function on a notification canceled. * @@ -109,7 +102,6 @@ private: ErrCode HandleOnDisconnected(MessageParcel &data, MessageParcel &reply); ErrCode HandleOnConsumed(MessageParcel &data, MessageParcel &reply); ErrCode HandleOnConsumedMap(MessageParcel &data, MessageParcel &reply); - ErrCode HandleOnCanceled(MessageParcel &data, MessageParcel &reply); ErrCode HandleOnCanceledMap(MessageParcel &data, MessageParcel &reply); ErrCode HandleOnUpdated(MessageParcel &data, MessageParcel &reply); ErrCode HandleOnDoNotDisturbDateChange(MessageParcel &data, MessageParcel &reply); diff --git a/frameworks/core/src/ans_subscriber_proxy.cpp b/frameworks/core/src/ans_subscriber_proxy.cpp index 0efe13cf9..52b0d9596 100644 --- a/frameworks/core/src/ans_subscriber_proxy.cpp +++ b/frameworks/core/src/ans_subscriber_proxy.cpp @@ -154,33 +154,6 @@ void AnsSubscriberProxy::OnConsumed( } } -void AnsSubscriberProxy::OnCanceled(const sptr ¬ification) -{ - if (notification == nullptr) { - ANS_LOGE("[OnCanceled] fail: notification is nullptr."); - return; - } - - MessageParcel data; - if (!data.WriteInterfaceToken(AnsSubscriberProxy::GetDescriptor())) { - ANS_LOGE("[OnCanceled] fail: write interface token failed."); - return; - } - - if (!data.WriteParcelable(notification)) { - ANS_LOGE("[OnCanceled] fail: write notification failed."); - return; - } - - MessageParcel reply; - MessageOption option = {MessageOption::TF_ASYNC}; - ErrCode result = InnerTransact(ON_CANCELED, option, data, reply); - if (result != ERR_OK) { - ANS_LOGE("[OnCanceled] fail: transact ErrCode=ERR_ANS_TRANSACT_FAILED"); - return; - } -} - void AnsSubscriberProxy::OnCanceled( const sptr ¬ification, const sptr ¬ificationMap, int32_t deleteReason) { diff --git a/frameworks/core/src/ans_subscriber_stub.cpp b/frameworks/core/src/ans_subscriber_stub.cpp index f28c238c9..9b1e300df 100644 --- a/frameworks/core/src/ans_subscriber_stub.cpp +++ b/frameworks/core/src/ans_subscriber_stub.cpp @@ -34,8 +34,6 @@ AnsSubscriberStub::AnsSubscriberStub() std::bind(&AnsSubscriberStub::HandleOnConsumed, this, std::placeholders::_1, std::placeholders::_2)); interfaces_.emplace(ON_CONSUMED_MAP, std::bind(&AnsSubscriberStub::HandleOnConsumedMap, this, std::placeholders::_1, std::placeholders::_2)); - interfaces_.emplace(ON_CANCELED, - std::bind(&AnsSubscriberStub::HandleOnCanceled, this, std::placeholders::_1, std::placeholders::_2)); interfaces_.emplace(ON_CANCELED_MAP, std::bind(&AnsSubscriberStub::HandleOnCanceledMap, this, std::placeholders::_1, std::placeholders::_2)); interfaces_.emplace( @@ -128,18 +126,6 @@ ErrCode AnsSubscriberStub::HandleOnConsumedMap(MessageParcel &data, MessageParce return ERR_OK; } -ErrCode AnsSubscriberStub::HandleOnCanceled(MessageParcel &data, MessageParcel &reply) -{ - sptr notification = data.ReadParcelable(); - if (!notification) { - ANS_LOGW("[HandleOnCanceled] fail: notification ReadParcelable failed"); - return ERR_ANS_PARCELABLE_FAILED; - } - - OnCanceled(notification); - return ERR_OK; -} - ErrCode AnsSubscriberStub::HandleOnCanceledMap(MessageParcel &data, MessageParcel &reply) { sptr notification = data.ReadParcelable(); @@ -220,9 +206,6 @@ void AnsSubscriberStub::OnConsumed( const sptr ¬ification, const sptr ¬ificationMap) {} -void AnsSubscriberStub::OnCanceled(const sptr ¬ification) -{} - void AnsSubscriberStub::OnCanceled( const sptr ¬ification, const sptr ¬ificationMap, int32_t deleteReason) {} diff --git a/frameworks/js/napi/include/subscribe.h b/frameworks/js/napi/include/subscribe.h index 547107c67..e37a5e000 100644 --- a/frameworks/js/napi/include/subscribe.h +++ b/frameworks/js/napi/include/subscribe.h @@ -26,13 +26,6 @@ public: SubscriberInstance(); virtual ~SubscriberInstance(); - /** - * @brief Called back when a notification is canceled. - * - * @param request Indicates the canceled NotificationRequest object. - */ - virtual void OnCanceled(const std::shared_ptr &request) override; - /** * @brief Called back when a notification is canceled. * diff --git a/frameworks/js/napi/src/subscribe.cpp b/frameworks/js/napi/src/subscribe.cpp index 2cd810e4c..58a7cc2a8 100644 --- a/frameworks/js/napi/src/subscribe.cpp +++ b/frameworks/js/napi/src/subscribe.cpp @@ -146,9 +146,6 @@ SubscriberInstance::~SubscriberInstance() } } -void SubscriberInstance::OnCanceled(const std::shared_ptr &request) -{} - void UvQueueWorkOnCanceled(uv_work_t *work, int status) { ANS_LOGI("OnCanceled uv_work_t start"); diff --git a/interfaces/inner_api/notification_subscriber.h b/interfaces/inner_api/notification_subscriber.h index 973b643bf..c2a0b3535 100644 --- a/interfaces/inner_api/notification_subscriber.h +++ b/interfaces/inner_api/notification_subscriber.h @@ -30,13 +30,6 @@ public: virtual ~NotificationSubscriber(); - /** - * @brief Called back when a notification is canceled. - * - * @param request Indicates the canceled Notification object. - **/ - virtual void OnCanceled(const std::shared_ptr &request) = 0; - /** * @brief Called back when a notification is canceled. * @@ -129,8 +122,6 @@ private: void OnConsumed( const sptr ¬ification, const sptr ¬ificationMap) override; - void OnCanceled(const sptr ¬ification) override; - void OnCanceled(const sptr ¬ification, const sptr ¬ificationMap, int32_t deleteReason) override; diff --git a/services/ans/src/notification_subscriber_manager.cpp b/services/ans/src/notification_subscriber_manager.cpp index c5db56826..6dacae6fe 100644 --- a/services/ans/src/notification_subscriber_manager.cpp +++ b/services/ans/src/notification_subscriber_manager.cpp @@ -351,7 +351,6 @@ void NotificationSubscriberManager::NotifyCanceledInner( IsSystemUser(record->userId) || // Delete this, When the systemui subscribe carry the user ID. IsSystemUser(sendUserId))) { record->subscriber->OnCanceled(notification, notificationMap, deleteReason); - record->subscriber->OnCanceled(notification); } } } diff --git a/test/bechmarktest/notification_services_test/notification_service_test.cpp b/test/bechmarktest/notification_services_test/notification_service_test.cpp index 25c853c36..6bafbf51c 100644 --- a/test/bechmarktest/notification_services_test/notification_service_test.cpp +++ b/test/bechmarktest/notification_services_test/notification_service_test.cpp @@ -47,8 +47,6 @@ public: void OnEnabledNotificationChanged( const std::shared_ptr &callbackData) override {} - void OnCanceled(const std::shared_ptr &request) override - {} void OnCanceled(const std::shared_ptr &request, const std::shared_ptr &sortingMap, int deleteReason) override {} diff --git a/test/resource/notificationfuzztest/include/notificationgetparam.h b/test/resource/notificationfuzztest/include/notificationgetparam.h index e083a2b26..19d820c50 100644 --- a/test/resource/notificationfuzztest/include/notificationgetparam.h +++ b/test/resource/notificationfuzztest/include/notificationgetparam.h @@ -343,14 +343,6 @@ public: void OnDoNotDisturbDateChange(const std::shared_ptr &date) override {} - /** - * @brief Override OnCanceled. - * - * @param request The Notification type point input parameter. - */ - void OnCanceled(const std::shared_ptr &request) override - {} - /** * @brief Override OnCanceled. * -- Gitee