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/disturb_manager", 56 "${services_path}/ans/include/notification_extension", 57 "${services_path}/ans/include/utils", 58 "${services_path}/ans/include/slot_manager", 59 ] 60 61 defines = [] 62 63 sources = [ 64 "src/access_token_helper.cpp", 65 "src/advanced_aggregation_data_roaming_observer.cpp", 66 "src/advanced_datashare_helper.cpp", 67 "src/advanced_datashare_helper_ext.cpp", 68 "src/advanced_datashare_observer.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_publish/base_publish_process.cpp", 75 "src/advanced_notification_publish/common_notification_publish_process.cpp", 76 "src/advanced_notification_publish/live_publish_process.cpp", 77 "src/advanced_notification_publish_service.cpp", 78 "src/advanced_notification_reminder_service.cpp", 79 "src/advanced_notification_service.cpp", 80 "src/advanced_notification_service_ability.cpp", 81 "src/advanced_notification_slot_service.cpp", 82 "src/advanced_notification_subscriber_service.cpp", 83 "src/advanced_notification_utils.cpp", 84 "src/ans_manager_stub.cpp", 85 "src/ans_manager_stub_invalid.cpp", 86 "src/bundle_manager_helper.cpp", 87 "src/clone/notification_clone_bundle_info.cpp", 88 "src/clone/notification_clone_bundle_service.cpp", 89 "src/clone/notification_clone_disturb_service.cpp", 90 "src/clone/notification_clone_manager.cpp", 91 "src/clone/notification_clone_util.cpp", 92 "src/common/aes_gcm_helper.cpp", 93 "src/common/file_utils.cpp", 94 "src/common/notification_analytics_util.cpp", 95 "src/common/notification_app_privileges.cpp", 96 "src/common/notification_config_parse.cpp", 97 "src/distributed_device_status.cpp", 98 "src/disturb_manager/add_do_not_disturb_profiles.cpp", 99 "src/disturb_manager/disturb_manager.cpp", 100 "src/disturb_manager/does_support_do_not_disturb_mode.cpp", 101 "src/disturb_manager/get_do_not_disturb_date.cpp", 102 "src/disturb_manager/get_do_not_disturb_profile.cpp", 103 "src/disturb_manager/remove_do_not_disturb_profiles.cpp", 104 "src/disturb_manager/set_do_not_disturb_date.cpp", 105 "src/event_report.cpp", 106 "src/liveview_all_scenarios_extension_wrapper.cpp", 107 "src/notification_dialog.cpp", 108 "src/notification_dialog_manager.cpp", 109 "src/notification_extension/distributed_device_manager.cpp", 110 "src/notification_extension/distributed_extension_service.cpp", 111 "src/notification_extension/notification_operation_service.cpp", 112 "src/notification_extension_wrapper.cpp", 113 "src/notification_local_live_view_subscriber_manager.cpp", 114 "src/notification_preferences.cpp", 115 "src/notification_preferences_database.cpp", 116 "src/notification_preferences_info.cpp", 117 "src/notification_rdb_data_mgr.cpp", 118 "src/notification_slot_filter.cpp", 119 "src/notification_smart_reminder/reminder_affected.cpp", 120 "src/notification_smart_reminder/smart_reminder_center.cpp", 121 "src/notification_smart_reminder/string_utils.cpp", 122 "src/notification_subscriber_manager.cpp", 123 "src/notification_timer_info.cpp", 124 "src/os_account_manager_helper.cpp", 125 "src/permission_filter.cpp", 126 "src/reminder_swing_decision_center.cpp", 127 "src/report_time_info.cpp", 128 "src/system_dialog_connect_stb.cpp", 129 "src/system_event_observer.cpp", 130 "src/telephony_extension_wrapper.cpp", 131 "src/utils/notifictaion_load_utils.cpp", 132 ] 133 134 sources += [ 135 "src/slot_manager/AddSlots.cpp", 136 "src/slot_manager/setNotificationEnableSlot.cpp", 137 "src/slot_manager/slot_manager.cpp", 138 ] 139 140 deps = [ 141 "${frameworks_module_ans_path}:ans_innerkits", 142 "${frameworks_module_reminder_path}:reminder_innerkits", 143 "../ans:ans.para", 144 "../ans:ans.para.dac", 145 "../ans:external.json", 146 ] 147 148 if (is_double_framework) { 149 cflags += [ "-DCONFIG_DUAL_FRAMEWORK" ] 150 } 151 152 if (distributed_notification_supported) { 153 defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ] 154 deps += [ "${services_path}/distributed:libans_distributed" ] 155 include_dirs += [ "${services_path}/distributed/include" ] 156 } 157 158 if (notification_smart_reminder_supported) { 159 defines += [ "NOTIFICATION_SMART_REMINDER_SUPPORTED" ] 160 } 161 162 external_deps = [ 163 "ability_base:configuration", 164 "ability_runtime:ability_manager", 165 "ability_runtime:app_manager", 166 "ability_runtime:appkit_native", 167 "ability_runtime:dataobs_manager", 168 "ability_runtime:extension_manager", 169 "ability_runtime:wantagent_innerkits", 170 "access_token:libaccesstoken_sdk", 171 "access_token:libtokenid_sdk", 172 "bundle_framework:appexecfwk_base", 173 "bundle_framework:appexecfwk_core", 174 "c_utils:utils", 175 "common_event_service:cesfwk_innerkits", 176 "config_policy:configpolicy_util", 177 "data_share:datashare_common", 178 "data_share:datashare_consumer", 179 "data_share:datashare_permission", 180 "device_manager:devicemanagersdk", 181 "ffrt:libffrt", 182 "i18n:intl_util", 183 "image_framework:image_native", 184 "init:libbegetutil", 185 "kv_store:distributeddata_inner", 186 "openssl:libcrypto_shared", 187 "os_account:os_account_innerkits", 188 "relational_store:native_rdb", 189 "resource_management:global_resmgr", 190 "time_service:time_client", 191 ] 192 external_deps += component_external_deps 193 194 if (device_usage) { 195 external_deps += [ "device_usage_statistics:usagestatsinner" ] 196 defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ] 197 } 198 199 if (hisysevent_usage) { 200 cflags += [ "-DHAS_HISYSEVENT_PART" ] 201 external_deps += [ "hisysevent:libhisysevent" ] 202 } 203 204 if (standby_enable) { 205 external_deps += [ "device_standby:standby_innerkits" ] 206 defines += [ "DEVICE_STANDBY_ENABLE" ] 207 } 208 209 if (player_framework) { 210 external_deps += [ "player_framework:media_client" ] 211 defines += [ "PLAYER_FRAMEWORK_ENABLE" ] 212 } 213 214 if (ans_hitrace_usage) { 215 external_deps += [ "hitrace:hitrace_meter" ] 216 defines += [ "HITRACE_METER_ENABLE" ] 217 } 218 219 if (ans_config_policy_enable) { 220 external_deps += [ "config_policy:configpolicy_util" ] 221 defines += [ "CONFIG_POLICY_ENABLE" ] 222 } 223 224 if (screenlock_mgr_enable) { 225 external_deps += [ "screenlock_mgr:screenlock_client" ] 226 defines += [ "SCREENLOCK_MGR_ENABLE" ] 227 } 228 229 if (distributed_notification_service_feature_summary || 230 distributed_notification_service_feature_additional_control || 231 distributed_notification_service_feature_privileged_message) { 232 defines += [ "ENABLE_ANS_EXT_WRAPPER" ] 233 } 234 235 if (distributed_notification_service_feature_privileged_message) { 236 defines += [ "ENABLE_ANS_PRIVILEGED_MESSAGE_EXT_WRAPPER" ] 237 } 238 239 if (distributed_notification_service_feature_additional_control) { 240 defines += [ "ENABLE_ANS_ADDITIONAL_CONTROL" ] 241 } 242 243 if (distributed_notification_service_feature_summary) { 244 defines += [ "ENABLE_ANS_AGGREGATION" ] 245 } 246 247 if (telephony_cust) { 248 defines += [ "ENABLE_ANS_TELEPHONY_CUST_WRAPPER" ] 249 } 250 251 if (distributed_notification_service_feature_disable_fa_model) { 252 defines += [ "ANS_DISABLE_FA_MODEL" ] 253 } 254 255 if (is_emulator) { 256 defines += [ "IS_EMULATOR" ] 257 } 258 subsystem_name = "${subsystem_name}" 259 part_name = "${component_name}" 260} 261 262ohos_shared_library("libans") { 263 sanitize = { 264 integer_overflow = true 265 ubsan = true 266 boundary_sanitize = true 267 cfi = true 268 cfi_cross_dso = true 269 debug = false 270 } 271 branch_protector_ret = "pac_ret" 272 273 shlib_type = "sa" 274 version_script = "libans.map" 275 cflags = [ 276 "-fno-math-errno", 277 "-fno-unroll-loops", 278 "-fmerge-all-constants", 279 "-fno-ident", 280 "-Oz", 281 "-flto", 282 "-ffunction-sections", 283 "-fdata-sections", 284 ] 285 sources = [] 286 287 configs = [ ":public_ans_config" ] 288 289 defines = [] 290 291 if (is_double_framework) { 292 cflags += [ "-DCONFIG_DUAL_FRAMEWORK" ] 293 } 294 295 deps = [ 296 "${services_path}/ans:ans_service_sources", 297 "../ans:ans.para", 298 "../ans:ans.para.dac", 299 "../ans:external.json", 300 "//third_party/icu/icu4c:shared_icuuc", 301 "//third_party/libxml2:libxml2", 302 ] 303 304 if (distributed_notification_supported) { 305 deps += [ "${services_path}/distributed:libans_distributed" ] 306 } 307 308 external_deps = [ 309 "ability_base:configuration", 310 "ability_runtime:ability_manager", 311 "ability_runtime:app_manager", 312 "ability_runtime:appkit_native", 313 "ability_runtime:dataobs_manager", 314 "ability_runtime:extension_manager", 315 "ability_runtime:wantagent_innerkits", 316 "access_token:libaccesstoken_sdk", 317 "access_token:libtokenid_sdk", 318 "bundle_framework:appexecfwk_base", 319 "bundle_framework:appexecfwk_core", 320 "c_utils:utils", 321 "common_event_service:cesfwk_innerkits", 322 "config_policy:configpolicy_util", 323 "data_share:datashare_common", 324 "data_share:datashare_consumer", 325 "data_share:datashare_permission", 326 "device_manager:devicemanagersdk", 327 "ffrt:libffrt", 328 "i18n:intl_util", 329 "image_framework:image_native", 330 "init:libbegetutil", 331 "kv_store:distributeddata_inner", 332 "openssl:libcrypto_shared", 333 "os_account:os_account_innerkits", 334 "relational_store:native_rdb", 335 "resource_management:global_resmgr", 336 "time_service:time_client", 337 ] 338 external_deps += component_external_deps 339 340 if (device_usage) { 341 external_deps += [ "device_usage_statistics:usagestatsinner" ] 342 } 343 344 if (hisysevent_usage) { 345 cflags += [ "-DHAS_HISYSEVENT_PART" ] 346 external_deps += [ "hisysevent:libhisysevent" ] 347 } 348 349 if (standby_enable) { 350 external_deps += [ "device_standby:standby_innerkits" ] 351 } 352 353 if (player_framework) { 354 external_deps += [ "player_framework:media_client" ] 355 } 356 357 if (ans_hitrace_usage) { 358 external_deps += [ "hitrace:hitrace_meter" ] 359 } 360 361 if (ans_config_policy_enable) { 362 external_deps += [ "config_policy:configpolicy_util" ] 363 } 364 365 if (screenlock_mgr_enable) { 366 external_deps += [ "screenlock_mgr:screenlock_client" ] 367 } 368 369 subsystem_name = "${subsystem_name}" 370 part_name = "${component_name}" 371} 372 373ohos_prebuilt_etc("ans.para") { 374 source = "etc/ans.para" 375 relative_install_dir = "param" 376 subsystem_name = "${subsystem_name}" 377 part_name = "${component_name}" 378} 379 380ohos_prebuilt_etc("ans.para.dac") { 381 source = "etc/ans.para.dac" 382 relative_install_dir = "param" 383 subsystem_name = "${subsystem_name}" 384 part_name = "${component_name}" 385} 386 387ohos_prebuilt_etc("external.json") { 388 source = "etc/external.json" 389 relative_install_dir = "notification_template" 390 subsystem_name = "${subsystem_name}" 391 part_name = "${component_name}" 392} 393