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 "safwk:system_ability_fwk", 61 "samgr:samgr_proxy", 62 "time_service:time_client", 63] 64 65StandbyPluginDefine = [] 66 67if (enable_standby_configpolicy) { 68 StandbyPluginExternalDeps += [ "config_policy:configpolicy_util" ] 69 StandbyPluginDefine += [ "STANDBY_CONFIG_POLICY_ENABLE" ] 70} 71 72if (enable_background_task_mgr) { 73 StandbyPluginExternalDeps += [ "background_task_mgr:bgtaskmgr_innerkits" ] 74 StandbyPluginSrc += [ 75 "${standby_service_message_listener_path}/src/background_task_listener.cpp", 76 ] 77 StandbyPluginDefine += [ "ENABLE_BACKGROUND_TASK_MGR" ] 78} 79 80if (standby_power_manager_enable) { 81 StandbyPluginExternalDeps += [ "power_manager:powermgr_client" ] 82 StandbyPluginDefine += [ "STANDBY_POWER_MANAGER_ENABLE" ] 83} 84 85if (standby_battery_manager_enable) { 86 StandbyPluginExternalDeps += [ "battery_manager:batterysrv_client" ] 87 StandbyPluginDefine += [ "STANDBY_BATTERY_MANAGER_ENABLE" ] 88} 89 90if (standby_multimodalinput_input_enable) { 91 StandbyPluginExternalDeps += [ "input:libmmi-client" ] 92 StandbyPluginDefine += [ "STANDBY_MULTIMODALINPUT_INPUT_ENABLE" ] 93 StandbyPluginSrc += [ 94 "${standby_service_message_listener_path}/src/input_manager_listener.cpp", 95 ] 96} 97 98if (standby_sensors_sensor_enable) { 99 StandbyPluginExternalDeps += [ "sensor:sensor_interface_native" ] 100 StandbyPluginDefine += [ "STANDBY_SENSORS_SENSOR_ENABLE" ] 101 StandbyPluginSrc += 102 [ "${standby_service_constraints_path}/src/motion_sensor_monitor.cpp" ] 103} 104 105if (standby_communication_netmanager_base_enable) { 106 StandbyPluginExternalDeps += [ "netmanager_base:net_policy_manager_if" ] 107 StandbyPluginDefine += [ "STANDBY_COMMUNICATION_NETMANAGER_BASE_ENABLE" ] 108} 109 110if (standby_rss_work_scheduler_enable) { 111 StandbyPluginExternalDeps += [ "work_scheduler:workschedclient" ] 112 StandbyPluginDefine += [ "STANDBY_RSS_WORK_SCHEDULER_ENABLE" ] 113} 114 115ohos_shared_library("standby_plugin") { 116 branch_protector_ret = "pac_ret" 117 sanitize = { 118 cfi = true 119 cfi_cross_dso = true 120 debug = false 121 } 122 sources = StandbyPluginSrc 123 124 public_configs = [ ":standby_plugin_config" ] 125 126 deps = [ 127 "${standby_service_frameworks_path}:standby_fwk", 128 "${standby_service_path}:standby_service", 129 "${standby_utils_common_path}:standby_utils_common", 130 "${standby_utils_policy_path}:standby_utils_policy", 131 ] 132 133 external_deps = StandbyPluginExternalDeps 134 135 defines = StandbyPluginDefine 136 137 subsystem_name = "resourceschedule" 138 part_name = "${standby_service_part_name}" 139 version_script = "libstandby_plugin.versionscript" 140} 141 142ohos_static_library("standby_plugin_static") { 143 branch_protector_ret = "pac_ret" 144 sanitize = { 145 cfi = true 146 cfi_cross_dso = true 147 debug = false 148 } 149 sources = StandbyPluginSrc 150 151 public_configs = [ ":standby_plugin_config" ] 152 153 deps = [ 154 "${standby_service_frameworks_path}:standby_fwk", 155 "${standby_service_path}:standby_service", 156 "${standby_utils_common_path}:standby_utils_common", 157 "${standby_utils_policy_path}:standby_utils_policy", 158 ] 159 160 external_deps = StandbyPluginExternalDeps 161 162 defines = StandbyPluginDefine 163 164 subsystem_name = "resourceschedule" 165 part_name = "${standby_service_part_name}" 166} 167 168group("standby_plugin_group") { 169 deps = [] 170 if (device_standby_plugin_enable) { 171 deps += [ ":standby_plugin" ] 172 } 173} 174