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