1# Copyright (c) 2021-2024 Huawei Device Co., Ltd. 2# Licensed under the Apache License, Version 2.0 (the "License"); 3# you may not use this file except in compliance with the License. 4# You may obtain a copy of the License at 5# 6# http://www.apache.org/licenses/LICENSE-2.0 7# 8# Unless required by applicable law or agreed to in writing, software 9# distributed under the License is distributed on an "AS IS" BASIS, 10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11# See the License for the specific language governing permissions and 12# limitations under the License. 13 14import("//base/notification/distributed_notification_service/notification.gni") 15import("//build/ohos.gni") 16 17group("ans_targets") { 18 deps = [ ":libans" ] 19} 20 21config("public_ans_config") { 22 include_dirs = [ 23 "${services_path}/ans/include", 24 "${services_path}/ans/include/notification_extension", 25 "${services_path}/ans/include/utils", 26 "${core_path}/include", 27 "${frameworks_module_reminder_path}/include", 28 ] 29} 30 31ohos_source_set("ans_service_sources") { 32 sanitize = { 33 integer_overflow = true 34 ubsan = true 35 boundary_sanitize = true 36 cfi = true 37 cfi_cross_dso = true 38 debug = false 39 } 40 branch_protector_ret = "pac_ret" 41 42 cflags = [ 43 "-fno-math-errno", 44 "-fno-unroll-loops", 45 "-fmerge-all-constants", 46 "-fno-ident", 47 "-Oz", 48 "-flto", 49 "-ffunction-sections", 50 "-fdata-sections", 51 ] 52 53 include_dirs = [ 54 "${services_path}/ans/include", 55 "${services_path}/ans/include/notification_extension", 56 "${services_path}/ans/include/utils", 57 "${services_path}/ans/src", 58 ] 59 60 defines = [] 61 62 sources = [ 63 "src/access_token_helper.cpp", 64 "src/advanced_aggregation_data_roaming_observer.cpp", 65 "src/advanced_datashare_helper.cpp", 66 "src/advanced_datashare_helper_ext.cpp", 67 "src/advanced_datashare_observer.cpp", 68 "src/advanced_notification_manager/advanced_notification_cancel.cpp", 69 "src/advanced_notification_clone_service.cpp", 70 "src/advanced_notification_event_service.cpp", 71 "src/advanced_notification_flow_control_service.cpp", 72 "src/advanced_notification_inline.cpp", 73 "src/advanced_notification_live_view_service.cpp", 74 "src/advanced_notification_manager/advanced_notification_atomic_service_publish.cpp", 75 "src/advanced_notification_manager/advanced_notification_publish.cpp", 76 "src/advanced_notification_manager/advanced_notification_query.cpp", 77 "src/advanced_notification_publish/base_publish_process.cpp", 78 "src/advanced_notification_publish/common_notification_publish_process.cpp", 79 "src/advanced_notification_publish/live_publish_process.cpp", 80 "src/advanced_notification_publish_service.cpp", 81 "src/advanced_notification_reminder_service.cpp", 82 "src/advanced_notification_service.cpp", 83 "src/advanced_notification_service_ability.cpp", 84 "src/advanced_notification_slot_service.cpp", 85 "src/advanced_notification_subscriber_service.cpp", 86 "src/advanced_notification_utils.cpp", 87 "src/badge_manager/badge_manager.cpp", 88 "src/bundle_manager_helper.cpp", 89 "src/clone/dh_notification_clone_bundle_service.cpp", 90 "src/clone/notification_clone_bundle_info.cpp", 91 "src/clone/notification_clone_bundle_service.cpp", 92 "src/clone/notification_clone_disturb_service.cpp", 93 "src/clone/notification_clone_manager.cpp", 94 "src/clone/notification_clone_util.cpp", 95 "src/common/aes_gcm_helper.cpp", 96 "src/common/file_utils.cpp", 97 "src/common/notification_analytics_util.cpp", 98 "src/common/ans_status.cpp", 99 "src/common/notification_app_privileges.cpp", 100 "src/common/notification_config_parse.cpp", 101 "src/distributed_device_status.cpp", 102 "src/distributed_manager/advanced_notification_distributed_manager_service.cpp", 103 "src/disturb_manager/advanced_notification_disturb_manager_service.cpp", 104 "src/enable_manager/enable_manager.cpp", 105 "src/enable_manager/silent_reminder_manager.cpp", 106 "src/event_report.cpp", 107 "src/liveview_all_scenarios_extension_wrapper.cpp", 108 "src/notification_dialog.cpp", 109 "src/notification_dialog_manager.cpp", 110 "src/notification_extension_wrapper.cpp", 111 "src/notification_local_live_view_subscriber_manager.cpp", 112 "src/notification_preferences.cpp", 113 "src/notification_preferences_database.cpp", 114 "src/notification_preferences_info.cpp", 115 "src/notification_rdb_data_mgr.cpp", 116 "src/notification_slot_filter.cpp", 117 "src/notification_smart_reminder/reminder_affected.cpp", 118 "src/notification_smart_reminder/smart_reminder_center.cpp", 119 "src/notification_smart_reminder/string_utils.cpp", 120 "src/notification_subscriber_manager.cpp", 121 "src/notification_timer_info.cpp", 122 "src/os_account_manager_helper.cpp", 123 "src/permission_filter.cpp", 124 "src/reminder_swing_decision_center.cpp", 125 "src/report_time_info.cpp", 126 "src/system_dialog_connect_stb.cpp", 127 "src/system_event_observer.cpp", 128 "src/system_live_view/advanced_notification_system_live_view_service.cpp", 129 "src/telephony_extension_wrapper.cpp", 130 "src/utils/notifictaion_load_utils.cpp", 131 ] 132 133 deps = [ 134 "${frameworks_module_ans_path}:ans_innerkits", 135 "${frameworks_module_ans_path}:ans_manager_stub", 136 "${frameworks_module_reminder_path}:reminder_innerkits", 137 "../ans:ans.para", 138 "../ans:ans.para.dac", 139 "../ans:external.json", 140 ] 141 142 if (distributed_notification_service_feature_all_scenario_collaboration) { 143 defines += [ "ALL_SCENARIO_COLLABORATION" ] 144 sources += [ "src/notification_extension/distributed_collaboration_service.cpp" ] 145 sources += [ "src/notification_extension/distributed_device_data_service.cpp" ] 146 sources += [ "src/notification_extension/distributed_device_manager.cpp" ] 147 sources += [ "src/notification_extension/distributed_extension_service.cpp" ] 148 sources += [ "src/notification_extension/notification_operation_service.cpp" ] 149 } 150 151 if (is_double_framework) { 152 cflags += [ "-DCONFIG_DUAL_FRAMEWORK" ] 153 } 154 155 if (distributed_notification_supported) { 156 defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ] 157 deps += [ "${services_path}/distributed:libans_distributed" ] 158 include_dirs += [ "${services_path}/distributed/include" ] 159 } 160 161 if (notification_smart_reminder_supported) { 162 defines += [ "NOTIFICATION_SMART_REMINDER_SUPPORTED" ] 163 } 164 165 external_deps = [ 166 "ability_base:configuration", 167 "ability_runtime:ability_manager", 168 "ability_runtime:app_manager", 169 "ability_runtime:appkit_native", 170 "ability_runtime:dataobs_manager", 171 "ability_runtime:extension_manager", 172 "ability_runtime:wantagent_innerkits", 173 "access_token:libaccesstoken_sdk", 174 "access_token:libtokenid_sdk", 175 "bundle_framework:appexecfwk_base", 176 "bundle_framework:appexecfwk_core", 177 "c_utils:utils", 178 "common_event_service:cesfwk_innerkits", 179 "config_policy:configpolicy_util", 180 "data_share:datashare_common", 181 "data_share:datashare_consumer", 182 "data_share:datashare_permission", 183 "device_manager:devicemanagersdk", 184 "ffrt:libffrt", 185 "hitrace:libhitracechain", 186 "i18n:intl_util", 187 "image_framework:image_native", 188 "init:libbegetutil", 189 "kv_store:distributeddata_inner", 190 "openssl:libcrypto_shared", 191 "os_account:os_account_innerkits", 192 "relational_store:native_rdb", 193 "resource_management:global_resmgr", 194 "time_service:time_client", 195 ] 196 external_deps += component_external_deps 197 198 if (device_usage) { 199 external_deps += [ "device_usage_statistics:usagestatsinner" ] 200 defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ] 201 } 202 203 if (hisysevent_usage) { 204 cflags += [ "-DHAS_HISYSEVENT_PART" ] 205 external_deps += [ "hisysevent:libhisysevent" ] 206 } 207 208 if (standby_enable) { 209 external_deps += [ "device_standby:standby_innerkits" ] 210 defines += [ "DEVICE_STANDBY_ENABLE" ] 211 } 212 213 if (player_framework) { 214 external_deps += [ "player_framework:media_client" ] 215 defines += [ "PLAYER_FRAMEWORK_ENABLE" ] 216 } 217 218 if (ans_hitrace_usage) { 219 external_deps += [ "hitrace:hitrace_meter" ] 220 defines += [ "HITRACE_METER_ENABLE" ] 221 } 222 223 if (ans_config_policy_enable) { 224 external_deps += [ "config_policy:configpolicy_util" ] 225 defines += [ "CONFIG_POLICY_ENABLE" ] 226 } 227 228 if (screenlock_mgr_enable) { 229 external_deps += [ "screenlock_mgr:screenlock_client" ] 230 defines += [ "SCREENLOCK_MGR_ENABLE" ] 231 } 232 233 if (distributed_notification_service_feature_additional_control || 234 distributed_notification_service_feature_privileged_message) { 235 defines += [ "ENABLE_ANS_EXT_WRAPPER" ] 236 } 237 238 if (distributed_notification_service_feature_privileged_message) { 239 defines += [ "ENABLE_ANS_PRIVILEGED_MESSAGE_EXT_WRAPPER" ] 240 } 241 242 if (distributed_notification_service_feature_additional_control) { 243 defines += [ "ENABLE_ANS_ADDITIONAL_CONTROL" ] 244 } 245 246 if (distributed_notification_service_feature_summary) { 247 defines += [ "ENABLE_ANS_AGGREGATION" ] 248 } 249 250 if (telephony_cust) { 251 defines += [ "ENABLE_ANS_TELEPHONY_CUST_WRAPPER" ] 252 } 253 254 if (distributed_notification_service_feature_disable_fa_model) { 255 defines += [ "ANS_DISABLE_FA_MODEL" ] 256 } 257 258 if (is_emulator) { 259 defines += [ "IS_EMULATOR" ] 260 } 261 subsystem_name = "${subsystem_name}" 262 part_name = "${component_name}" 263} 264 265ohos_shared_library("libans") { 266 sanitize = { 267 integer_overflow = true 268 ubsan = true 269 boundary_sanitize = true 270 cfi = true 271 cfi_cross_dso = true 272 debug = false 273 } 274 branch_protector_ret = "pac_ret" 275 276 shlib_type = "sa" 277 version_script = "libans.map" 278 cflags = [ 279 "-fno-math-errno", 280 "-fno-unroll-loops", 281 "-fmerge-all-constants", 282 "-fno-ident", 283 "-Oz", 284 "-flto", 285 "-ffunction-sections", 286 "-fdata-sections", 287 ] 288 sources = [] 289 290 configs = [ ":public_ans_config" ] 291 292 defines = [] 293 294 if (is_double_framework) { 295 cflags += [ "-DCONFIG_DUAL_FRAMEWORK" ] 296 } 297 298 deps = [ 299 "${services_path}/ans:ans_service_sources", 300 "../ans:ans.para", 301 "../ans:ans.para.dac", 302 "../ans:external.json", 303 ] 304 305 if (distributed_notification_supported) { 306 deps += [ "${services_path}/distributed:libans_distributed" ] 307 } 308 309 external_deps = [ 310 "ability_base:configuration", 311 "ability_runtime:ability_manager", 312 "ability_runtime:app_manager", 313 "ability_runtime:appkit_native", 314 "ability_runtime:dataobs_manager", 315 "ability_runtime:extension_manager", 316 "ability_runtime:wantagent_innerkits", 317 "access_token:libaccesstoken_sdk", 318 "access_token:libtokenid_sdk", 319 "bundle_framework:appexecfwk_base", 320 "bundle_framework:appexecfwk_core", 321 "c_utils:utils", 322 "common_event_service:cesfwk_innerkits", 323 "config_policy:configpolicy_util", 324 "data_share:datashare_common", 325 "data_share:datashare_consumer", 326 "data_share:datashare_permission", 327 "device_manager:devicemanagersdk", 328 "ffrt:libffrt", 329 "i18n:intl_util", 330 "icu:shared_icuuc", 331 "image_framework:image_native", 332 "init:libbegetutil", 333 "kv_store:distributeddata_inner", 334 "libxml2:libxml2", 335 "openssl:libcrypto_shared", 336 "os_account:os_account_innerkits", 337 "relational_store:native_rdb", 338 "resource_management:global_resmgr", 339 "time_service:time_client", 340 ] 341 external_deps += component_external_deps 342 343 if (device_usage) { 344 external_deps += [ "device_usage_statistics:usagestatsinner" ] 345 } 346 347 if (hisysevent_usage) { 348 cflags += [ "-DHAS_HISYSEVENT_PART" ] 349 external_deps += [ "hisysevent:libhisysevent" ] 350 } 351 352 if (standby_enable) { 353 external_deps += [ "device_standby:standby_innerkits" ] 354 } 355 356 if (player_framework) { 357 external_deps += [ "player_framework:media_client" ] 358 } 359 360 if (ans_hitrace_usage) { 361 external_deps += [ "hitrace:hitrace_meter" ] 362 } 363 364 if (ans_config_policy_enable) { 365 external_deps += [ "config_policy:configpolicy_util" ] 366 } 367 368 if (screenlock_mgr_enable) { 369 external_deps += [ "screenlock_mgr:screenlock_client" ] 370 } 371 372 subsystem_name = "${subsystem_name}" 373 part_name = "${component_name}" 374} 375 376ohos_prebuilt_etc("ans.para") { 377 source = "etc/ans.para" 378 relative_install_dir = "param" 379 subsystem_name = "${subsystem_name}" 380 part_name = "${component_name}" 381} 382 383ohos_prebuilt_etc("ans.para.dac") { 384 source = "etc/ans.para.dac" 385 relative_install_dir = "param" 386 subsystem_name = "${subsystem_name}" 387 part_name = "${component_name}" 388} 389 390ohos_prebuilt_etc("external.json") { 391 source = "etc/external.json" 392 relative_install_dir = "notification_template" 393 subsystem_name = "${subsystem_name}" 394 part_name = "${component_name}" 395} 396