1# Copyright (c) 2024 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_plugin_config") { 18 include_dirs = [ 19 "${standby_plugins_path}/ext/include", 20 "${standby_service_constraints_path}/include", 21 "${standby_service_message_listener_path}/include", 22 "${standby_service_standby_state_path}/include", 23 "${standby_service_strategy_path}/include", 24 "${standby_utils_common_path}/include", 25 "${standby_utils_policy_path}/include", 26 ] 27} 28 29StandbyPluginSrc = [ 30 "${standby_plugins_path}/ext/src/base_state.cpp", 31 "${standby_plugins_path}/ext/src/istate_manager_adapter.cpp", 32 "${standby_service_constraints_path}/src/charge_state_monitor.cpp", 33 "${standby_service_constraints_path}/src/constraint_manager_adapter.cpp", 34 "${standby_service_message_listener_path}/src/listener_manager_adapter.cpp", 35 "${standby_service_standby_state_path}/src/dark_state.cpp", 36 "${standby_service_standby_state_path}/src/export_plugin.cpp", 37 "${standby_service_standby_state_path}/src/maintenance_state.cpp", 38 "${standby_service_standby_state_path}/src/nap_state.cpp", 39 "${standby_service_standby_state_path}/src/sleep_state.cpp", 40 "${standby_service_standby_state_path}/src/state_manager_adapter.cpp", 41 "${standby_service_standby_state_path}/src/working_state.cpp", 42 "${standby_service_strategy_path}/src/base_network_strategy.cpp", 43 "${standby_service_strategy_path}/src/network_strategy.cpp", 44 "${standby_service_strategy_path}/src/running_lock_strategy.cpp", 45 "${standby_service_strategy_path}/src/timer_strategy.cpp", 46 "${standby_service_strategy_path}/src/strategy_manager_adapter.cpp", 47] 48 49StandbyPluginExternalDeps = [ 50 "ability_base:want", 51 "ability_runtime:app_manager", 52 "ability_runtime:wantagent_innerkits", 53 "access_token:libaccesstoken_sdk", 54 "c_utils:utils", 55 "common_event_service:cesfwk_innerkits", 56 "eventhandler:libeventhandler", 57 "hilog:libhilog", 58 "init:libbegetutil", 59 "ipc:ipc_single", 60 "resource_schedule_service:ressched_client", 61 "resource_schedule_service:resschedsvc", 62 "safwk:system_ability_fwk", 63 "samgr:samgr_proxy", 64 "time_service:time_client", 65] 66 67StandbyPluginDefine = [] 68 69if (enable_standby_configpolicy) { 70 StandbyPluginExternalDeps += [ "config_policy:configpolicy_util" ] 71 StandbyPluginDefine += [ "STANDBY_CONFIG_POLICY_ENABLE" ] 72} 73 74if (enable_background_task_mgr) { 75 StandbyPluginExternalDeps += [ "background_task_mgr:bgtaskmgr_innerkits" ] 76 StandbyPluginSrc += [ 77 "${standby_service_message_listener_path}/src/background_task_listener.cpp", 78 ] 79 StandbyPluginDefine += [ "ENABLE_BACKGROUND_TASK_MGR" ] 80} 81 82if (standby_power_manager_enable) { 83 StandbyPluginExternalDeps += [ "power_manager:powermgr_client" ] 84 StandbyPluginDefine += [ "STANDBY_POWER_MANAGER_ENABLE" ] 85} 86 87if (standby_battery_manager_enable) { 88 StandbyPluginExternalDeps += [ "battery_manager:batterysrv_client" ] 89 StandbyPluginDefine += [ "STANDBY_BATTERY_MANAGER_ENABLE" ] 90} 91 92if (standby_multimodalinput_input_enable) { 93 StandbyPluginExternalDeps += [ "input:libmmi-client" ] 94 StandbyPluginDefine += [ "STANDBY_MULTIMODALINPUT_INPUT_ENABLE" ] 95 StandbyPluginSrc += [ 96 "${standby_service_message_listener_path}/src/input_manager_listener.cpp", 97 ] 98} 99 100if (standby_sensors_sensor_enable) { 101 StandbyPluginExternalDeps += [ "sensor:sensor_interface_native" ] 102 StandbyPluginDefine += [ "STANDBY_SENSORS_SENSOR_ENABLE" ] 103 StandbyPluginSrc += 104 [ "${standby_service_constraints_path}/src/motion_sensor_monitor.cpp" ] 105} 106 107if (standby_communication_netmanager_base_enable) { 108 StandbyPluginExternalDeps += [ "netmanager_base:net_policy_manager_if" ] 109 StandbyPluginDefine += [ "STANDBY_COMMUNICATION_NETMANAGER_BASE_ENABLE" ] 110} 111 112if (standby_rss_work_scheduler_enable) { 113 StandbyPluginExternalDeps += [ "work_scheduler:workschedclient" ] 114 StandbyPluginDefine += [ "STANDBY_RSS_WORK_SCHEDULER_ENABLE" ] 115} 116 117if (device_standby_realtime_timer_enable) { 118 StandbyPluginDefine += [ "STANDBY_REALTIME_TIMER_ENABLE" ] 119} 120 121ohos_shared_library("standby_plugin") { 122 branch_protector_ret = "pac_ret" 123 sanitize = { 124 cfi = true 125 cfi_cross_dso = true 126 debug = false 127 } 128 sources = StandbyPluginSrc 129 130 public_configs = [ ":standby_plugin_config" ] 131 132 deps = [ 133 "${standby_service_frameworks_path}:standby_fwk", 134 "${standby_service_path}:standby_service", 135 "${standby_utils_common_path}:standby_utils_common", 136 "${standby_utils_policy_path}:standby_utils_policy", 137 ] 138 139 external_deps = StandbyPluginExternalDeps 140 141 defines = StandbyPluginDefine 142 143 subsystem_name = "resourceschedule" 144 part_name = "${standby_service_part_name}" 145 version_script = "libstandby_plugin.versionscript" 146} 147 148ohos_static_library("standby_plugin_static") { 149 branch_protector_ret = "pac_ret" 150 sanitize = { 151 cfi = true 152 cfi_cross_dso = true 153 debug = false 154 } 155 sources = StandbyPluginSrc 156 157 public_configs = [ ":standby_plugin_config" ] 158 159 deps = [ 160 "${standby_service_frameworks_path}:standby_fwk", 161 "${standby_service_path}:standby_service", 162 "${standby_utils_common_path}:standby_utils_common", 163 "${standby_utils_policy_path}:standby_utils_policy", 164 ] 165 166 external_deps = StandbyPluginExternalDeps 167 168 defines = StandbyPluginDefine 169 170 subsystem_name = "resourceschedule" 171 part_name = "${standby_service_part_name}" 172} 173 174group("standby_plugin_group") { 175 deps = [] 176 if (device_standby_plugin_enable) { 177 deps += [ ":standby_plugin" ] 178 } 179} 180