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("//build/test.gni") 15import("//foundation/resourceschedule/background_task_mgr/bgtaskmgr.gni") 16 17config("bgtaskmgr_service_public_config") { 18 include_dirs = [ 19 "common/include", 20 "continuous_task/include", 21 "core/include", 22 "transient_task/include", 23 "test/include", 24 "efficiency_resources/include", 25 ] 26} 27 28BgTaskMgrServicecSrc = [ 29 "common/src/app_state_observer.cpp", 30 "common/src/bgtask_config.cpp", 31 "common/src/bundle_manager_helper.cpp", 32 "common/src/data_storage_helper.cpp", 33 "common/src/system_event_observer.cpp", 34 "common/src/time_provider.cpp", 35 "continuous_task/src/bg_continuous_task_mgr.cpp", 36 "continuous_task/src/config_change_observer.cpp", 37 "continuous_task/src/continuous_task_record.cpp", 38 "continuous_task/src/notification_tools.cpp", 39 "core/src/background_task_mgr_service.cpp", 40 "efficiency_resources/src/bg_efficiency_resources_mgr.cpp", 41 "efficiency_resources/src/resource_application_record.cpp", 42 "efficiency_resources/src/resources_subscriber_mgr.cpp", 43 "transient_task/src/bg_transient_task_mgr.cpp", 44 "transient_task/src/bgtask_common.cpp", 45 "transient_task/src/decision_maker.cpp", 46 "transient_task/src/delay_suspend_info_ex.cpp", 47 "transient_task/src/device_info_manager.cpp", 48 "transient_task/src/event_hub.cpp", 49 "transient_task/src/input_manager.cpp", 50 "transient_task/src/pkg_delay_suspend_info.cpp", 51 "transient_task/src/suspend_controller.cpp", 52 "transient_task/src/timer_manager.cpp", 53 "transient_task/src/watchdog.cpp", 54] 55 56ohos_shared_library("bgtaskmgr_service") { 57 branch_protector_ret = "pac_ret" 58 sanitize = { 59 cfi = true 60 cfi_cross_dso = true 61 debug = false 62 } 63 if (!use_clang_coverage) { 64 shlib_type = "sa" 65 } 66 67 cflags_cc = [ 68 "-fvisibility=hidden", 69 "-fdata-sections", 70 "-ffunction-sections", 71 "-fvisibility-inlines-hidden", 72 "-Os", 73 ] 74 sources = BgTaskMgrServicecSrc 75 76 public_configs = [ ":bgtaskmgr_service_public_config" ] 77 78 deps = [ 79 "${bgtaskmgr_interfaces_path}/innerkits:background_task_mgr_stub", 80 "${bgtaskmgr_interfaces_path}/innerkits:background_task_subscriber_proxy", 81 "${bgtaskmgr_interfaces_path}/innerkits:bgtaskmgr_innerkits", 82 "${bgtaskmgr_interfaces_path}/innerkits:expired_callback_proxy", 83 ] 84 85 external_deps = [ 86 "ability_base:base", 87 "ability_base:configuration", 88 "ability_base:want", 89 "ability_base:zuri", 90 "ability_runtime:app_manager", 91 "ability_runtime:wantagent_innerkits", 92 "access_token:libaccesstoken_sdk", 93 "access_token:libtokenid_sdk", 94 "bundle_framework:appexecfwk_base", 95 "bundle_framework:appexecfwk_core", 96 "c_utils:utils", 97 "common_event_service:cesfwk_innerkits", 98 "config_policy:configpolicy_util", 99 "eventhandler:libeventhandler", 100 "hilog:libhilog", 101 "hisysevent:libhisysevent", 102 "hitrace:hitrace_meter", 103 "init:libbegetutil", 104 "ipc:ipc_single", 105 "jsoncpp:jsoncpp", 106 "safwk:system_ability_fwk", 107 "samgr:samgr_proxy", 108 ] 109 110 if (has_os_account_part) { 111 cflags_cc += [ "-DHAS_OS_ACCOUNT_PART" ] 112 external_deps += [ "os_account:os_account_innerkits" ] 113 } 114 115 if (distributed_notification_enable) { 116 cflags_cc += [ "-DDISTRIBUTED_NOTIFICATION_ENABLE" ] 117 external_deps += [ "distributed_notification_service:ans_innerkits" ] 118 sources += [ "continuous_task/src/task_notification_subscriber.cpp" ] 119 } 120 121 if (background_task_mgr_graphics) { 122 cflags_cc += [ "-DSUPPORT_GRAPHICS" ] 123 external_deps += [ 124 "i18n:intl_util", 125 "icu:shared_icuuc", 126 ] 127 } 128 129 subsystem_name = "resourceschedule" 130 part_name = "background_task_mgr" 131} 132 133ohos_static_library("bgtaskmgr_service_static") { 134 cflags_cc = [ "-DBGTASK_MGR_UNIT_TEST" ] 135 sources = BgTaskMgrServicecSrc 136 137 public_configs = [ ":bgtaskmgr_service_public_config" ] 138 139 deps = [ "${bgtaskmgr_interfaces_path}/innerkits:bgtaskmgr_innerkits" ] 140 141 external_deps = [ 142 "ability_base:base", 143 "ability_base:configuration", 144 "ability_base:want", 145 "ability_base:zuri", 146 "ability_runtime:app_manager", 147 "ability_runtime:wantagent_innerkits", 148 "access_token:libaccesstoken_sdk", 149 "access_token:libtokenid_sdk", 150 "bundle_framework:appexecfwk_base", 151 "bundle_framework:appexecfwk_core", 152 "c_utils:utils", 153 "common_event_service:cesfwk_innerkits", 154 "config_policy:configpolicy_util", 155 "eventhandler:libeventhandler", 156 "hilog:libhilog", 157 "hisysevent:libhisysevent", 158 "hitrace:hitrace_meter", 159 "init:libbegetutil", 160 "ipc:ipc_single", 161 "jsoncpp:jsoncpp", 162 "relational_store:native_rdb", 163 "resource_management:global_resmgr", 164 "safwk:system_ability_fwk", 165 "samgr:samgr_proxy", 166 ] 167 168 if (has_os_account_part) { 169 cflags_cc += [ "-DHAS_OS_ACCOUNT_PART" ] 170 external_deps += [ "os_account:os_account_innerkits" ] 171 } 172 173 if (distributed_notification_enable) { 174 cflags_cc += [ "-DDISTRIBUTED_NOTIFICATION_ENABLE" ] 175 external_deps += [ "distributed_notification_service:ans_innerkits" ] 176 sources += [ "continuous_task/src/task_notification_subscriber.cpp" ] 177 } 178 179 if (background_task_mgr_graphics) { 180 cflags_cc += [ "-DSUPPORT_GRAPHICS" ] 181 external_deps += [ 182 "i18n:intl_util", 183 "icu:shared_icuuc", 184 ] 185 } 186 187 subsystem_name = "resourceschedule" 188 part_name = "background_task_mgr" 189} 190