• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2023-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("//build/config/components/idl_tool/idl.gni")
15import("//build/ohos.gni")
16
17sec_comp_root_dir = "../../.."
18
19config("security_component_common_config") {
20  include_dirs = [
21    "${sec_comp_root_dir}/interfaces/inner_api/security_component_common",
22    "${sec_comp_root_dir}/interfaces/inner_api/security_component/include",
23  ]
24}
25
26idl_gen_interface("sec_comp_service_interface") {
27  sources = [ "ISecCompService.idl" ]
28  subsystem_name = "security"
29  part_name = "security_component_manager"
30}
31
32config("sec_comp_service_gen_config") {
33  include_dirs = [ "${target_gen_dir}" ]
34}
35
36ohos_source_set("sec_comp_service_proxy") {
37  sanitize = {
38    cfi = true
39    cfi_cross_dso = true
40    debug = false
41  }
42
43  output_values = get_target_outputs(":sec_comp_service_interface")
44
45  include_dirs = [ "${sec_comp_root_dir}/frameworks/common/include" ]
46
47  sources = filter_include(output_values, [ "*_proxy.cpp" ])
48
49  deps = [ ":sec_comp_service_interface" ]
50
51  external_deps = [
52    "c_utils:utils",
53    "hilog:libhilog",
54    "ipc:ipc_single",
55    "samgr:samgr_proxy",
56  ]
57
58  subsystem_name = "security"
59  part_name = "security_component_manager"
60}
61
62ohos_source_set("sec_comp_no_cfi_service_proxy") {
63  output_values = get_target_outputs(":sec_comp_service_interface")
64
65  include_dirs = [ "${sec_comp_root_dir}/frameworks/common/include" ]
66
67  sources = filter_include(output_values, [ "*_proxy.cpp" ])
68
69  deps = [ ":sec_comp_service_interface" ]
70
71  external_deps = [
72    "c_utils:utils",
73    "hilog:libhilog",
74    "ipc:ipc_single",
75    "samgr:samgr_proxy",
76  ]
77
78  subsystem_name = "security"
79  part_name = "security_component_manager"
80}
81
82ohos_source_set("sec_comp_service_stub") {
83  sanitize = {
84    cfi = true
85    cfi_cross_dso = true
86    debug = false
87  }
88
89  output_values = get_target_outputs(":sec_comp_service_interface")
90
91  include_dirs = [ "${sec_comp_root_dir}/frameworks/common/include" ]
92
93  sources = filter_include(output_values, [ "*_stub.cpp" ])
94
95  deps = [ ":sec_comp_service_interface" ]
96
97  external_deps = [
98    "c_utils:utils",
99    "hilog:libhilog",
100    "ipc:ipc_single",
101    "samgr:samgr_proxy",
102  ]
103
104  subsystem_name = "security"
105  part_name = "security_component_manager"
106}
107
108ohos_source_set("sec_comp_service_stub_no_cfi") {
109  output_values = get_target_outputs(":sec_comp_service_interface")
110
111  include_dirs = [ "${sec_comp_root_dir}/frameworks/common/include" ]
112
113  sources = filter_include(output_values, [ "*_stub.cpp" ])
114
115  deps = [ ":sec_comp_service_interface" ]
116
117  external_deps = [
118    "c_utils:utils",
119    "hilog:libhilog",
120    "ipc:ipc_single",
121    "samgr:samgr_proxy",
122  ]
123
124  subsystem_name = "security"
125  part_name = "security_component_manager"
126}
127
128ohos_shared_library("security_component_common") {
129  subsystem_name = "security"
130  part_name = "security_component_manager"
131
132  innerapi_tags = [ "sasdk" ]
133  public_configs = [ ":security_component_common_config" ]
134
135  sanitize = {
136    cfi = true
137    cfi_cross_dso = true
138    debug = false
139  }
140  branch_protector_ret = "pac_ret"
141
142  include_dirs = [
143    "${sec_comp_root_dir}/frameworks/common/include",
144    "${sec_comp_root_dir}/frameworks/security_component/include",
145    "${sec_comp_root_dir}/frameworks/inner_api/security_component/include",
146    "${sec_comp_root_dir}/interfaces/inner_api/security_component_common",
147    "${sec_comp_root_dir}/interfaces/inner_api/security_component/include",
148  ]
149
150  sources = [
151    "sa_main/delay_exit_task.cpp",
152    "sa_main/sec_comp_info_helper.cpp",
153    "sa_main/sec_event_handler.cpp",
154    "sa_main/window_info_helper.cpp",
155  ]
156
157  cflags_cc = [
158    "-DHILOG_ENABLE",
159    "-fvisibility=hidden",
160    "-DSEC_COMP_SERVICE_COMPILE_ENABLE",
161  ]
162  cflags = [ "-DHILOG_ENABLE" ]
163
164  deps = [
165    "${sec_comp_root_dir}/frameworks:security_component_enhance_adapter_service_src_set",
166    "${sec_comp_root_dir}/frameworks:security_component_no_cfi_framework_src_set",
167  ]
168
169  external_deps = [
170    "ability_runtime:ability_manager",
171    "access_token:libaccesstoken_sdk",
172    "bundle_framework:appexecfwk_base",
173    "c_utils:utils",
174    "eventhandler:libeventhandler",
175    "hilog:libhilog",
176    "hisysevent:libhisysevent",
177    "ipc:ipc_core",
178    "ipc:ipc_single",
179    "json:nlohmann_json_static",
180    "safwk:system_ability_fwk",
181    "samgr:samgr_proxy",
182    "window_manager:libdm",
183    "window_manager:libwm",
184  ]
185}
186
187config("security_component_service_config") {
188  include_dirs = [
189    "sa_main",
190    "${sec_comp_root_dir}/frameworks/common/include",
191    "${sec_comp_root_dir}/frameworks/enhance_adapter/include",
192    "${sec_comp_root_dir}/frameworks/security_component/include",
193    "${sec_comp_root_dir}/interfaces/inner_api/security_component/include",
194  ]
195}
196
197ohos_prebuilt_etc("security_component_service.rc") {
198  source = "security_component_service.cfg"
199  relative_install_dir = "init"
200  subsystem_name = "security"
201  part_name = "security_component_manager"
202}
203
204ohos_source_set("security_component_service_src_set") {
205  subsystem_name = "security"
206  part_name = "security_component_manager"
207  sanitize = {
208    cfi = true
209    cfi_cross_dso = true
210    debug = false
211  }
212  branch_protector_ret = "pac_ret"
213  include_dirs = [
214    "sa_main",
215    "${sec_comp_root_dir}/frameworks/common/include",
216    "${sec_comp_root_dir}/frameworks/enhance_adapter/include",
217    "${sec_comp_root_dir}/frameworks/inner_api/security_component/include",
218    "${sec_comp_root_dir}/interfaces/inner_api/security_component_common",
219    "${sec_comp_root_dir}/interfaces/inner_api/security_component/include",
220  ]
221
222  sources = [
223    "${sec_comp_root_dir}/frameworks/inner_api/security_component/src/sec_comp_dialog_callback_stub.cpp",
224    "sa_main/app_mgr_death_recipient.cpp",
225    "sa_main/app_state_observer.cpp",
226    "sa_main/first_use_dialog.cpp",
227    "sa_main/sec_comp_dialog_callback_proxy.cpp",
228    "sa_main/sec_comp_entity.cpp",
229    "sa_main/sec_comp_malicious_apps.cpp",
230    "sa_main/sec_comp_manager.cpp",
231    "sa_main/sec_comp_perm_manager.cpp",
232    "sa_main/sec_comp_service.cpp",
233  ]
234
235  cflags_cc = [
236    "-DHILOG_ENABLE",
237    "-fvisibility=hidden",
238    "-DSEC_COMP_SERVICE_COMPILE_ENABLE",
239  ]
240  cflags = [ "-DHILOG_ENABLE" ]
241
242  deps = [
243    ":security_component_common",
244    ":security_component_service.rc",
245    "${sec_comp_root_dir}/frameworks:security_component_framework_src_set",
246    "${sec_comp_root_dir}/services/security_component_service/sa:sec_comp_service_stub",
247  ]
248
249  configs = [
250    "${sec_comp_root_dir}/config:coverage_flags",
251    "${sec_comp_root_dir}/services/security_component_service/sa:sec_comp_service_gen_config",
252  ]
253  public_configs = [ ":security_component_service_config" ]
254
255  external_deps = [
256    "ability_base:base",
257    "ability_base:session_info",
258    "ability_base:want",
259    "ability_base:zuri",
260    "ability_runtime:ability_manager",
261    "ability_runtime:app_manager",
262    "ability_runtime:runtime",
263    "access_token:libaccesstoken_sdk",
264    "bundle_framework:appexecfwk_base",
265    "bundle_framework:appexecfwk_core",
266    "c_utils:utils",
267    "data_share:datashare_consumer",
268    "eventhandler:libeventhandler",
269    "graphic_2d:librender_service_client",
270    "hilog:libhilog",
271    "hisysevent:libhisysevent",
272    "hitrace:hitrace_meter",
273    "ipc:ipc_core",
274    "safwk:system_ability_fwk",
275    "samgr:samgr_proxy",
276    "window_manager:libdm",
277    "window_manager:libwm",
278  ]
279}
280
281ohos_shared_library("security_component_service") {
282  subsystem_name = "security"
283  part_name = "security_component_manager"
284  sanitize = {
285    cfi = true
286    cfi_cross_dso = true
287    debug = false
288  }
289  branch_protector_ret = "pac_ret"
290
291  deps = [
292    ":security_component_common",
293    ":security_component_service.rc",
294    ":security_component_service_src_set",
295    "${sec_comp_root_dir}/frameworks:security_component_framework_src_set",
296  ]
297  external_deps = [ "hilog:libhilog" ]
298  configs = [ "${sec_comp_root_dir}/config:coverage_flags" ]
299}
300