From e90df49d323827429cfd65cc6dcc49d3983e38f6 Mon Sep 17 00:00:00 2001 From: xinking129 Date: Wed, 31 May 2023 14:57:26 +0800 Subject: [PATCH] fix push call back stub location Signed-off-by: xinking129 --- frameworks/ans/BUILD.gn | 1 + .../ans/src/push_callback_stub.cpp | 11 ----------- frameworks/js/napi/src/manager/BUILD.gn | 1 - .../inner_api}/push_callback_proxy.h | 6 +++--- interfaces/inner_api/push_callback_stub.h | 11 ----------- services/ans/BUILD.gn | 2 +- .../ans/include/advanced_notification_service.h | 11 +++++++++++ .../ans/src/advanced_notification_service.cpp | 15 +++++++++++++-- 8 files changed, 29 insertions(+), 29 deletions(-) rename {services => frameworks}/ans/src/push_callback_stub.cpp (87%) rename {services/ans/include => interfaces/inner_api}/push_callback_proxy.h (80%) diff --git a/frameworks/ans/BUILD.gn b/frameworks/ans/BUILD.gn index 83c528687..af385ec7c 100644 --- a/frameworks/ans/BUILD.gn +++ b/frameworks/ans/BUILD.gn @@ -64,6 +64,7 @@ ohos_shared_library("ans_innerkits") { "src/notification_subscriber.cpp", "src/notification_template.cpp", "src/notification_user_input.cpp", + "src/push_callback_stub.cpp", ] configs = [ "${core_path}:public_ans_core_config" ] diff --git a/services/ans/src/push_callback_stub.cpp b/frameworks/ans/src/push_callback_stub.cpp similarity index 87% rename from services/ans/src/push_callback_stub.cpp rename to frameworks/ans/src/push_callback_stub.cpp index 7dd795b05..7ad28812f 100644 --- a/services/ans/src/push_callback_stub.cpp +++ b/frameworks/ans/src/push_callback_stub.cpp @@ -15,7 +15,6 @@ #include "push_callback_stub.h" -#include "advanced_notification_service.h" #include "ans_log_wrapper.h" #include "ipc_types.h" #include "message_parcel.h" @@ -82,15 +81,5 @@ bool PushCallBackProxy::OnCheckNotification(const std::string ¬ificationData) return reply.ReadBool(); } - -void PushCallbackRecipient::OnRemoteDied(const wptr &remote) -{ - ANS_LOGE("Push Callback died, remove the proxy object"); - AdvancedNotificationService::GetInstance()->ResetPushCallbackProxy(); -} - -PushCallbackRecipient::PushCallbackRecipient() {} - -PushCallbackRecipient::~PushCallbackRecipient() {} } // namespace Notification } // namespace OHOS diff --git a/frameworks/js/napi/src/manager/BUILD.gn b/frameworks/js/napi/src/manager/BUILD.gn index 9ec1cb5e6..5dc1f08fb 100644 --- a/frameworks/js/napi/src/manager/BUILD.gn +++ b/frameworks/js/napi/src/manager/BUILD.gn @@ -67,7 +67,6 @@ ohos_shared_library("notificationmanager") { deps = [ "${core_path}:ans_core", "${frameworks_module_ans_path}:ans_innerkits", - "${services_path}/ans:libans", ] external_deps = [ diff --git a/services/ans/include/push_callback_proxy.h b/interfaces/inner_api/push_callback_proxy.h similarity index 80% rename from services/ans/include/push_callback_proxy.h rename to interfaces/inner_api/push_callback_proxy.h index 469f00b0d..1d9dce762 100644 --- a/services/ans/include/push_callback_proxy.h +++ b/interfaces/inner_api/push_callback_proxy.h @@ -13,8 +13,8 @@ * limitations under the License. */ -#ifndef BASE_NOTIFICATION_DISTRIBUTED_NOTIFICATION_SERVICE_FRAMEWORKS_ANS_CORE_INCLUDE_PUSH_CALLBACK_PROXY_H -#define BASE_NOTIFICATION_DISTRIBUTED_NOTIFICATION_SERVICE_FRAMEWORKS_ANS_CORE_INCLUDE_PUSH_CALLBACK_PROXY_H +#ifndef BASE_NOTIFICATION_DISTRIBUTED_NOTIFICATION_SERVICE_INTERFACES_INNER_API_PUSH_CALLBACK_PROXY_H +#define BASE_NOTIFICATION_DISTRIBUTED_NOTIFICATION_SERVICE_INTERFACES_INNER_API_PUSH_CALLBACK_PROXY_H #include "push_callback_interface.h" #include "iremote_proxy.h" @@ -46,4 +46,4 @@ private: }; } // namespace Notification } // namespace OHOS -#endif // BASE_NOTIFICATION_DISTRIBUTED_NOTIFICATION_SERVICE_FRAMEWORKS_ANS_CORE_INCLUDE_PUSH_CALLBACK_PROXY_H +#endif // BASE_NOTIFICATION_DISTRIBUTED_NOTIFICATION_SERVICE_INTERFACES_INNER_API_PUSH_CALLBACK_PROXY_H diff --git a/interfaces/inner_api/push_callback_stub.h b/interfaces/inner_api/push_callback_stub.h index 4d0de0690..bfe0573be 100644 --- a/interfaces/inner_api/push_callback_stub.h +++ b/interfaces/inner_api/push_callback_stub.h @@ -39,17 +39,6 @@ public: private: DISALLOW_COPY_AND_MOVE(PushCallBackStub); }; - -/** - * @class PushCallbackRecipient - * PushCallbackRecipient notices IRemoteBroker died. - */ -class PushCallbackRecipient : public IRemoteObject::DeathRecipient { -public: - explicit PushCallbackRecipient(); - virtual ~PushCallbackRecipient(); - virtual void OnRemoteDied(const wptr &remote); -}; } // namespace Notification } // namespace OHOS #endif // BASE_NOTIFICATION_DISTRIBUTED_NOTIFICATION_SERVICE_INTERFACES_INNER_API_PUSH_CALLBACK_STUB_H diff --git a/services/ans/BUILD.gn b/services/ans/BUILD.gn index 82628d10c..3549a7629 100644 --- a/services/ans/BUILD.gn +++ b/services/ans/BUILD.gn @@ -41,7 +41,6 @@ ohos_shared_library("libans") { "src/notification_slot_filter.cpp", "src/notification_subscriber_manager.cpp", "src/permission_filter.cpp", - "src/push_callback_stub.cpp", "src/reminder_data_manager.cpp", "src/reminder_event_manager.cpp", "src/reminder_timer_info.cpp", @@ -56,6 +55,7 @@ ohos_shared_library("libans") { deps = [ "${arkui_ace_engine_path}/interfaces/inner_api/ui_service_manager:ui_service_mgr", "${core_path}:ans_core", + "${frameworks_module_ans_path}:ans_innerkits", ] if (is_double_framework) { diff --git a/services/ans/include/advanced_notification_service.h b/services/ans/include/advanced_notification_service.h index 9a026db3e..3c2477c04 100644 --- a/services/ans/include/advanced_notification_service.h +++ b/services/ans/include/advanced_notification_service.h @@ -845,6 +845,17 @@ private: bool localScreenOn_ = true; #endif }; + +/** + * @class PushCallbackRecipient + * PushCallbackRecipient notices IRemoteBroker died. + */ +class PushCallbackRecipient : public IRemoteObject::DeathRecipient { +public: + explicit PushCallbackRecipient(); + virtual ~PushCallbackRecipient(); + virtual void OnRemoteDied(const wptr &remote); +}; } // namespace Notification } // namespace OHOS diff --git a/services/ans/src/advanced_notification_service.cpp b/services/ans/src/advanced_notification_service.cpp index c98aadb89..947991570 100644 --- a/services/ans/src/advanced_notification_service.cpp +++ b/services/ans/src/advanced_notification_service.cpp @@ -48,7 +48,7 @@ #include "notification_subscriber_manager.h" #include "os_account_manager.h" #include "permission_filter.h" -#include "push_callback_stub.h" +#include "push_callback_proxy.h" #include "reminder_data_manager.h" #include "trigger_info.h" #include "ui_service_mgr_client.h" @@ -4029,8 +4029,8 @@ ErrCode AdvancedNotificationService::RegisterPushCallback(const sptrAddDeathRecipient(pushRecipient_); + pushCallBack_ = iface_cast(pushCallback); ANS_LOGD("end"); return ERR_OK; @@ -4080,6 +4080,7 @@ bool AdvancedNotificationService::IsNeedPushCheck(NotificationConstant::SlotType ErrCode AdvancedNotificationService::PushCheck(const sptr &request) { + ANS_LOGD("start."); if (pushCallBack_) { nlohmann::json jsonObject; jsonObject["pkgName"] = request->GetCreatorBundleName(); @@ -4120,5 +4121,15 @@ void AdvancedNotificationService::TriggerAutoDelete(std::string hashCode) } } } + +void PushCallbackRecipient::OnRemoteDied(const wptr &remote) +{ + ANS_LOGE("Push Callback died, remove the proxy object"); + AdvancedNotificationService::GetInstance()->ResetPushCallbackProxy(); +} + +PushCallbackRecipient::PushCallbackRecipient() {} + +PushCallbackRecipient::~PushCallbackRecipient() {} } // namespace Notification } // namespace OHOS -- Gitee