1# Copyright (c) 2022 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("//foundation/resourceschedule/work_scheduler/workscheduler.gni")
15
16config("worksched_private_config") {
17  include_dirs = [
18    "${worksched_service_path}/zidl/include",
19    "${worksched_frameworks_path}/extension/include",
20  ]
21}
22
23config("worksched_public_config") {
24  include_dirs = [ "native/include" ]
25}
26
27ohos_shared_library("workschedservice") {
28  shlib_type = "sa"
29  branch_protector_ret = "pac_ret"
30
31  sanitize = {
32    cfi = true
33    cfi_cross_dso = true
34    debug = false
35  }
36  sources = [
37    "native/src/conditions/battery_level_listener.cpp",
38    "native/src/conditions/battery_status_listener.cpp",
39    "native/src/conditions/charger_listener.cpp",
40    "native/src/conditions/condition_checker.cpp",
41    "native/src/conditions/group_listener.cpp",
42    "native/src/conditions/network_listener.cpp",
43    "native/src/conditions/screen_listener.cpp",
44    "native/src/conditions/storage_listener.cpp",
45    "native/src/conditions/timer_listener.cpp",
46    "native/src/event_publisher.cpp",
47    "native/src/policy/app_data_clear_listener.cpp",
48    "native/src/policy/cpu_policy.cpp",
49    "native/src/policy/memory_policy.cpp",
50    "native/src/policy/thermal_policy.cpp",
51    "native/src/scheduler_bg_task_subscriber.cpp",
52    "native/src/watchdog.cpp",
53    "native/src/work_bundle_group_change_callback.cpp",
54    "native/src/work_conn_manager.cpp",
55    "native/src/work_datashare_helper.cpp",
56    "native/src/work_event_handler.cpp",
57    "native/src/work_policy_manager.cpp",
58    "native/src/work_queue.cpp",
59    "native/src/work_queue_event_handler.cpp",
60    "native/src/work_queue_manager.cpp",
61    "native/src/work_sched_config.cpp",
62    "native/src/work_sched_data_manager.cpp",
63    "native/src/work_scheduler_connection.cpp",
64    "native/src/work_scheduler_service.cpp",
65    "native/src/work_standby_state_change_callback.cpp",
66    "native/src/work_status.cpp",
67    "zidl/src/work_sched_service_stub.cpp",
68    "zidl/src/work_scheduler_proxy.cpp",
69  ]
70
71  configs = [ ":worksched_private_config" ]
72
73  public_configs = [ ":worksched_public_config" ]
74
75  deps = [
76    "${worksched_frameworks_path}:workschedclient",
77    "${worksched_utils_path}:workschedutils",
78  ]
79
80  external_deps = [
81    "ability_base:want",
82    "ability_base:zuri",
83    "ability_runtime:ability_manager",
84    "ability_runtime:wantagent_innerkits",
85    "access_token:libaccesstoken_sdk",
86    "access_token:libtokenid_sdk",
87    "bundle_framework:appexecfwk_base",
88    "bundle_framework:appexecfwk_core",
89    "c_utils:utils",
90    "common_event_service:cesfwk_innerkits",
91    "config_policy:configpolicy_util",
92    "data_share:datashare_consumer",
93    "eventhandler:libeventhandler",
94    "ffrt:libffrt",
95    "hilog:libhilog",
96    "hisysevent:libhisysevent",
97    "hitrace:hitrace_meter",
98    "hiview:libucollection_client",
99    "init:libbegetutil",
100    "ipc:ipc_single",
101    "resource_schedule_service:ressched_client",
102    "safwk:system_ability_fwk",
103    "samgr:samgr_proxy",
104    "time_service:time_client",
105  ]
106
107  defines = []
108  if (bundle_active_enable) {
109    external_deps += [ "device_usage_statistics:usagestatsinner" ]
110    defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ]
111  }
112  if (device_standby_enable) {
113    external_deps += [ "device_standby:standby_innerkits" ]
114    defines += [ "DEVICE_STANDBY_ENABLE" ]
115  }
116  if (resourceschedule_bgtaskmgr_enable) {
117    external_deps += [ "background_task_mgr:bgtaskmgr_innerkits" ]
118    defines += [ "RESOURCESCHEDULE_BGTASKMGR_ENABLE" ]
119  }
120  if (powermgr_battery_manager_enable) {
121    external_deps += [ "battery_manager:batterysrv_client" ]
122    defines += [ "POWERMGR_BATTERY_MANAGER_ENABLE" ]
123  }
124  if (powermgr_thermal_manager_enable) {
125    external_deps += [ "thermal_manager:thermalsrv_client" ]
126    defines += [ "POWERMGR_THERMAL_MANAGER_ENABLE" ]
127  }
128  if (powermgr_power_manager_enable) {
129    external_deps += [ "power_manager:powermgr_client" ]
130    defines += [ "POWERMGR_POWER_MANAGER_ENABLE" ]
131    sources += [ "native/src/policy/power_mode_policy.cpp" ]
132  }
133  if (workscheduler_with_communication_netmanager_base_enable) {
134    defines += [ "COMMUNICATION_NETMANAGER_BASE_ENABLE" ]
135    external_deps += [ "netmanager_base:net_conn_manager_if" ]
136  }
137  if (workscheduler_hicollie_enable) {
138    external_deps += [ "hicollie:libhicollie" ]
139    defines += [ "HICOLLIE_ENABLE" ]
140  }
141  subsystem_name = "resourceschedule"
142  part_name = "${worksched_native_part_name}"
143}
144
145ohos_static_library("workschedservice_static") {
146  sanitize = {
147    cfi = true
148    cfi_cross_dso = true
149    debug = false
150  }
151  sources = [
152    "native/src/conditions/battery_level_listener.cpp",
153    "native/src/conditions/battery_status_listener.cpp",
154    "native/src/conditions/charger_listener.cpp",
155    "native/src/conditions/condition_checker.cpp",
156    "native/src/conditions/group_listener.cpp",
157    "native/src/conditions/network_listener.cpp",
158    "native/src/conditions/screen_listener.cpp",
159    "native/src/conditions/storage_listener.cpp",
160    "native/src/conditions/timer_listener.cpp",
161    "native/src/event_publisher.cpp",
162    "native/src/policy/app_data_clear_listener.cpp",
163    "native/src/policy/cpu_policy.cpp",
164    "native/src/policy/memory_policy.cpp",
165    "native/src/policy/thermal_policy.cpp",
166    "native/src/scheduler_bg_task_subscriber.cpp",
167    "native/src/watchdog.cpp",
168    "native/src/work_bundle_group_change_callback.cpp",
169    "native/src/work_conn_manager.cpp",
170    "native/src/work_datashare_helper.cpp",
171    "native/src/work_event_handler.cpp",
172    "native/src/work_policy_manager.cpp",
173    "native/src/work_queue.cpp",
174    "native/src/work_queue_event_handler.cpp",
175    "native/src/work_queue_manager.cpp",
176    "native/src/work_sched_config.cpp",
177    "native/src/work_sched_data_manager.cpp",
178    "native/src/work_scheduler_connection.cpp",
179    "native/src/work_scheduler_service.cpp",
180    "native/src/work_standby_state_change_callback.cpp",
181    "native/src/work_status.cpp",
182    "zidl/src/work_sched_service_stub.cpp",
183    "zidl/src/work_scheduler_proxy.cpp",
184  ]
185
186  configs = [ ":worksched_private_config" ]
187
188  public_configs = [ ":worksched_public_config" ]
189
190  deps = [
191    "${worksched_frameworks_path}:workschedclient",
192    "${worksched_utils_path}:workschedutils",
193  ]
194
195  external_deps = [
196    "ability_base:want",
197    "ability_base:zuri",
198    "ability_runtime:ability_manager",
199    "ability_runtime:wantagent_innerkits",
200    "access_token:libaccesstoken_sdk",
201    "access_token:libtokenid_sdk",
202    "bundle_framework:appexecfwk_base",
203    "bundle_framework:appexecfwk_core",
204    "c_utils:utils",
205    "common_event_service:cesfwk_innerkits",
206    "config_policy:configpolicy_util",
207    "data_share:datashare_consumer",
208    "eventhandler:libeventhandler",
209    "ffrt:libffrt",
210    "hilog:libhilog",
211    "hisysevent:libhisysevent",
212    "hitrace:hitrace_meter",
213    "hiview:libucollection_client",
214    "init:libbegetutil",
215    "ipc:ipc_single",
216    "resource_schedule_service:ressched_client",
217    "safwk:system_ability_fwk",
218    "samgr:samgr_proxy",
219    "time_service:time_client",
220  ]
221
222  defines = [ "WORK_SCHEDULER_TEST" ]
223  if (bundle_active_enable) {
224    external_deps += [ "device_usage_statistics:usagestatsinner" ]
225    defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ]
226  }
227  if (device_standby_enable) {
228    external_deps += [ "device_standby:standby_innerkits" ]
229    defines += [ "DEVICE_STANDBY_ENABLE" ]
230  }
231  if (resourceschedule_bgtaskmgr_enable) {
232    external_deps += [ "background_task_mgr:bgtaskmgr_innerkits" ]
233    defines += [ "RESOURCESCHEDULE_BGTASKMGR_ENABLE" ]
234  }
235  if (powermgr_battery_manager_enable) {
236    external_deps += [ "battery_manager:batterysrv_client" ]
237    defines += [ "POWERMGR_BATTERY_MANAGER_ENABLE" ]
238  }
239  if (powermgr_thermal_manager_enable) {
240    external_deps += [ "thermal_manager:thermalsrv_client" ]
241    defines += [ "POWERMGR_THERMAL_MANAGER_ENABLE" ]
242  }
243  if (powermgr_power_manager_enable) {
244    external_deps += [ "power_manager:powermgr_client" ]
245    defines += [ "POWERMGR_POWER_MANAGER_ENABLE" ]
246    sources += [ "native/src/policy/power_mode_policy.cpp" ]
247  }
248  if (workscheduler_with_communication_netmanager_base_enable) {
249    defines += [ "COMMUNICATION_NETMANAGER_BASE_ENABLE" ]
250    external_deps += [ "netmanager_base:net_conn_manager_if" ]
251  }
252  if (workscheduler_hicollie_enable) {
253    external_deps += [ "hicollie:libhicollie" ]
254    defines += [ "HICOLLIE_ENABLE" ]
255  }
256
257  subsystem_name = "resourceschedule"
258  part_name = "${worksched_native_part_name}"
259}
260