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/resourceschedule/device_standby/standby_service.gni")
16
17config("standby_service_public_config") {
18  include_dirs = [
19    "common/include",
20    "core/include",
21    "notification/include",
22    "${standby_plugins_path}/ext/include",
23  ]
24}
25
26ohos_shared_library("standby_service") {
27  branch_protector_ret = "pac_ret"
28  sanitize = {
29    cfi = true
30    cfi_cross_dso = true
31    debug = false
32  }
33  if (!use_clang_coverage) {
34    shlib_type = "sa"
35  }
36
37  sources = [
38    "common/src/device_standby_switch.cpp",
39    "common/src/time_provider.cpp",
40    "common/src/timed_task.cpp",
41    "core/src/ability_manager_helper.cpp",
42    "core/src/allow_record.cpp",
43    "core/src/app_mgr_helper.cpp",
44    "core/src/app_state_observer.cpp",
45    "core/src/bundle_manager_helper.cpp",
46    "core/src/common_event_observer.cpp",
47    "core/src/standby_service.cpp",
48    "core/src/standby_service_impl.cpp",
49    "notification/src/standby_state_subscriber.cpp",
50  ]
51
52  public_configs = [ ":standby_service_public_config" ]
53
54  deps = [
55    "${standby_innerkits_path}:standby_innerkits",
56    "${standby_service_frameworks_path}:standby_fwk",
57    "${standby_utils_common_path}:standby_utils_common",
58    "${standby_utils_policy_path}:standby_utils_policy",
59  ]
60
61  external_deps = [
62    "ability_base:want",
63    "ability_runtime:app_manager",
64    "ability_runtime:wantagent_innerkits",
65    "access_token:libaccesstoken_sdk",
66    "access_token:libtokenid_sdk",
67    "bundle_framework:appexecfwk_base",
68    "c_utils:utils",
69    "common_event_service:cesfwk_innerkits",
70    "eventhandler:libeventhandler",
71    "hilog:libhilog",
72    "init:libbegetutil",
73    "ipc:ipc_single",
74    "json:nlohmann_json_static",
75    "safwk:system_ability_fwk",
76    "samgr:samgr_proxy",
77    "time_service:time_client",
78  ]
79
80  defines = []
81  if (enable_background_task_mgr) {
82    external_deps += [ "background_task_mgr:bgtaskmgr_innerkits" ]
83    sources += [ "common/src/background_task_helper.cpp" ]
84    defines += [ "ENABLE_BACKGROUND_TASK_MGR" ]
85  }
86
87  if (standby_power_manager_enable) {
88    external_deps += [ "power_manager:powermgr_client" ]
89    defines += [ "STANDBY_POWER_MANAGER_ENABLE" ]
90  }
91
92  subsystem_name = "resourceschedule"
93  part_name = "${standby_service_part_name}"
94
95  version_script = "libstandby_service.versionscript"
96}
97
98ohos_static_library("standby_service_static") {
99  branch_protector_ret = "pac_ret"
100  sanitize = {
101    cfi = true
102    cfi_cross_dso = true
103    debug = false
104  }
105  cflags_cc = [ "-DSTANDBY_SERVICE_UNIT_TEST" ]
106  sources = [
107    "common/src/device_standby_switch.cpp",
108    "common/src/time_provider.cpp",
109    "common/src/timed_task.cpp",
110    "core/src/ability_manager_helper.cpp",
111    "core/src/allow_record.cpp",
112    "core/src/app_mgr_helper.cpp",
113    "core/src/app_state_observer.cpp",
114    "core/src/bundle_manager_helper.cpp",
115    "core/src/common_event_observer.cpp",
116    "core/src/standby_service.cpp",
117    "core/src/standby_service_impl.cpp",
118    "notification/src/standby_state_subscriber.cpp",
119  ]
120
121  public_configs = [ ":standby_service_public_config" ]
122
123  deps = [
124    "${standby_innerkits_path}:standby_innerkits",
125    "${standby_service_frameworks_path}:standby_fwk",
126    "${standby_utils_common_path}:standby_utils_common",
127    "${standby_utils_policy_path}:standby_utils_policy",
128  ]
129
130  external_deps = [
131    "ability_base:want",
132    "ability_runtime:app_manager",
133    "ability_runtime:wantagent_innerkits",
134    "access_token:libaccesstoken_sdk",
135    "access_token:libtokenid_sdk",
136    "bundle_framework:appexecfwk_base",
137    "c_utils:utils",
138    "common_event_service:cesfwk_innerkits",
139    "eventhandler:libeventhandler",
140    "hilog:libhilog",
141    "init:libbegetutil",
142    "ipc:ipc_single",
143    "json:nlohmann_json_static",
144    "safwk:system_ability_fwk",
145    "samgr:samgr_proxy",
146    "time_service:time_client",
147  ]
148
149  defines = []
150  if (enable_background_task_mgr) {
151    external_deps += [ "background_task_mgr:bgtaskmgr_innerkits" ]
152    sources += [ "common/src/background_task_helper.cpp" ]
153    defines += [ "ENABLE_BACKGROUND_TASK_MGR" ]
154  }
155
156  if (standby_power_manager_enable) {
157    external_deps += [ "power_manager:powermgr_client" ]
158    defines += [ "STANDBY_POWER_MANAGER_ENABLE" ]
159  }
160
161  subsystem_name = "resourceschedule"
162  part_name = "${standby_service_part_name}"
163}
164