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    "${core_path}/include",
25  ]
26}
27
28ohos_shared_library("libans") {
29  sanitize = {
30    integer_overflow = true
31    ubsan = true
32    boundary_sanitize = true
33    cfi = true
34    cfi_cross_dso = true
35    debug = false
36  }
37  branch_protector_ret = "pac_ret"
38
39  shlib_type = "sa"
40  version_script = "libans.map"
41  include_dirs = [
42    "include",
43    "${ffrt_path}/interfaces/kits",
44  ]
45
46  sources = [
47    "src/access_token_helper.cpp",
48    "src/advanced_aggregation_data_roaming_observer.cpp",
49    "src/advanced_datashare_helper.cpp",
50    "src/advanced_datashare_helper_ext.cpp",
51    "src/advanced_datashare_observer.cpp",
52    "src/advanced_notification_clone_service.cpp",
53    "src/advanced_notification_event_service.cpp",
54    "src/advanced_notification_flow_control_service.cpp",
55    "src/advanced_notification_inline.cpp",
56    "src/advanced_notification_live_view_service.cpp",
57    "src/advanced_notification_publish/base_publish_process.cpp",
58    "src/advanced_notification_publish/common_notification_publish_process.cpp",
59    "src/advanced_notification_publish/live_publish_process.cpp",
60    "src/advanced_notification_publish_service.cpp",
61    "src/advanced_notification_reminder_service.cpp",
62    "src/advanced_notification_service.cpp",
63    "src/advanced_notification_service_ability.cpp",
64    "src/advanced_notification_slot_service.cpp",
65    "src/advanced_notification_subscriber_service.cpp",
66    "src/advanced_notification_utils.cpp",
67    "src/bundle_manager_helper.cpp",
68    "src/clone/notification_clone_bundle_info.cpp",
69    "src/clone/notification_clone_bundle_service.cpp",
70    "src/clone/notification_clone_disturb_service.cpp",
71    "src/clone/notification_clone_manager.cpp",
72    "src/clone/notification_clone_util.cpp",
73    "src/common/aes_gcm_helper.cpp",
74    "src/common/file_utils.cpp",
75    "src/common/notification_analytics_util.cpp",
76    "src/common/notification_config_parse.cpp",
77    "src/distributed_device_status.cpp",
78    "src/event_report.cpp",
79    "src/notification_dialog.cpp",
80    "src/notification_dialog_manager.cpp",
81    "src/notification_extension_wrapper.cpp",
82    "src/notification_local_live_view_subscriber_manager.cpp",
83    "src/notification_preferences.cpp",
84    "src/notification_preferences_database.cpp",
85    "src/notification_preferences_info.cpp",
86    "src/notification_rdb_data_mgr.cpp",
87    "src/notification_slot_filter.cpp",
88    "src/notification_smart_reminder/reminder_affected.cpp",
89    "src/notification_smart_reminder/smart_reminder_center.cpp",
90    "src/notification_smart_reminder/string_utils.cpp",
91    "src/notification_subscriber_manager.cpp",
92    "src/notification_timer_info.cpp",
93    "src/notification_trust_list.cpp",
94    "src/os_account_manager_helper.cpp",
95    "src/permission_filter.cpp",
96    "src/reminder_config_change_observer.cpp",
97    "src/reminder_data_manager.cpp",
98    "src/reminder_data_manager_inner.cpp",
99    "src/reminder_event_manager.cpp",
100    "src/reminder_store.cpp",
101    "src/reminder_store_strategy.cpp",
102    "src/reminder_swing_decision_center.cpp",
103    "src/reminder_table.cpp",
104    "src/reminder_table_old.cpp",
105    "src/reminder_timer_info.cpp",
106    "src/report_time_info.cpp",
107    "src/system_dialog_connect_stb.cpp",
108    "src/system_event_observer.cpp",
109    "src/telephony_extension_wrapper.cpp",
110  ]
111
112  configs = [ ":public_ans_config" ]
113
114  defines = []
115  cflags = [
116    "-fno-math-errno",
117    "-fno-unroll-loops",
118    "-fmerge-all-constants",
119    "-fno-ident",
120    "-Oz",
121    "-flto",
122    "-ffunction-sections",
123    "-fdata-sections",
124  ]
125
126  deps = [
127    "${frameworks_module_ans_path}:ans_innerkits",
128    "../ans:ans.para",
129    "../ans:ans.para.dac",
130    "//third_party/icu/icu4c:shared_icuuc",
131    "//third_party/libxml2:libxml2",
132  ]
133
134  if (is_double_framework) {
135    cflags += [ "-DCONFIG_DUAL_FRAMEWORK" ]
136  }
137
138  if (distributed_notification_supported) {
139    defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ]
140    deps += [ "${services_path}/distributed:libans_distributed" ]
141    include_dirs += [ "${services_path}/distributed/include" ]
142  }
143
144  if (notification_smart_reminder_supported) {
145    defines += [ "NOTIFICATION_SMART_REMINDER_SUPPORTED" ]
146  }
147
148  external_deps = [
149    "ability_base:configuration",
150    "ability_runtime:ability_manager",
151    "ability_runtime:app_manager",
152    "ability_runtime:appkit_native",
153    "ability_runtime:dataobs_manager",
154    "ability_runtime:extension_manager",
155    "ability_runtime:wantagent_innerkits",
156    "access_token:libaccesstoken_sdk",
157    "access_token:libtokenid_sdk",
158    "bundle_framework:appexecfwk_base",
159    "bundle_framework:appexecfwk_core",
160    "c_utils:utils",
161    "common_event_service:cesfwk_innerkits",
162    "config_policy:configpolicy_util",
163    "data_share:datashare_common",
164    "data_share:datashare_consumer",
165    "data_share:datashare_permission",
166    "device_manager:devicemanagersdk",
167    "ffrt:libffrt",
168    "i18n:intl_util",
169    "image_framework:image_native",
170    "init:libbegetutil",
171    "kv_store:distributeddata_inner",
172    "openssl:libcrypto_shared",
173    "os_account:os_account_innerkits",
174    "relational_store:native_rdb",
175    "resource_management:global_resmgr",
176    "time_service:time_client",
177  ]
178  external_deps += component_external_deps
179
180  if (device_usage) {
181    external_deps += [ "device_usage_statistics:usagestatsinner" ]
182    defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ]
183  }
184
185  if (hisysevent_usage) {
186    cflags += [ "-DHAS_HISYSEVENT_PART" ]
187    external_deps += [ "hisysevent:libhisysevent" ]
188  }
189
190  if (standby_enable) {
191    external_deps += [ "device_standby:standby_innerkits" ]
192    defines += [ "DEVICE_STANDBY_ENABLE" ]
193  }
194
195  if (player_framework) {
196    external_deps += [ "player_framework:media_client" ]
197    defines += [ "PLAYER_FRAMEWORK_ENABLE" ]
198  }
199
200  if (ans_hitrace_usage) {
201    external_deps += [ "hitrace:hitrace_meter" ]
202    defines += [ "HITRACE_METER_ENABLE" ]
203  }
204
205  if (ans_config_policy_enable) {
206    external_deps += [ "config_policy:configpolicy_util" ]
207    defines += [ "CONFIG_POLICY_ENABLE" ]
208  }
209
210  if (screenlock_mgr_enable) {
211    external_deps += [ "screenlock_mgr:screenlock_client" ]
212    defines += [ "SCREENLOCK_MGR_ENABLE" ]
213  }
214
215  if (distributed_notification_service_feature_summary) {
216    defines += [ "ENABLE_ANS_EXT_WRAPPER" ]
217  }
218
219  if (telephony_cust) {
220    defines += [ "ENABLE_ANS_TELEPHONY_CUST_WRAPPER" ]
221  }
222
223  if (distributed_notification_service_feature_enable_fa_model) {
224    defines += [ "ANS_ENABLE_FA_MODEL" ]
225  }
226
227  subsystem_name = "${subsystem_name}"
228  part_name = "${component_name}"
229}
230
231ohos_prebuilt_etc("ans.para") {
232  source = "etc/ans.para"
233  relative_install_dir = "param"
234  subsystem_name = "${subsystem_name}"
235  part_name = "${component_name}"
236}
237
238ohos_prebuilt_etc("ans.para.dac") {
239  source = "etc/ans.para.dac"
240  relative_install_dir = "param"
241  subsystem_name = "${subsystem_name}"
242  part_name = "${component_name}"
243}
244