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