diff --git a/frameworks/ans/src/notification_unified_group_info.cpp b/frameworks/ans/src/notification_unified_group_info.cpp index 2d29bf0824bef4f80926032e67911dcc0870b2bc..92d7442e807d3b5fdd03405caaab4659b56a92ba 100644 --- a/frameworks/ans/src/notification_unified_group_info.cpp +++ b/frameworks/ans/src/notification_unified_group_info.cpp @@ -64,6 +64,16 @@ void NotificationUnifiedGroupInfo::SetSceneName(const std::string &sceneName) sceneName_ = sceneName; } +std::string NotificationUnifiedGroupInfo::GetScene() const +{ + return scene_; +} + +void NotificationUnifiedGroupInfo::SetScene(const std::string &scene) +{ + scene_ = scene; +} + std::shared_ptr NotificationUnifiedGroupInfo::GetExtraInfo() const { diff --git a/frameworks/core/src/ans_manager_proxy.cpp b/frameworks/core/src/ans_manager_proxy.cpp index fdb2234b6abeb6dbdd47ff5cc3b9083f0a980c1b..03c2f09c4140a1bb4cbba06419b06c6afc4d7d92 100644 --- a/frameworks/core/src/ans_manager_proxy.cpp +++ b/frameworks/core/src/ans_manager_proxy.cpp @@ -36,6 +36,9 @@ AnsManagerProxy::~AnsManagerProxy() ErrCode AnsManagerProxy::Publish(const std::string &label, const sptr ¬ification) { + // todo 判断groupinfo是否为空,空:不支持聚合,不加载闭源组件 + // 超时机制:超时时间1S + // 异常处理机制:闭源执行失败透传原通知 if (notification == nullptr) { ANS_LOGE("[Publish] fail: notification is null ptr."); return ERR_ANS_INVALID_PARAM; diff --git a/frameworks/core/src/ans_manager_stub.cpp b/frameworks/core/src/ans_manager_stub.cpp index 5663d38e0986a53531cd414a2594a31ce68bfd8b..ba0574ecc069e4b44598457586aefd152fabeeed 100644 --- a/frameworks/core/src/ans_manager_stub.cpp +++ b/frameworks/core/src/ans_manager_stub.cpp @@ -347,6 +347,7 @@ int32_t AnsManagerStub::OnRemoteRequest(uint32_t code, MessageParcel &data, Mess ErrCode AnsManagerStub::HandlePublish(MessageParcel &data, MessageParcel &reply) { + // todo 111 std::string label; if (!data.ReadString(label)) { ANS_LOGE("[HandlePublish] fail: read label failed"); diff --git a/frameworks/js/napi/BUILD.gn b/frameworks/js/napi/BUILD.gn index cd7d44450094564324b1653a28b185a0f7a15e8d..33d2b4343b725b4d40bcd994dbacc669ffe02710 100644 --- a/frameworks/js/napi/BUILD.gn +++ b/frameworks/js/napi/BUILD.gn @@ -85,6 +85,7 @@ ohos_shared_library("notification") { "src/slot.cpp", "src/subscribe.cpp", "src/unsubscribe.cpp", + "src/sync_config.cpp" ] deps = [ "${frameworks_module_ans_path}:ans_innerkits" ] diff --git a/frameworks/js/napi/include/sync_config.h b/frameworks/js/napi/include/sync_config.h new file mode 100644 index 0000000000000000000000000000000000000000..c1380d845c02fc499f63d46bbb4db57777744688 --- /dev/null +++ b/frameworks/js/napi/include/sync_config.h @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#ifndef BASE_NOTIFICATION_DISTRIBUTED_NOTIFICATION_SERVICE_FRAMEWORKS_JS_NAPI_INCLUDE_SYNC_CONFIG_H +#define BASE_NOTIFICATION_DISTRIBUTED_NOTIFICATION_SERVICE_FRAMEWORKS_JS_NAPI_INCLUDE_SYNC_CONFIG_H + +#include "common.h" + +namespace OHOS { +namespace NotificationNapi { +using namespace OHOS::Notification; + +napi_value NapiSetAdditionConfig(napi_env env, napi_callback_info info); + +} // namespace NotificationNapi +} // namespace OHOS +#endif // BASE_NOTIFICATION_DISTRIBUTED_NOTIFICATION_SERVICE_FRAMEWORKS_JS_NAPI_INCLUDE_SYNC_CONFIG_H diff --git a/frameworks/js/napi/src/common_convert_request.cpp b/frameworks/js/napi/src/common_convert_request.cpp index d1a75461d83add7f66c37b36faf9b0c154e2e909..28a98c8318e803cbc3fef3cc0508742425a159af 100644 --- a/frameworks/js/napi/src/common_convert_request.cpp +++ b/frameworks/js/napi/src/common_convert_request.cpp @@ -1770,6 +1770,13 @@ napi_value Common::GetNotificationUnifiedGroupInfo( unifiedGroupInfo->SetSceneName(sceneName); } + // scene?: string + jsValue = AppExecFwk::GetPropertyValueByPropertyName(env, info, "scene", napi_string); + if (jsValue != nullptr) { + std::string scene = AppExecFwk::UnwrapStringFromJS(env, jsValue); + unifiedGroupInfo->SetScene(scene); + } + // extraInfo?: {[key:string] : any} jsValue = AppExecFwk::GetPropertyValueByPropertyName(env, info, "extraInfo", napi_object); if (jsValue != nullptr) { diff --git a/frameworks/js/napi/src/init.cpp b/frameworks/js/napi/src/init.cpp index ae115b2bb27a5b8fbe837fae5fb1bbec97f8960c..77222e8fc685581d266df710ec5a5790f3dcbd27 100644 --- a/frameworks/js/napi/src/init.cpp +++ b/frameworks/js/napi/src/init.cpp @@ -28,6 +28,7 @@ #include "slot.h" #include "subscribe.h" #include "unsubscribe.h" +#include "sync_config.h" namespace OHOS { namespace NotificationNapi { @@ -83,6 +84,7 @@ napi_value NotificationInit(napi_env env, napi_value exports) DECLARE_NAPI_FUNCTION("isNotificationSlotEnabled", IsEnableNotificationSlot), DECLARE_NAPI_FUNCTION("setSyncNotificationEnabledWithoutApp", SetSyncNotificationEnabledWithoutApp), DECLARE_NAPI_FUNCTION("getSyncNotificationEnabledWithoutApp", GetSyncNotificationEnabledWithoutApp), + DECLARE_NAPI_FUNCTION("setAdditionConfig", NapiSetAdditionConfig), }; NAPI_CALL(env, napi_define_properties(env, exports, sizeof(desc) / sizeof(desc[0]), desc)); @@ -116,4 +118,4 @@ __attribute__((constructor)) void RegisterModule(void) } EXTERN_C_END } // namespace NotificationNapi -} // namespace OHOS \ No newline at end of file +} // namespace OHOS diff --git a/frameworks/js/napi/src/sync_config.cpp b/frameworks/js/napi/src/sync_config.cpp new file mode 100644 index 0000000000000000000000000000000000000000..7d7aa161b05ef81d9f6cf1c8eed9430f0c696e8b --- /dev/null +++ b/frameworks/js/napi/src/sync_config.cpp @@ -0,0 +1,160 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "sync_config.h" +#include "common.h" +#include "napi_common_util.h" +#include "ans_inner_errors.h" + +namespace OHOS { +namespace NotificationNapi { +namespace { +constexpr int8_t SETADDITION_CONFIG_MAX = 3; +constexpr int8_t SETADDITION_CONFIG_MIN = 2; +constexpr char KET_NAME[] = "AGGREGATE_CONFIG"; +} + +struct ConfigParams { + std::string key = ""; + std::string value = ""; + napi_ref callback = nullptr; +}; + +struct AsyncCallbackInfoConfig { + napi_env env = nullptr; + napi_async_work asyncWork = nullptr; + ConfigParams params; + CallbackPromiseInfo info; +}; + +napi_value ParseParameters(const napi_env &env, const napi_callback_info &info, ConfigParams ¶ms) +{ + ANS_LOGD("enter"); + + size_t argc = SETADDITION_CONFIG_MAX; + napi_value argv[SETADDITION_CONFIG_MAX] = {nullptr}; + napi_value thisVar = nullptr; + NAPI_CALL(env, napi_get_cb_info(env, info, &argc, argv, &thisVar, NULL)); + if (argc < SETADDITION_CONFIG_MIN) { + ANS_LOGW("Wrong number of arguments"); + return nullptr; + } + + napi_valuetype valuetype = napi_undefined; + // argv[0]: key: string + NAPI_CALL(env, napi_typeof(env, argv[PARAM0], &valuetype)); + if (valuetype != napi_string) { + ANS_LOGW("Wrong argument type. String expected."); + return nullptr; + } + char keyStr[STR_MAX_SIZE] = {0}; + size_t keyStrLen = 0; + NAPI_CALL(env, napi_get_value_string_utf8(env, argv[PARAM0], keyStr, STR_MAX_SIZE - 1, &keyStrLen)); + params.key=keyStr; + if (std::strlen(keyStr) == 0 || (strcmp(keyStr, KET_NAME) != 0)) { + ANS_LOGW("Wrong argument type. String expected."); + return nullptr; + } + + // argv[1]: key: string + NAPI_CALL(env, napi_typeof(env, argv[PARAM1], &valuetype)); + if (valuetype != napi_string) { + ANS_LOGW("Wrong argument type. String expected."); + return nullptr; + } + char valueStr[STR_MAX_SIZE] = {0}; + size_t valstrLen = 0; + NAPI_CALL(env, napi_get_value_string_utf8(env, argv[PARAM1], valueStr, STR_MAX_SIZE - 1, &valstrLen)); + params.value=valueStr; + + // argv[2]: callback + if (argc >= SETADDITION_CONFIG_MAX) { + NAPI_CALL(env, napi_typeof(env, argv[PARAM2], &valuetype)); + if (valuetype != napi_function) { + ANS_LOGW("Callback is not function excute promise."); + return Common::NapiGetNull(env); + } + // 1:引用计数 + napi_create_reference(env, argv[PARAM2], 1, ¶ms.callback); + } + + return Common::NapiGetNull(env); +} + +napi_value NapiSetAdditionConfig(napi_env env, napi_callback_info info) +{ + ANS_LOGD("enter"); + ConfigParams params {}; + if (ParseParameters(env, info, params) == nullptr) { + // todo 返回OHOS::ERRCode + // 待验证 + Common::NapiThrow(env, ERROR_PARAM_INVALID); + return Common::NapiGetUndefined(env); + } + + AsyncCallbackInfoConfig *asynccallbackinfo = + new (std::nothrow) AsyncCallbackInfoConfig {.env = env, .asyncWork = nullptr, .params = params}; + if (!asynccallbackinfo) { + return Common::JSParaError(env, params.callback); + } + napi_value promise = nullptr; + Common::PaddingCallbackPromiseInfo(env, params.callback, asynccallbackinfo->info, promise); + + napi_value resourceName = nullptr; + napi_create_string_latin1(env, "setAdditionConfig", NAPI_AUTO_LENGTH, &resourceName); + // Asynchronous function call + napi_create_async_work(env, + nullptr, + resourceName, + [](napi_env env, void *data) { + ANS_LOGI("SetAdditionConfig work excute."); + AsyncCallbackInfoConfig *asynccallbackinfo = static_cast(data); + if (asynccallbackinfo) { + ANS_LOGI("asynccallbackinfo->params.key = %{public}s", + asynccallbackinfo->params.key.c_str()); + asynccallbackinfo->info.errorCode = + NotificationHelper::SetAdditionConfig(asynccallbackinfo->params.key,asynccallbackinfo->params.value); + } + }, + [](napi_env env, napi_status status, void *data) { + ANS_LOGI("SetAdditionConfig work complete."); + AsyncCallbackInfoConfig *asynccallbackinfo = static_cast(data); + if (asynccallbackinfo) { + Common::ReturnCallbackPromise(env, asynccallbackinfo->info, Common::NapiGetNull(env)); + if (asynccallbackinfo->info.callback != nullptr) { + ANS_LOGD("Set AdditionConfig callback reference."); + napi_delete_reference(env, asynccallbackinfo->info.callback); + } + napi_delete_async_work(env, asynccallbackinfo->asyncWork); + delete asynccallbackinfo; + asynccallbackinfo = nullptr; + } + ANS_LOGD("SetAdditionConfig work complete end."); + }, + (void *)asynccallbackinfo, + &asynccallbackinfo->asyncWork); + + napi_queue_async_work_with_qos(env, asynccallbackinfo->asyncWork, napi_qos_user_initiated); + + if (asynccallbackinfo->info.isCallback) { + ANS_LOGD("SetAdditionConfig callback is nullptr."); + return Common::NapiGetNull(env); + } else { + return promise; + } +} + +} // namespace NotificationNapi +} // namespace OHOS diff --git a/interfaces/inner_api/notification_unified_group_Info.h b/interfaces/inner_api/notification_unified_group_Info.h index 93d251b574dedf7958c273a4bf1cd85c76156821..265b9a0715b8e3874de98c3aa094a8ee70ad8e2a 100644 --- a/interfaces/inner_api/notification_unified_group_Info.h +++ b/interfaces/inner_api/notification_unified_group_Info.h @@ -85,6 +85,20 @@ public: */ void SetSceneName(const std::string &sceneName); + /** + * @brief Obtains the scene of unified group info. + * + * @return Returns the scene of aggregation scenario. + */ + std::string GetScene() const; + + /** + * @brief Set the scene of unified group info. + * + * @param scene the scene of unified group info. + */ + void SetScene(const std::string &scene); + /** * @brief Obtains the WantParams object set in the unified group info. * @@ -136,6 +150,7 @@ private: std::string title_ {}; std::string content_ {}; std::string sceneName_ {}; + std::string scene_ {}; std::shared_ptr extraInfo_ {}; }; } // namespace Notification diff --git a/notification.gni b/notification.gni index f6991faa6ad1bce180b2d86691c0f16cefd19198..5521630533ca2960b56a59be72c7ebbe0d1b0938 100644 --- a/notification.gni +++ b/notification.gni @@ -48,12 +48,15 @@ component_external_deps = [ "samgr:samgr_proxy", ] +notification_default_defines= [] + declare_args() { device_usage = true hisysevent_usage = true standby_enable = true player_framework = true ans_hitrace_usage = true + notification_ext_feature_summary = false if (defined(global_parts_info) && !defined(global_parts_info.resourceschedule_device_usage_statistics)) { @@ -80,6 +83,10 @@ declare_args() { ans_hitrace_usage = false } + if (defined(notification_ext_feature_summary)) { + notification_default_defines += ["OHOS_BUILD_ENABLE_NOTIFICATION_WRAPPER"] + } + print("hisysevent_usage = " + "$hisysevent_usage") print("ans_hitrace_usage = " + "$ans_hitrace_usage") } diff --git a/services/ans/BUILD.gn b/services/ans/BUILD.gn index ab6d42ccecfb19111e5bd878f541decacfbbef88..8f630538c7f7c16dc90cb515c23a0257cd0b0e8e 100644 --- a/services/ans/BUILD.gn +++ b/services/ans/BUILD.gn @@ -149,6 +149,10 @@ ohos_shared_library("libans") { defines += [ "HITRACE_METER_ENABLE" ] } + if (notification_ext_feature_summary) { + defines += [ "OHOS_BUILD_ENABLE_WRAPPER" ] + } + subsystem_name = "${subsystem_name}" part_name = "${component_name}" } diff --git a/services/ans/include/notification_ext_wrapper.h b/services/ans/include/notification_ext_wrapper.h new file mode 100644 index 0000000000000000000000000000000000000000..0f301055dae7c00ec1d6f32ec798c4d9ce4d38cd --- /dev/null +++ b/services/ans/include/notification_ext_wrapper.h @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef BASE_NOTIFICATION_DISTRIBUTED_NOTIFICATION_SERVICE_SERVICES_ANS_INCLUDE_NOTIFICATION_EXT_WRAPPER_H +#define BASE_NOTIFICATION_DISTRIBUTED_NOTIFICATION_SERVICE_SERVICES_ANS_INCLUDE_NOTIFICATION_EXT_WRAPPER_H + +#include +#include "notification_request.h" +#include "singleton.h" + +namespace OHOS { +namespace Notification { +class NotificationExtWrapper final{ +public: + void InitNotificationExtWrapper(); + typedef OHOS::ErrCode (*SET_ADDITION_CONFIG)(const std::string& ,const std::string&); + typedef OHOS::ErrCode (*GET_UNIFIED_GROUP_INFO)(const NotificationRequest& ,const int32_t&,const NotificationUnifiedGroupInfo&); + SET_ADDITION_CONFIG setAdditionConfig_ = nullptr; + GET_UNIFIED_GROUP_INFO getUnifiedGroupInfo_ = nullptr; +private: + void* NotificationExtWrapperHandle_ = nullptr; + + DECLARE_DELAYED_SINGLETON(NotificationExtWrapper) +}; +#define NOTIFICATIONEXT_WRAPPER ::OHOS::DelayedSingleton::GetInstance() +} // namespace Notification +} // namespace OHOS + +#endif // BASE_NOTIFICATION_DISTRIBUTED_NOTIFICATION_SERVICE_SERVICES_ANS_INCLUDE_NOTIFICATION_EXT_WRAPPER_H diff --git a/services/ans/src/advanced_notification_publish_service.cpp b/services/ans/src/advanced_notification_publish_service.cpp index cfae29bb048622fed0ed27c31486d68050d4f9ab..73fa526ceb35117831f7736e56ce4eab149f6977 100644 --- a/services/ans/src/advanced_notification_publish_service.cpp +++ b/services/ans/src/advanced_notification_publish_service.cpp @@ -132,7 +132,7 @@ ErrCode AdvancedNotificationService::Publish(const std::string &label, const spt ANS_LOGE("DLP hap not allowed to send notifications"); break; } - + // TODO 1111 sptr bundleOption; result = PrepareNotificationInfo(request, bundleOption); if (result != ERR_OK) { diff --git a/services/ans/src/advanced_notification_service.cpp b/services/ans/src/advanced_notification_service.cpp index 7cf666d409796111a1c573b81e6c8775e1cef0ea..bf4b29e789d389f6b9528325b3d7d4ef61df9d48 100644 --- a/services/ans/src/advanced_notification_service.cpp +++ b/services/ans/src/advanced_notification_service.cpp @@ -548,6 +548,13 @@ ErrCode AdvancedNotificationService::PublishPreparedNotification( return result; } + if(request->GetUnifiedGroupInfo() != nullptr){ +#ifdef OHOS_BUILD_ENABLE_NOTIFICATION_WRAPPER + if(NOTIFICATIONEXT_WRAPPER->getUnifiedGroupInfo_){ + NOTIFICATIONEXT_WRAPPER->getUnifiedGroupInfo_(request,request->IsAgentNotification(),request->GetUnifiedGroupInfo()); + } +#endif + } ffrt::task_handle handler = notificationSvrQueue_->submit_h(std::bind([&]() { ANS_LOGD("ffrt enter!"); if (DuplicateMsgControl(record->request) == ERR_ANS_DUPLICATE_MSG) { diff --git a/services/ans/src/advanced_notification_service_ability.cpp b/services/ans/src/advanced_notification_service_ability.cpp index a0aac8f44e1be097accb9f8f6fd5f6581859e425..a668c38f6e2c383c8de491f06155242308bdc185 100644 --- a/services/ans/src/advanced_notification_service_ability.cpp +++ b/services/ans/src/advanced_notification_service_ability.cpp @@ -14,6 +14,7 @@ */ #include "advanced_notification_service_ability.h" +#include "notification_ext_wrapper.h" namespace OHOS { namespace Notification { @@ -40,6 +41,9 @@ void AdvancedNotificationServiceAbility::OnStart() } service_->CreateDialogManager(); reminderAgent_ = ReminderDataManager::InitInstance(service_); +#ifdef OHOS_BUILD_ENABLE_NOTIFICATION_WRAPPER + NOTIFICATIONEXT_WRAPPER->InitNotificationExtWrapper(); +#endif } void AdvancedNotificationServiceAbility::OnStop() diff --git a/services/ans/src/advanced_notification_slot_service.cpp b/services/ans/src/advanced_notification_slot_service.cpp index e8def191aeefeb22183b998d264a21f09eeb1b00..94e31b5fc4879a22489870c6fd3aa122ac4c0fae 100644 --- a/services/ans/src/advanced_notification_slot_service.cpp +++ b/services/ans/src/advanced_notification_slot_service.cpp @@ -28,7 +28,7 @@ #include "common_event_support.h" #include "hitrace_meter_adapter.h" #include "ipc_skeleton.h" - +#include "notification_ext_wrapper.h" #include "advanced_notification_inline.cpp" namespace OHOS { @@ -715,6 +715,17 @@ ErrCode AdvancedNotificationService::SetAdditionConfig(const std::string &key, c return ERR_ANS_INVALID_PARAM; } + if (!CheckPermission(OHOS_PERMISSION_NOTIFICATION_AGENT_CONTROLLER)) { + return ERR_ANS_PERMISSION_DENIED; + } + +#ifdef OHOS_BUILD_ENABLE_NOTIFICATION_WRAPPER + if(NOTIFICATIONEXT_WRAPPER.setAdditionConfig_ != nullptr){ + NOTIFICATIONEXT_WRAPPER.setAdditionConfig_(key,value); + } +#endif + + ErrCode result = ERR_OK; ffrt::task_handle handler = notificationSvrQueue_->submit_h(std::bind([&]() { ANS_LOGD("ffrt enter!"); diff --git a/services/ans/src/notification_ext_wrapper.cpp b/services/ans/src/notification_ext_wrapper.cpp new file mode 100644 index 0000000000000000000000000000000000000000..68edcc5cb4a7c1c7bed30698d793c7d6179d57ca --- /dev/null +++ b/services/ans/src/notification_ext_wrapper.cpp @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "notification_ext_wrapper.h" + +#include + +namespace OHOS { +namespace Notification { +namespace { + const::std::string NOTIFICATION_EXT_WRAPPER_PATH = "libans_ext.z.so"; +} +NotificationExtWrapper::NotificationExtWrapper() {} + +NotificationExtWrapper::~NotificationExtWrapper() +{ + ANS_LOGE("start release ntf ext wrapper"); + dlclose(notificationExtWrapperHandle_); + notificationExtWrapperHandle_ = nullptr +} + +void NotificationExtWrapper::InitNotificationExtWrapper(const wptr &object) +{ + ANS_LOGE("NotificationExtWrapper init ..."); + notificationExtWrapperHandle_ = dlopen(NOTIFICATION_EXT_WRAPPER_PATH.c_str(),RTLD_NOW); + if (notificationExtWrapperHandle_ == nullptr){ + ANS_LOGE("libans_ext.z.so was not loaded, error: %{public}s",dlerror()); + return; + } + + setAdditionConfig_ = (SET_ADDITION_CONFIG)dlsym(notificationExtWrapperHandle_,"SetAdditionConfig"); + getUnifiedGroupInfo_ = (GET_UNIFIED_GROUP_INFO)dlsym(notificationExtWrapperHandle_,"GetUnifiedGroupInfo"); + if(setAdditionConfig_ == nullptr || getUnifiedGroupInfo_ == nullptr ) { + ANS_LOGE("notificationext wrapper symbol failed, error: %{public}s",dlerror()); + } + return; +} + +} // namespace Notification +} // namespace OHOS