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