• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_service_zidl}/include",
21    "${battery_inner_api}/native/include",
22  ]
23}
24
25ohos_shared_library("batteryservice") {
26  sanitize = {
27    cfi = true
28    cfi_cross_dso = true
29    debug = false
30  }
31  branch_protector_ret = "pac_ret"
32
33  sources = [
34    "native/src/battery_callback.cpp",
35    "native/src/battery_config.cpp",
36    "native/src/battery_dump.cpp",
37    "native/src/battery_light.cpp",
38    "native/src/battery_notify.cpp",
39    "native/src/battery_service.cpp",
40  ]
41
42  configs = [
43    "${battery_utils}:utils_config",
44    "${battery_utils}:coverage_flags",
45  ]
46
47  public_configs = [ ":batterysrv_public_config" ]
48
49  deps = [ "${battery_service_zidl}:batterysrv_stub" ]
50
51  external_deps = [ "power_manager:power_permission" ]
52  external_deps += [
53    "ability_runtime:ability_manager",
54    "bundle_framework:appexecfwk_base",
55    "c_utils:utils",
56    "common_event_service:cesfwk_core",
57    "common_event_service:cesfwk_innerkits",
58    "config_policy:configpolicy_util",
59    "drivers_interface_battery:libbattery_proxy_2.0",
60    "ffrt:libffrt",
61    "hdf_core:libhdi",
62    "hdf_core:libpub_utils",
63    "hicollie:libhicollie",
64    "hilog:libhilog",
65    "hisysevent:libhisysevent",
66    "ipc:ipc_core",
67    "jsoncpp:jsoncpp",
68    "miscdevice:light_interface_native",
69    "power_manager:power_ffrt",
70    "power_manager:power_sysparam",
71    "power_manager:power_vibrator",
72    "power_manager:powermgr_client",
73    "safwk:system_ability_fwk",
74    "samgr:samgr_proxy",
75  ]
76
77  defines = []
78
79  public_external_deps = [ "ability_base:want" ]
80
81  if (battery_manager_feature_enable_charging_sound) {
82    defines += [ "BATTERY_MANAGER_ENABLE_CHARGING_SOUND" ]
83    sources += [ "native/src/charging_sound.cpp" ]
84    external_deps += [
85      "audio_framework:audio_client",
86      "config_policy:configpolicy_util",
87      "player_framework:audio_haptic",
88    ]
89  }
90
91  if (battery_manager_feature_enable_wireless_charge) {
92    defines += [ "BATTERY_MANAGER_ENABLE_WIRELESS_CHARGE" ]
93  }
94
95  if (battery_manager_feature_set_low_capacity_threshold) {
96    defines += [ "BATTERY_MANAGER_SET_LOW_CAPACITY_THRESHOLD" ]
97  }
98
99  if (battery_manager_feature_support_notification) {
100    defines += [ "BATTERY_SUPPORT_NOTIFICATION" ]
101  }
102
103  if (build_variant == "user") {
104    defines += [ "BATTERY_USER_VERSION" ]
105  }
106
107  subsystem_name = "powermgr"
108  part_name = "battery_manager"
109}
110
111ohos_shared_library("battery_notification") {
112  sanitize = {
113    cfi = true
114    cfi_cross_dso = true
115    debug = false
116  }
117  branch_protector_ret = "pac_ret"
118
119  include_dirs = [ "native/notification" ]
120
121  sources = [
122    "native/notification/button_event.cpp",
123    "native/notification/notification_center.cpp",
124    "native/notification/notification_decorator.cpp",
125    "native/notification/notification_locale.cpp",
126    "native/notification/notification_manager.cpp",
127  ]
128
129  configs = [
130    "${battery_utils}:utils_config",
131    "${battery_utils}:coverage_flags",
132  ]
133
134  public_configs = [ ":batterysrv_public_config" ]
135
136  public_external_deps = [ "ability_base:want" ]
137
138  deps = [ "${battery_inner_api}:batterysrv_client" ]
139
140  external_deps = [
141    "ability_base:zuri",
142    "c_utils:utils",
143    "config_policy:configpolicy_util",
144    "distributed_notification_service:ans_innerkits",
145    "hilog:libhilog",
146    "i18n:intl_util",
147    "image_framework:image_native",
148    "jsoncpp:jsoncpp",
149  ]
150
151  subsystem_name = "powermgr"
152  part_name = "battery_manager"
153}
154
155group("service") {
156  deps = [
157    ":battery_notification",
158    ":batteryservice",
159    "native/profile:battery_config",
160    "native/profile:battery_vibrator_config",
161  ]
162
163  if (battery_manager_feature_support_notification) {
164    deps += [
165      "native/resources:battery_locale_path",
166      "native/resources:battery_notification_base",
167      "native/resources:battery_notification_bo_CN",
168      "native/resources:battery_notification_ug",
169      "native/resources:battery_notification_zh_CN",
170      "native/resources:battery_notification_zh_HK",
171      "native/resources:battery_notification_zh_TW",
172      "native/resources:battery_notification_zz_ZX",
173    ]
174  }
175}
176