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