1# Copyright (c) 2021-2023 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("../batterymgr.gni") 15 16config("batterysrv_public_config") { 17 include_dirs = [ 18 "native/include", 19 "native/notification", 20 "${battery_inner_api}/native/include", 21 ] 22} 23 24ohos_shared_library("charging_sound") { 25 include_dirs = [ "native/include" ] 26 sanitize = { 27 cfi = true 28 cfi_cross_dso = true 29 debug = false 30 } 31 branch_protector_ret = "pac_ret" 32 33 sources = [ "native/src/charging_sound.cpp" ] 34 35 configs = [ "${battery_utils}:utils_config" ] 36 37 external_deps = [ 38 "audio_framework:audio_client", 39 "c_utils:utils", 40 "config_policy:configpolicy_util", 41 "hilog:libhilog", 42 "player_framework:media_client", 43 ] 44 45 subsystem_name = "powermgr" 46 part_name = "battery_manager" 47} 48 49ohos_shared_library("batteryservice") { 50 sanitize = { 51 cfi = true 52 cfi_cross_dso = true 53 debug = false 54 } 55 branch_protector_ret = "pac_ret" 56 57 sources = [ 58 "${battery_utils}/native/src/battery_xcollie.cpp", 59 "native/src/battery_callback.cpp", 60 "native/src/battery_config.cpp", 61 "native/src/battery_dump.cpp", 62 "native/src/battery_light.cpp", 63 "native/src/battery_notify.cpp", 64 "native/src/battery_service.cpp", 65 ] 66 67 configs = [ 68 "${battery_utils}:utils_config", 69 "${battery_utils}:coverage_flags", 70 ] 71 72 public_configs = [ 73 "${battery_service_zidl}:batterysrv_public_config", 74 ":batterysrv_public_config", 75 ] 76 77 deps = [ 78 "${battery_service_zidl}:batterysrv_stub", 79 "${battery_utils}/hookmgr:battery_hookmgr" 80 ] 81 82 external_deps = [ "power_manager:power_permission" ] 83 external_deps += [ 84 "ability_base:want", 85 "ability_runtime:ability_manager", 86 "bundle_framework:appexecfwk_base", 87 "cJSON:cjson", 88 "c_utils:utils", 89 "common_event_service:cesfwk_core", 90 "common_event_service:cesfwk_innerkits", 91 "config_policy:configpolicy_util", 92 "drivers_interface_battery:libbattery_proxy_2.0", 93 "eventhandler:libeventhandler", 94 "ffrt:libffrt", 95 "hdf_core:libhdi", 96 "hdf_core:libpub_utils", 97 "hicollie:libhicollie", 98 "hilog:libhilog", 99 "hisysevent:libhisysevent", 100 "ipc:ipc_core", 101 "init:libbegetutil", 102 "miscdevice:light_interface_native", 103 "power_manager:power_ffrt", 104 "power_manager:power_sysparam", 105 "power_manager:power_vibrator", 106 "power_manager:powermgr_client", 107 "safwk:system_ability_fwk", 108 "samgr:samgr_proxy", 109 ] 110 111 defines = [] 112 113 if (use_musl) { 114 if (musl_use_jemalloc && musl_use_jemalloc_dfx_intf) { 115 defines += [ "CONFIG_USE_JEMALLOC_DFX_INTF" ] 116 } 117 } 118 119 if (battery_manager_feature_enable_charging_sound) { 120 defines += [ "BATTERY_MANAGER_ENABLE_CHARGING_SOUND" ] 121 } 122 123 if (battery_manager_feature_enable_wireless_charge) { 124 defines += [ "BATTERY_MANAGER_ENABLE_WIRELESS_CHARGE" ] 125 } 126 127 if (battery_manager_feature_set_low_capacity_threshold) { 128 defines += [ "BATTERY_MANAGER_SET_LOW_CAPACITY_THRESHOLD" ] 129 } 130 131 if (battery_manager_feature_support_notification) { 132 defines += [ "BATTERY_SUPPORT_NOTIFICATION" ] 133 } 134 135 if (build_variant == "user") { 136 defines += [ "BATTERY_USER_VERSION" ] 137 } 138 139 subsystem_name = "powermgr" 140 part_name = "battery_manager" 141} 142 143ohos_shared_library("battery_notification") { 144 sanitize = { 145 cfi = true 146 cfi_cross_dso = true 147 debug = false 148 } 149 branch_protector_ret = "pac_ret" 150 151 include_dirs = [ "native/notification" ] 152 153 sources = [ 154 "native/notification/button_event.cpp", 155 "native/notification/notification_center.cpp", 156 "native/notification/notification_decorator.cpp", 157 "native/notification/notification_locale.cpp", 158 "native/notification/notification_manager.cpp", 159 ] 160 161 configs = [ 162 "${battery_utils}:utils_config", 163 "${battery_utils}:coverage_flags", 164 ] 165 166 public_configs = [ ":batterysrv_public_config" ] 167 168 deps = [ "${battery_inner_api}:batterysrv_client" ] 169 170 external_deps = [ 171 "ability_base:want", 172 "ability_base:zuri", 173 "cJSON:cjson", 174 "c_utils:utils", 175 "config_policy:configpolicy_util", 176 "distributed_notification_service:ans_innerkits", 177 "hilog:libhilog", 178 "i18n:intl_util", 179 "image_framework:image_native", 180 "ipc:ipc_single" 181 ] 182 183 subsystem_name = "powermgr" 184 part_name = "battery_manager" 185} 186 187group("service") { 188 deps = [ 189 ":battery_notification", 190 ":batteryservice", 191 "native/profile:battery_config", 192 "native/profile:battery_vibrator_config", 193 ] 194 195 if (battery_manager_feature_enable_charging_sound) { 196 deps += [ ":charging_sound" ] 197 } 198 199 if (battery_manager_feature_support_notification) { 200 deps += [ "native/resources:battery_locale_path" ] 201 if (battery_manager_feature_support_notification_string) { 202 deps += [ 203 "native/resources:battery_notification_base", 204 "native/resources:battery_notification_bo_CN", 205 "native/resources:battery_notification_ug", 206 "native/resources:battery_notification_zh_CN", 207 "native/resources:battery_notification_zh_HK", 208 "native/resources:battery_notification_zh_TW", 209 "native/resources:battery_notification_zz_ZX", 210 ] 211 } 212 } 213} 214