1# Copyright (c) 2023 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("//build/ohos.gni")
15import("//foundation/ability/ability_runtime/ability_runtime.gni")
16
17config("ability_manager_public_config") {
18  visibility = [ ":*" ]
19  visibility += [
20    "${ability_runtime_test_path}/fuzztest/*",
21    "${ability_runtime_test_path}/moduletest/*",
22    "${ability_runtime_test_path}/unittest/*",
23    "${form_fwk_path}/test/fuzztest/*",
24    "${os_account_path}/tools/test/moduletest/acm/*",
25  ]
26  include_dirs = [
27    "include/",
28    "include/status_bar_delegate",
29    "${ability_runtime_path}/interfaces/kits/native/ability/native",
30    "${ability_runtime_path}/interfaces/kits/native/ability/ability_runtime",
31    "${ability_runtime_path}/interfaces/kits/native/appkit/ability_runtime/context",
32    "${ability_runtime_path}/interfaces/kits/native/ability/native/continuation/kits",
33    "${ability_runtime_path}/interfaces/kits/native/ability/native/continuation/distributed",
34    "${bundlefwk_inner_api_path}/appexecfwk_base/include",
35    "${ability_runtime_innerkits_path}/ability_manager/include",
36    "${ability_runtime_innerkits_path}/app_manager/include/appmgr",
37    "${ability_runtime_path}/interfaces/kits/native/appkit/app",
38    "${ability_runtime_path}/interfaces/kits/native/appkit/dfr",
39    "${ability_runtime_path}/interfaces/kits/native/appkit",
40    "${ability_runtime_innerkits_path}/dataobs_manager/include",
41  ]
42
43  defines = []
44
45  if (ability_command_for_test) {
46    defines += [ "ABILITY_COMMAND_FOR_TEST" ]
47  }
48
49  if (ability_runtime_graphics) {
50    include_dirs += [ "${multimedia_path}/interfaces/innerkits/include" ]
51    defines += [
52      "SUPPORT_GRAPHICS",
53      "SUPPORT_SCREEN",
54    ]
55  }
56
57  cflags = []
58  if (target_cpu == "arm") {
59    cflags += [ "-DBINDER_IPC_32BIT" ]
60  }
61}
62
63ohos_shared_library("ability_manager") {
64  branch_protector_ret = "pac_ret"
65
66  sources = [
67    "${ability_runtime_native_path}/ability/native/data_ability_operation.cpp",
68    "${ability_runtime_native_path}/ability/native/data_ability_operation_builder.cpp",
69    "${ability_runtime_native_path}/ability/native/data_ability_result.cpp",
70    "${ability_runtime_native_path}/ability/native/task_handler.cpp",
71    "${ability_runtime_native_path}/ability/native/task_handler_client.cpp",
72    "${ability_runtime_services_path}/abilitymgr/src/ability_auto_startup_client.cpp",
73    "${ability_runtime_services_path}/abilitymgr/src/ability_manager_client.cpp",
74    "${ability_runtime_services_path}/abilitymgr/src/ability_manager_proxy.cpp",
75    "${ability_runtime_services_path}/abilitymgr/src/ability_running_info.cpp",
76    "${ability_runtime_services_path}/abilitymgr/src/ability_scheduler_stub.cpp",
77    "${ability_runtime_services_path}/abilitymgr/src/acquire_share_data_callback_proxy.cpp",
78    "${ability_runtime_services_path}/abilitymgr/src/acquire_share_data_callback_stub.cpp",
79    "${ability_runtime_services_path}/abilitymgr/src/auto_startup_info.cpp",
80    "${ability_runtime_services_path}/abilitymgr/src/caller_info.cpp",
81    "${ability_runtime_services_path}/abilitymgr/src/dialog_session/dialog_session_info.cpp",
82    "${ability_runtime_services_path}/abilitymgr/src/exit_reason.cpp",
83    "${ability_runtime_services_path}/abilitymgr/src/extension_running_info.cpp",
84    "${ability_runtime_services_path}/abilitymgr/src/insight_intent_execute_callback_proxy.cpp",
85    "${ability_runtime_services_path}/abilitymgr/src/insight_intent_execute_callback_stub.cpp",
86    "${ability_runtime_services_path}/abilitymgr/src/insight_intent_execute_param.cpp",
87    "${ability_runtime_services_path}/abilitymgr/src/insight_intent_execute_result.cpp",
88    "${ability_runtime_services_path}/abilitymgr/src/launch_param.cpp",
89    "${ability_runtime_services_path}/abilitymgr/src/lifecycle_state_info.cpp",
90    "${ability_runtime_services_path}/abilitymgr/src/mission/mission_listener_stub.cpp",
91    "${ability_runtime_services_path}/abilitymgr/src/open_link/open_link_options.cpp",
92    "${ability_runtime_services_path}/abilitymgr/src/prepare_terminate_callback_proxy.cpp",
93    "${ability_runtime_services_path}/abilitymgr/src/prepare_terminate_callback_stub.cpp",
94    "${ability_runtime_services_path}/abilitymgr/src/remote_mission_listener_stub.cpp",
95    "${ability_runtime_services_path}/abilitymgr/src/remote_on_listener_proxy.cpp",
96    "${ability_runtime_services_path}/abilitymgr/src/remote_on_listener_stub.cpp",
97    "${ability_runtime_services_path}/abilitymgr/src/system_ability_token_callback_stub.cpp",
98    "${ability_runtime_services_path}/abilitymgr/src/ui_extension_ability_connect_info.cpp",
99    "${ability_runtime_services_path}/abilitymgr/src/ui_extension_host_info.cpp",
100    "${ability_runtime_services_path}/abilitymgr/src/ui_extension_session_info.cpp",
101    "${ability_runtime_services_path}/abilitymgr/src/user_callback_proxy.cpp",
102    "${ability_runtime_services_path}/abilitymgr/src/user_callback_stub.cpp",
103    "${ability_runtime_services_path}/abilitymgr/src/window_config.cpp",
104    "src/status_bar_delegate/status_bar_delegate_proxy.cpp",
105    "src/status_bar_delegate/status_bar_delegate_stub.cpp",
106    "src/window_manager_service_handler_proxy.cpp",
107    "src/window_manager_service_handler_stub.cpp",
108  ]
109
110  if (ability_runtime_graphics) {
111    sources += [
112      "src/ability_first_frame_state_data.cpp",
113      "src/ability_first_frame_state_observer_proxy.cpp",
114      "src/ability_first_frame_state_observer_stub.cpp",
115    ]
116  }
117
118  public_configs = [
119    ":ability_manager_public_config",
120    "${ability_runtime_services_path}/abilitymgr:abilityms_config",
121  ]
122
123  public_deps = [ ":ability_connect_callback_stub" ]
124
125  deps = [
126    ":ability_start_options",
127    ":ability_start_setting",
128    ":mission_info",
129    ":process_options",
130    ":start_window_option",
131    "${ability_runtime_innerkits_path}/app_manager:app_manager",
132    "${ability_runtime_path}/utils/global/freeze:freeze_util",
133    "${ability_runtime_services_path}/abilitymgr:wantagent_manager",
134  ]
135
136  external_deps = [
137    "bundle_framework:libappexecfwk_common",
138    "c_utils:utils",
139    "common_event_service:cesfwk_innerkits",
140    "eventhandler:libeventhandler",
141    "hilog:libhilog",
142    "hisysevent:libhisysevent",
143    "hitrace:hitrace_meter",
144    "ipc:ipc_core",
145    "relational_store:native_dataability",
146    "samgr:samgr_proxy",
147  ]
148  if (host_cpu != "arm64") {
149    external_deps += [ "relational_store:native_rdb" ]
150  }
151
152  public_external_deps = [
153    "ability_base:base",
154    "ability_base:configuration",
155    "ability_base:session_info",
156    "ability_base:want",
157    "ability_base:zuri",
158    "background_task_mgr:bgtaskmgr_innerkits",
159    "bundle_framework:appexecfwk_base",
160    "bundle_framework:appexecfwk_core",
161    "init:libbegetutil",
162    "jsoncpp:jsoncpp",
163    "relational_store:native_dataability",
164    "relational_store:native_rdb",
165  ]
166
167  if (ability_runtime_graphics) {
168    deps += []
169    external_deps += [
170      "ability_base:session_info",
171      "image_framework:image_native",
172      "window_manager:libwsutils",
173      "window_manager:session_manager_lite",
174    ]
175    public_external_deps += [ "graphic_2d:color_manager" ]
176  }
177
178  cflags_cc = []
179  if (os_dlp_part_enabled) {
180    cflags_cc += [ "-DWITH_DLP" ]
181    external_deps += [ "dlp_permission_service:libdlpparse" ]
182  }
183
184  innerapi_tags = [
185    "platformsdk",
186    "sasdk",
187  ]
188  subsystem_name = "ability"
189  part_name = "ability_runtime"
190}
191
192ohos_shared_library("ability_start_options") {
193  sanitize = {
194    integer_overflow = true
195    ubsan = true
196    boundary_sanitize = true
197    cfi = true
198    cfi_cross_dso = true
199    cfi_vcall_icall_only = true
200    debug = false
201  }
202  branch_protector_ret = "pac_ret"
203
204  include_dirs = [
205    "include/",
206    "${ability_runtime_services_path}/common/include",
207  ]
208
209  sources =
210      [ "${ability_runtime_services_path}/abilitymgr/src/start_options.cpp" ]
211
212  deps = [
213    ":process_options",
214    ":start_window_option",
215  ]
216
217  external_deps = [
218    "c_utils:utils",
219    "hilog:libhilog",
220    "hisysevent:libhisysevent",
221    "ipc:ipc_core",
222  ]
223
224  cflags_cc = []
225  innerapi_tags = [
226    "platformsdk",
227    "sasdk",
228  ]
229  subsystem_name = "ability"
230  part_name = "ability_runtime"
231}
232
233ohos_shared_library("mission_info") {
234  branch_protector_ret = "pac_ret"
235
236  sources = [
237    "${ability_runtime_services_path}/abilitymgr/src/mission/mission_info.cpp",
238    "${ability_runtime_services_path}/abilitymgr/src/mission/mission_snapshot.cpp",
239  ]
240
241  public_configs = [ ":ability_manager_public_config" ]
242
243  external_deps = [
244    "c_utils:utils",
245    "ipc:ipc_core",
246  ]
247  public_external_deps = [
248    "ability_base:configuration",
249    "ability_base:want",
250    "ability_base:zuri",
251    "bundle_framework:appexecfwk_base",
252    "bundle_framework:appexecfwk_core",
253    "jsoncpp:jsoncpp",
254  ]
255  if (ability_runtime_graphics) {
256    external_deps += [ "image_framework:image_native" ]
257    public_external_deps += [ "graphic_2d:color_manager" ]
258  }
259
260  cflags_cc = []
261  innerapi_tags = [ "platformsdk" ]
262  subsystem_name = "ability"
263  part_name = "ability_runtime"
264}
265
266ohos_shared_library("ability_manager_c") {
267  include_dirs = [ "include" ]
268  sources = [ "src/ability_manager_client_c.cpp" ]
269  libs = []
270  ldflags = [ "-Wl,--exclude-libs=ALL" ]
271  deps = [ ":ability_manager" ]
272  external_deps = [
273    "ability_base:session_info",
274    "c_utils:utils",
275  ]
276  innerapi_tags = [ "platformsdk" ]
277  subsystem_name = "ability"
278  part_name = "ability_runtime"
279}
280
281ohos_shared_library("ability_start_setting") {
282  branch_protector_ret = "pac_ret"
283
284  sources = [
285    "${ability_runtime_services_path}/abilitymgr/src/ability_start_setting.cpp",
286  ]
287
288  public_configs = [ ":ability_manager_public_config" ]
289
290  external_deps = [ "c_utils:utils" ]
291  public_external_deps = [
292    "ability_base:configuration",
293    "ability_base:want",
294    "ability_base:zuri",
295    "bundle_framework:appexecfwk_base",
296    "bundle_framework:appexecfwk_core",
297    "jsoncpp:jsoncpp",
298    "napi:ace_napi",
299  ]
300  if (ability_runtime_graphics) {
301    public_external_deps += [ "graphic_2d:color_manager" ]
302  }
303  cflags_cc = []
304  innerapi_tags = [ "platformsdk" ]
305  subsystem_name = "ability"
306  part_name = "ability_runtime"
307}
308
309ohos_shared_library("process_options") {
310  sanitize = {
311    integer_overflow = true
312    ubsan = true
313    boundary_sanitize = true
314    cfi = true
315    cfi_cross_dso = true
316    cfi_vcall_icall_only = true
317    debug = false
318  }
319  branch_protector_ret = "pac_ret"
320
321  include_dirs = [
322    "include/",
323    "${ability_runtime_services_path}/common/include",
324  ]
325
326  sources =
327      [ "${ability_runtime_services_path}/abilitymgr/src/process_options.cpp" ]
328
329  external_deps = [
330    "c_utils:utils",
331    "hilog:libhilog",
332  ]
333
334  cflags_cc = []
335  innerapi_tags = [ "platformsdk" ]
336  subsystem_name = "ability"
337  part_name = "ability_runtime"
338}
339
340ohos_shared_library("start_window_option") {
341  sanitize = {
342    integer_overflow = true
343    ubsan = true
344    boundary_sanitize = true
345    cfi = true
346    cfi_cross_dso = true
347    cfi_vcall_icall_only = true
348    debug = false
349  }
350  branch_protector_ret = "pac_ret"
351
352  include_dirs = [
353    "include/",
354    "${ability_runtime_services_path}/common/include",
355  ]
356
357  sources = [
358    "${ability_runtime_services_path}/abilitymgr/src/start_window_option.cpp",
359  ]
360
361  external_deps = [
362    "c_utils:utils",
363    "hilog:libhilog",
364    "napi:ace_napi",
365  ]
366
367  if (ability_runtime_graphics &&
368      ability_runtime_start_window_options_with_pixelmap) {
369    defines = [ "START_WINDOW_OPTIONS_WITH_PIXELMAP" ]
370    external_deps += [ "image_framework:image_native" ]
371  }
372
373  cflags_cc = []
374  innerapi_tags = [ "platformsdk" ]
375  subsystem_name = "ability"
376  part_name = "ability_runtime"
377}
378
379ohos_shared_library("ability_connect_callback_stub") {
380  branch_protector_ret = "pac_ret"
381
382  defines = [ "AMS_LOG_TAG = \"Ability\"" ]
383  defines += [ "AMS_LOG_DOMAIN = 0xD001300" ]
384  include_dirs = [
385    "include/",
386    "${ability_base_kits_path}/want/include",
387    "${ability_runtime_services_path}/abilitymgr/include/utils",
388    "${ability_runtime_services_path}/abilitymgr/include",
389    "${ability_runtime_services_path}/common/include",
390  ]
391
392  sources = [ "${ability_runtime_services_path}/abilitymgr/src/ability_connect_callback_stub.cpp" ]
393
394  public_configs = [ ":ability_manager_public_config" ]
395
396  external_deps = [
397    "c_utils:utils",
398    "hilog:libhilog",
399    "ipc:ipc_core",
400  ]
401  public_external_deps = [
402    "ability_base:configuration",
403    "ability_base:want",
404    "ability_base:zuri",
405    "bundle_framework:appexecfwk_base",
406    "bundle_framework:appexecfwk_core",
407    "jsoncpp:jsoncpp",
408  ]
409  if (ability_runtime_graphics) {
410    public_external_deps += [ "graphic_2d:color_manager" ]
411  }
412
413  cflags_cc = []
414  innerapi_tags = [
415    "platformsdk",
416    "sasdk",
417  ]
418  subsystem_name = "ability"
419  part_name = "ability_runtime"
420}
421