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