From a20058b70ef2c45584d875106664775367b47f32 Mon Sep 17 00:00:00 2001 From: xiaoshuai Date: Wed, 20 Mar 2024 11:37:14 +0800 Subject: [PATCH] =?UTF-8?q?=E9=85=8D=E7=BD=AE=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ia2e9b10104b0b1684bf7b605ac4d98e3ca41cdd2 --- .../src/notification_unified_group_info.cpp | 10 ++ frameworks/core/src/ans_manager_proxy.cpp | 3 + frameworks/core/src/ans_manager_stub.cpp | 1 + frameworks/js/napi/BUILD.gn | 1 + frameworks/js/napi/include/sync_config.h | 28 +++ .../js/napi/src/common_convert_request.cpp | 7 + frameworks/js/napi/src/init.cpp | 4 +- frameworks/js/napi/src/sync_config.cpp | 160 ++++++++++++++++++ .../notification_unified_group_Info.h | 15 ++ notification.gni | 7 + services/ans/BUILD.gn | 4 + .../ans/include/notification_ext_wrapper.h | 41 +++++ .../advanced_notification_publish_service.cpp | 2 +- .../ans/src/advanced_notification_service.cpp | 7 + .../advanced_notification_service_ability.cpp | 4 + .../advanced_notification_slot_service.cpp | 13 +- services/ans/src/notification_ext_wrapper.cpp | 52 ++++++ 17 files changed, 356 insertions(+), 3 deletions(-) create mode 100644 frameworks/js/napi/include/sync_config.h create mode 100644 frameworks/js/napi/src/sync_config.cpp create mode 100644 services/ans/include/notification_ext_wrapper.h create mode 100644 services/ans/src/notification_ext_wrapper.cpp diff --git a/frameworks/ans/src/notification_unified_group_info.cpp b/frameworks/ans/src/notification_unified_group_info.cpp index 2d29bf082..92d7442e8 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 fdb2234b6..03c2f09c4 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 5663d38e0..ba0574ecc 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 cd7d44450..33d2b4343 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 000000000..c1380d845 --- /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 d1a75461d..28a98c831 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 ae115b2bb..77222e8fc 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 000000000..7d7aa161b --- /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 93d251b57..265b9a071 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 f6991faa6..552163053 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 ab6d42cce..8f630538c 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 000000000..0f301055d --- /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 cfae29bb0..73fa526ce 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 7cf666d40..bf4b29e78 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 a0aac8f44..a668c38f6 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 e8def191a..94e31b5fc 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 000000000..68edcc5cb --- /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 -- Gitee