• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2022-2025 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")
16import("//foundation/resourceschedule/background_task_mgr/bgtaskmgr.gni")
17
18idl_gen_interface("background_task_mgr_interface") {
19  src_idl = rebase_path("IBackgroundTaskMgr.idl")
20}
21
22idl_gen_interface("background_task_subscriber_interface") {
23  src_idl = rebase_path("IBackgroundTaskSubscriber.idl")
24}
25
26idl_gen_interface("expired_callback_interface") {
27  src_idl = rebase_path("IExpiredCallback.idl")
28}
29
30config("bgtaskmgr_innerkits_public_config") {
31  include_dirs = [
32    "include",
33    "${target_gen_dir}",
34    "${bgtaskmgr_frameworks_path}/common/include",
35    "${bgtaskmgr_frameworks_path}/include",
36  ]
37}
38
39ohos_shared_library("bgtaskmgr_innerkits") {
40  branch_protector_ret = "pac_ret"
41  sanitize = {
42    cfi = true
43    cfi_cross_dso = true
44    debug = false
45  }
46  cflags_cc = [
47    "-fdata-sections",
48    "-ffunction-sections",
49    "-fstack-protector-strong",
50    "-Os",
51  ]
52  deps = [
53    ":background_task_mgr_interface",
54    ":background_task_subscriber_interface",
55    ":expired_callback_interface",
56  ]
57
58  sources = [
59    "${bgtaskmgr_frameworks_path}/src/background_task_manager.cpp",
60    "src/background_mode.cpp",
61    "src/background_sub_mode.cpp",
62    "src/background_task_mgr_helper.cpp",
63    "src/background_task_subscriber.cpp",
64    "src/continuous_task_callback_info.cpp",
65    "src/continuous_task_info.cpp",
66    "src/continuous_task_param.cpp",
67    "src/continuous_task_suspend_reason.cpp",
68    "src/delay_suspend_info.cpp",
69    "src/efficiency_resource_info.cpp",
70    "src/expired_callback.cpp",
71    "src/resource_callback_info.cpp",
72    "src/resource_type.cpp",
73    "src/transient_task_app_info.cpp",
74  ]
75
76  output_values = get_target_outputs(":background_task_mgr_interface")
77  sources += filter_include(output_values,
78                            [
79                              "*_proxy.cpp",
80                              "*_stub.cpp",
81                            ])
82
83  subscriber_output_values =
84      get_target_outputs(":background_task_subscriber_interface")
85  sources += filter_include(subscriber_output_values,
86                            [
87                              "*_proxy.cpp",
88                              "*_stub.cpp",
89                            ])
90
91  expired_callback_output_values =
92      get_target_outputs(":expired_callback_interface")
93  sources += filter_include(expired_callback_output_values,
94                            [
95                              "*_proxy.cpp",
96                              "*_stub.cpp",
97                            ])
98
99  public_configs = [ ":bgtaskmgr_innerkits_public_config" ]
100
101  external_deps = [
102    "ability_runtime:wantagent_innerkits",
103    "c_utils:utils",
104    "common_event_service:cesfwk_innerkits",
105    "hilog:libhilog",
106    "hitrace:hitrace_meter",
107    "ipc:ipc_core",
108    "ipc:ipc_single",
109    "samgr:samgr_proxy",
110  ]
111
112  public_external_deps = [ "json:nlohmann_json_static" ]
113
114  subsystem_name = "resourceschedule"
115  part_name = "background_task_mgr"
116  innerapi_tags = [ "platformsdk" ]
117  version_script = "libbgtaskmgr_innerkits.versionscript"
118}
119
120ohos_source_set("background_task_mgr_stub") {
121  branch_protector_ret = "pac_ret"
122  sanitize = {
123    cfi = true
124    cfi_cross_dso = true
125    debug = false
126  }
127  output_values = get_target_outputs(":background_task_mgr_interface")
128  sources = filter_include(output_values, [ "*_stub.cpp" ])
129  public_configs = [ ":bgtaskmgr_innerkits_public_config" ]
130  deps = [
131    ":background_task_mgr_interface",
132    ":expired_callback_interface",
133  ]
134  subsystem_name = "resourceschedule"
135  part_name = "background_task_mgr"
136  external_deps = [
137    "ability_runtime:wantagent_innerkits",
138    "c_utils:utils",
139    "hilog:libhilog",
140    "ipc:ipc_core",
141    "ipc:ipc_single",
142    "samgr:samgr_proxy",
143  ]
144}
145
146ohos_source_set("background_task_mgr_proxy") {
147  branch_protector_ret = "pac_ret"
148  sanitize = {
149    cfi = true
150    cfi_cross_dso = true
151    debug = false
152  }
153  output_values = get_target_outputs(":background_task_mgr_interface")
154  sources = filter_include(output_values, [ "*_proxy.cpp" ])
155  public_configs = [ ":bgtaskmgr_innerkits_public_config" ]
156  deps = [
157    ":background_task_mgr_interface",
158    ":expired_callback_interface",
159  ]
160  subsystem_name = "resourceschedule"
161  part_name = "background_task_mgr"
162  external_deps = [
163    "ability_runtime:wantagent_innerkits",
164    "c_utils:utils",
165    "hilog:libhilog",
166    "ipc:ipc_core",
167    "ipc:ipc_single",
168    "samgr:samgr_proxy",
169  ]
170}
171
172ohos_source_set("background_task_subscriber_stub") {
173  branch_protector_ret = "pac_ret"
174  sanitize = {
175    cfi = true
176    cfi_cross_dso = true
177    debug = false
178  }
179  output_values = get_target_outputs(":background_task_subscriber_interface")
180  sources = filter_include(output_values, [ "*_stub.cpp" ])
181  public_configs = [ ":bgtaskmgr_innerkits_public_config" ]
182  deps = [ ":background_task_subscriber_interface" ]
183  subsystem_name = "resourceschedule"
184  part_name = "background_task_mgr"
185  external_deps = [
186    "ability_runtime:wantagent_innerkits",
187    "c_utils:utils",
188    "hilog:libhilog",
189    "ipc:ipc_core",
190    "ipc:ipc_single",
191    "samgr:samgr_proxy",
192  ]
193}
194
195ohos_source_set("background_task_subscriber_proxy") {
196  branch_protector_ret = "pac_ret"
197  sanitize = {
198    cfi = true
199    cfi_cross_dso = true
200    debug = false
201  }
202  output_values = get_target_outputs(":background_task_subscriber_interface")
203  sources = filter_include(output_values, [ "*_proxy.cpp" ])
204  public_configs = [ ":bgtaskmgr_innerkits_public_config" ]
205  deps = [ ":background_task_subscriber_interface" ]
206  subsystem_name = "resourceschedule"
207  part_name = "background_task_mgr"
208  external_deps = [
209    "ability_runtime:wantagent_innerkits",
210    "c_utils:utils",
211    "hilog:libhilog",
212    "ipc:ipc_core",
213    "ipc:ipc_single",
214    "samgr:samgr_proxy",
215  ]
216}
217
218ohos_source_set("expired_callback_stub") {
219  branch_protector_ret = "pac_ret"
220  sanitize = {
221    cfi = true
222    cfi_cross_dso = true
223    debug = false
224  }
225  output_values = get_target_outputs(":expired_callback_interface")
226  sources = filter_include(output_values, [ "*_stub.cpp" ])
227  public_configs = [ ":bgtaskmgr_innerkits_public_config" ]
228  deps = [ ":expired_callback_interface" ]
229  subsystem_name = "resourceschedule"
230  part_name = "background_task_mgr"
231  external_deps = [
232    "ability_runtime:wantagent_innerkits",
233    "c_utils:utils",
234    "hilog:libhilog",
235    "ipc:ipc_core",
236    "ipc:ipc_single",
237    "samgr:samgr_proxy",
238  ]
239}
240
241ohos_source_set("expired_callback_proxy") {
242  branch_protector_ret = "pac_ret"
243  sanitize = {
244    cfi = true
245    cfi_cross_dso = true
246    debug = false
247  }
248  output_values = get_target_outputs(":expired_callback_interface")
249  sources = filter_include(output_values, [ "*_proxy.cpp" ])
250  public_configs = [ ":bgtaskmgr_innerkits_public_config" ]
251  deps = [ ":expired_callback_interface" ]
252  subsystem_name = "resourceschedule"
253  part_name = "background_task_mgr"
254  external_deps = [
255    "ability_runtime:wantagent_innerkits",
256    "c_utils:utils",
257    "hilog:libhilog",
258    "ipc:ipc_core",
259    "ipc:ipc_single",
260    "samgr:samgr_proxy",
261  ]
262}
263