diff --git a/services/ans/include/notification_extension_wrapper.h b/services/ans/include/notification_extension_wrapper.h index ae2e9a2e0f7e742eaca8c5e1ac8264023d28b264..e86d9849d1d1e741bc89001c39bc7868ae796a28 100644 --- a/services/ans/include/notification_extension_wrapper.h +++ b/services/ans/include/notification_extension_wrapper.h @@ -45,7 +45,7 @@ public: typedef bool (*NOTIFICATIONDIALOGCONTROL)(); #ifdef ENABLE_ANS_PRIVILEGED_MESSAGE_EXT_WRAPPER - typedef bool (*MODIFY_REMINDER_FLAGS)(const sptr &request); + typedef bool (*IS_PRIVILEGE_MESSAGE)(const sptr &request); typedef bool (*GET_PRIVILEGE_DIALOG_POPPED)(const sptr& bundleOption, const int32_t &userId); typedef bool (*SET_DIALOG_OPENSUCCESS_TIMESTAMP)(const sptr& bundleOption, @@ -69,6 +69,7 @@ public: bool NotificationDialogControl(); #ifdef ENABLE_ANS_PRIVILEGED_MESSAGE_EXT_WRAPPER + bool IsPrivilegeMessage(const sptr &request); bool GetPrivilegeDialogPopped(const sptr& bundleOption, const int32_t &userId); bool SetDialogOpenSuccessTimeStamp(const sptr& bundleOption, const int32_t &userId); bool SetDialogOpenSuccessTimeInterval(const sptr& bundleOption, const int32_t &userId); @@ -93,6 +94,7 @@ private: bool isRegisterDataSettingObserver = false; #ifdef ENABLE_ANS_PRIVILEGED_MESSAGE_EXT_WRAPPER + IS_PRIVILEGE_MESSAGE isPrivilegeMessage_ = nullptr; GET_PRIVILEGE_DIALOG_POPPED getPrivilegeDialogPopped_ = nullptr; SET_DIALOG_OPENSUCCESS_TIMESTAMP setDialogOpenSuccessTimeStamp_ = nullptr; SET_DIALOG_OPENSUCCESS_TIMEINTERVAL setDialogOpenSuccessTimeInterval_ = nullptr; diff --git a/services/ans/src/notification_extension_wrapper.cpp b/services/ans/src/notification_extension_wrapper.cpp index 5398af24e8bf95167653e4319ca287beebd66f53..90d9c760440447887ce1b8a4ee96a7a5a2fdb2d2 100644 --- a/services/ans/src/notification_extension_wrapper.cpp +++ b/services/ans/src/notification_extension_wrapper.cpp @@ -108,6 +108,11 @@ void ExtensionWrapper::InitExtentionWrapper() } #endif #ifdef ENABLE_ANS_PRIVILEGED_MESSAGE_EXT_WRAPPER + isPrivilegeMessage_ = (IS_PRIVILEGE_MESSAGE)dlsym(extensionWrapperHandle_, "IsPrivilegeMessage"); + if (isPrivilegeMessage_ == nullptr) { + ANS_LOGE("extension wrapper isPrivilegeMessage_ symbol failed, error: %{public}s", dlerror()); + return; + } handlePrivilegeMessage_ = (HANDLE_PRIVILEGE_MESSAGE)dlsym(extensionWrapperHandle_, "HandlePrivilegeMessage"); if (handlePrivilegeMessage_ == nullptr) { ANS_LOGE("extension wrapper handlePrivilegeMessage_ symbol failed, error: %{public}s", dlerror()); @@ -234,6 +239,15 @@ int32_t ExtensionWrapper::BannerControl(const std::string &bundleName) } #ifdef ENABLE_ANS_PRIVILEGED_MESSAGE_EXT_WRAPPER +void ExtensionWrapper::IsPrivilegeMessage(const sptr &request) +{ + if (isPrivilegeMessage_ == nullptr) { + ANS_LOGE("IsPrivilegeMessage wrapper symbol failed"); + return; + } + return isPrivilegeMessage_(bundleOption, request, isAgentController); +} + void ExtensionWrapper::HandlePrivilegeMessage(const sptr& bundleOption, const sptr &request, bool isAgentController) { diff --git a/services/ans/src/notification_smart_reminder/smart_reminder_center.cpp b/services/ans/src/notification_smart_reminder/smart_reminder_center.cpp index 72c6a7038040c651fbc783ca2e378b9dc00b0db0..3856a43871b213a2fe8b088c13f078ac88ba29ff 100644 --- a/services/ans/src/notification_smart_reminder/smart_reminder_center.cpp +++ b/services/ans/src/notification_smart_reminder/smart_reminder_center.cpp @@ -29,6 +29,9 @@ #include "bundle_manager_helper.h" #include "int_wrapper.h" #include "string_wrapper.h" +#ifdef ENABLE_ANS_PRIVILEGED_MESSAGE_EXT_WRAPPER +#include "notification_extension_wrapper.h" +#endif namespace OHOS { namespace Notification { @@ -259,6 +262,16 @@ void SmartReminderCenter::ReminderDecisionProcess(const sptr>>(); shared_ptr defaultFlag = make_shared(); NotificationConstant::SlotType slotType = request->GetSlotType(); + +#ifdef ENABLE_ANS_PRIVILEGED_MESSAGE_EXT_WRAPPER + if (EXTENTION_WRAPPER->IsPrivilegeMessage(request)) { + ANS_LOGD("Privilege message handle ReminderDecisionProcess."); + (*notificationFlagsOfDevices)[NotificationConstant::CURRENT_DEVICE_TYPE] = request->GetFlags(); + request->SetDeviceFlags(notificationFlagsOfDevices); + return; + } +#endif + auto iter = currentReminderMethods_.find(slotType); if (iter != currentReminderMethods_.end()) { // Only config file can set reminder open now. Otherwise, change iter->second to 11111