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